Exemple #1
0
func NewBackend(backendAddr string) (*rpc.Client, error) {
	conn, err := secrpc.SecureDial("tcp", backendAddr, []byte(RollbackupCA))
	if err != nil {
		log.Fatal("agent connection: ", err)
		return nil, err
	}
	return jsonrpc.NewClient(conn), nil
}
Exemple #2
0
func NewAgent(backendAddr, hostId, token, agentVersion string) *Agent {
	conn, err := secrpc.SecureDial("tcp", backendAddr, []byte(RollbackupCA))
	if err != nil {
		log.Fatal("agent connection: ", err)
	}

	return &Agent{
		auth:    &rb.HostAuth{HostId: hostId, Token: token, AgentVersion: agentVersion},
		backend: jsonrpc.NewClient(conn),
	}
}