Documentation ¶
Overview ¶
Package rpc implements a gRPC client and server for management and monitoring of a cunicu daemon
Index ¶
- func DaemonRunning(path string) bool
- type Client
- func (c *Client) AddEventHandler(h EventHandler)
- func (c *Client) Close() error
- func (c *Client) OnEvent(e *rpcproto.Event)
- func (c *Client) RemoveEventHandler(h EventHandler)
- func (c *Client) RestartPeer(ctx context.Context, intf string, pk *crypto.Key) error
- func (c *Client) Unwait() error
- func (c *Client) WaitForEvent(ctx context.Context, t rpcproto.EventType, intf string, peer crypto.Key) (*rpcproto.Event, error)
- func (c *Client) WaitForPeerHandshake(ctx context.Context, peer crypto.Key) error
- func (c *Client) WaitForPeerState(ctx context.Context, peer crypto.Key, csd daemon.PeerState) error
- type DaemonServer
- func (s *DaemonServer) AddPeer(_ context.Context, params *rpcproto.AddPeerParams) (*rpcproto.AddPeerResp, error)
- func (s *DaemonServer) GetBuildInfo(context.Context, *proto.Empty) (*proto.BuildInfo, error)
- func (s *DaemonServer) GetCompletion(_ context.Context, params *rpcproto.GetCompletionParams) (*rpcproto.GetCompletionResp, error)
- func (s *DaemonServer) GetConfig(_ context.Context, p *rpcproto.GetConfigParams) (*rpcproto.GetConfigResp, error)
- func (s *DaemonServer) GetStatus(_ context.Context, p *rpcproto.GetStatusParams) (*rpcproto.GetStatusResp, error)
- func (s *DaemonServer) OnInterfaceAdded(i *daemon.Interface)
- func (s *DaemonServer) OnInterfaceRemoved(_ *daemon.Interface)
- func (s *DaemonServer) OnPeerStateChanged(p *daemon.Peer, newState, prevState daemon.PeerState)
- func (s *DaemonServer) ReloadConfig(_ context.Context, _ *proto.Empty) (*proto.Empty, error)
- func (s *DaemonServer) SendPeerStates(stream rpcproto.Daemon_StreamEventsServer)
- func (s *DaemonServer) SetConfig(_ context.Context, p *rpcproto.SetConfigParams) (*proto.Empty, error)
- func (s *DaemonServer) Shutdown(_ context.Context, params *rpcproto.ShutdownParams) (*proto.Empty, error)
- func (s *DaemonServer) StreamEvents(_ *proto.Empty, stream rpcproto.Daemon_StreamEventsServer) error
- func (s *DaemonServer) Sync(_ context.Context, _ *proto.Empty) (*proto.Empty, error)
- func (s *DaemonServer) UnWait(_ context.Context, _ *proto.Empty) (*proto.Empty, error)
- type EndpointDiscoveryServer
- type Event
- type EventHandler
- type Server
- func (s *Server) Close() error
- func (s *Server) OnInterfaceAdded(i *daemon.Interface)
- func (s *Server) OnInterfaceModified(i *daemon.Interface, _ *wg.Interface, mod daemon.InterfaceModifier)
- func (s *Server) OnInterfaceRemoved(i *daemon.Interface)
- func (s *Server) OnPeerAdded(p *daemon.Peer)
- func (s *Server) OnPeerModified(p *daemon.Peer, _ *wgtypes.Peer, mod daemon.PeerModifier, _, _ []net.IPNet)
- func (s *Server) OnPeerRemoved(p *daemon.Peer)
- func (s *Server) OnSignalingBackendReady(b signaling.Backend)
- func (s *Server) OnSignalingMessage(_ *crypto.PublicKeyPair, _ *signaling.Message)
- func (s *Server) Wait()
- type SignalingServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DaemonRunning ¶
Types ¶
type Client ¶
type Client struct { io.Closer rpcproto.EndpointDiscoverySocketClient rpcproto.SignalingClient rpcproto.DaemonClient // contains filtered or unexported fields }
func (*Client) AddEventHandler ¶
func (c *Client) AddEventHandler(h EventHandler)
func (*Client) RemoveEventHandler ¶
func (c *Client) RemoveEventHandler(h EventHandler)
func (*Client) RestartPeer ¶
func (*Client) WaitForEvent ¶
func (*Client) WaitForPeerHandshake ¶
type DaemonServer ¶
type DaemonServer struct { rpcproto.UnimplementedDaemonServer *Server *daemon.Daemon }
func NewDaemonServer ¶
func NewDaemonServer(s *Server, d *daemon.Daemon) *DaemonServer
func (*DaemonServer) AddPeer ¶
func (s *DaemonServer) AddPeer(_ context.Context, params *rpcproto.AddPeerParams) (*rpcproto.AddPeerResp, error)
func (*DaemonServer) GetBuildInfo ¶
func (*DaemonServer) GetCompletion ¶
func (s *DaemonServer) GetCompletion(_ context.Context, params *rpcproto.GetCompletionParams) (*rpcproto.GetCompletionResp, error)
func (*DaemonServer) GetConfig ¶
func (s *DaemonServer) GetConfig(_ context.Context, p *rpcproto.GetConfigParams) (*rpcproto.GetConfigResp, error)
func (*DaemonServer) GetStatus ¶
func (s *DaemonServer) GetStatus(_ context.Context, p *rpcproto.GetStatusParams) (*rpcproto.GetStatusResp, error)
func (*DaemonServer) OnInterfaceAdded ¶
func (s *DaemonServer) OnInterfaceAdded(i *daemon.Interface)
func (*DaemonServer) OnInterfaceRemoved ¶
func (s *DaemonServer) OnInterfaceRemoved(_ *daemon.Interface)
func (*DaemonServer) OnPeerStateChanged ¶
func (s *DaemonServer) OnPeerStateChanged(p *daemon.Peer, newState, prevState daemon.PeerState)
func (*DaemonServer) ReloadConfig ¶
func (*DaemonServer) SendPeerStates ¶
func (s *DaemonServer) SendPeerStates(stream rpcproto.Daemon_StreamEventsServer)
func (*DaemonServer) SetConfig ¶
func (s *DaemonServer) SetConfig(_ context.Context, p *rpcproto.SetConfigParams) (*proto.Empty, error)
func (*DaemonServer) Shutdown ¶
func (s *DaemonServer) Shutdown(_ context.Context, params *rpcproto.ShutdownParams) (*proto.Empty, error)
func (*DaemonServer) StreamEvents ¶
func (s *DaemonServer) StreamEvents(_ *proto.Empty, stream rpcproto.Daemon_StreamEventsServer) error
type EndpointDiscoveryServer ¶
type EndpointDiscoveryServer struct { rpcproto.UnimplementedEndpointDiscoverySocketServer *Server }
func NewEndpointDiscoveryServer ¶
func NewEndpointDiscoveryServer(s *Server) *EndpointDiscoveryServer
func (*EndpointDiscoveryServer) RestartPeer ¶
func (s *EndpointDiscoveryServer) RestartPeer(_ context.Context, params *rpcproto.RestartPeerParams) (*proto.Empty, error)
type EventHandler ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) OnInterfaceAdded ¶
func (*Server) OnInterfaceModified ¶
func (*Server) OnInterfaceRemoved ¶
func (*Server) OnPeerAdded ¶
func (*Server) OnPeerModified ¶
func (*Server) OnPeerRemoved ¶
func (*Server) OnSignalingBackendReady ¶
func (*Server) OnSignalingMessage ¶
func (s *Server) OnSignalingMessage(_ *crypto.PublicKeyPair, _ *signaling.Message)
type SignalingServer ¶
type SignalingServer struct { rpcproto.UnimplementedSignalingServer *Server *grpc.Backend }
func NewSignalingServer ¶
func NewSignalingServer(s *Server, b *signaling.MultiBackend) *SignalingServer
func (*SignalingServer) GetSignalingMessage ¶
func (s *SignalingServer) GetSignalingMessage(_ context.Context, _ *rpcproto.GetSignalingMessageParams) (*rpcproto.GetSignalingMessageResp, error)
func (*SignalingServer) PutSignalingMessage ¶
func (s *SignalingServer) PutSignalingMessage(_ context.Context, _ *rpcproto.PutSignalingMessageParams) (*proto.Empty, error)
Click to show internal directories.
Click to hide internal directories.