rpc

package
v0.5.65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Package rpc implements a gRPC client and server for management and monitoring of a cunicu daemon

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaemonRunning

func DaemonRunning(path string) bool

Types

type Client

type Client struct {
	io.Closer

	rpcproto.EndpointDiscoverySocketClient
	rpcproto.SignalingClient
	rpcproto.DaemonClient
	// contains filtered or unexported fields
}

func Connect

func Connect(path string) (*Client, error)

func (*Client) AddEventHandler

func (c *Client) AddEventHandler(h EventHandler)

func (*Client) Close

func (c *Client) Close() error

func (*Client) OnEvent

func (c *Client) OnEvent(e *rpcproto.Event)

func (*Client) RemoveEventHandler

func (c *Client) RemoveEventHandler(h EventHandler)

func (*Client) RestartPeer

func (c *Client) RestartPeer(ctx context.Context, intf string, pk *crypto.Key) error

func (*Client) Unwait

func (c *Client) Unwait() error

func (*Client) WaitForEvent

func (c *Client) WaitForEvent(ctx context.Context, t rpcproto.EventType, intf string, peer crypto.Key) (*rpcproto.Event, error)

func (*Client) WaitForPeerHandshake

func (c *Client) WaitForPeerHandshake(ctx context.Context, peer crypto.Key) error

func (*Client) WaitForPeerState

func (c *Client) WaitForPeerState(ctx context.Context, peer crypto.Key, csd daemon.PeerState) error

type DaemonServer

type DaemonServer struct {
	rpcproto.UnimplementedDaemonServer

	*Server
	*daemon.Daemon
}

func NewDaemonServer

func NewDaemonServer(s *Server, d *daemon.Daemon) *DaemonServer

func (*DaemonServer) AddPeer

func (*DaemonServer) GetBuildInfo

func (s *DaemonServer) GetBuildInfo(context.Context, *proto.Empty) (*proto.BuildInfo, error)

func (*DaemonServer) GetCompletion

func (*DaemonServer) GetConfig

func (*DaemonServer) GetStatus

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 (s *DaemonServer) ReloadConfig(_ context.Context, _ *proto.Empty) (*proto.Empty, error)

func (*DaemonServer) SendPeerStates

func (s *DaemonServer) SendPeerStates(stream rpcproto.Daemon_StreamEventsServer)

func (*DaemonServer) SetConfig

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

func (*DaemonServer) Sync

func (s *DaemonServer) Sync(_ context.Context, _ *proto.Empty) (*proto.Empty, error)

func (*DaemonServer) UnWait

func (s *DaemonServer) UnWait(_ context.Context, _ *proto.Empty) (*proto.Empty, error)

type EndpointDiscoveryServer

type EndpointDiscoveryServer struct {
	rpcproto.UnimplementedEndpointDiscoverySocketServer

	*Server
}

func NewEndpointDiscoveryServer

func NewEndpointDiscoveryServer(s *Server) *EndpointDiscoveryServer

func (*EndpointDiscoveryServer) RestartPeer

type Event

type Event struct {
	rpcproto.Event
}

func (*Event) String

func (e *Event) String() string

type EventHandler

type EventHandler interface {
	OnEvent(*rpcproto.Event)
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(d *daemon.Daemon, socket string) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) OnInterfaceAdded

func (s *Server) OnInterfaceAdded(i *daemon.Interface)

func (*Server) OnInterfaceModified

func (s *Server) OnInterfaceModified(i *daemon.Interface, _ *wg.Interface, mod daemon.InterfaceModifier)

func (*Server) OnInterfaceRemoved

func (s *Server) OnInterfaceRemoved(i *daemon.Interface)

func (*Server) OnPeerAdded

func (s *Server) OnPeerAdded(p *daemon.Peer)

func (*Server) OnPeerModified

func (s *Server) OnPeerModified(p *daemon.Peer, _ *wgtypes.Peer, mod daemon.PeerModifier, _, _ []net.IPNet)

func (*Server) OnPeerRemoved

func (s *Server) OnPeerRemoved(p *daemon.Peer)

func (*Server) OnSignalingBackendReady

func (s *Server) OnSignalingBackendReady(b signaling.Backend)

func (*Server) OnSignalingMessage

func (s *Server) OnSignalingMessage(_ *crypto.PublicKeyPair, _ *signaling.Message)

func (*Server) Wait

func (s *Server) Wait()

type SignalingServer

type SignalingServer struct {
	rpcproto.UnimplementedSignalingServer

	*Server
	*grpc.Backend
}

func NewSignalingServer

func NewSignalingServer(s *Server, b *signaling.MultiBackend) *SignalingServer

func (*SignalingServer) PutSignalingMessage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL