server

package
v0.0.0-...-532c8ef Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRPC

func NewRPC(device string) (*rpc.Server, error)

NewRPC initializes the RPC server with wg client

Types

type PeerMap

type PeerMap struct {
	Peers map[wgtypes.Key]wgtypes.Peer
}

PeerMap is a map of keys and peer information

type RPC

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

RPC server implementation

func (*RPC) Find

func (s *RPC) Find(rq []wgtypes.Key, rs *PeerMap) error

Find peers by their public keys. Implements a net.RPC method.

type Server

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

Server implements a RPC server.

func Configure

func Configure(device string, port uint16, addrs ...string) (*Server, error)

Configure the RPC server. If addrs is not specified, it defaults on listening on all available addresses on device.

Device is also used by this package for the WireGuard specific queries. Those queries will fail if device is not a WG interface or does not exist. However, this is not a considered an error for Configure. Use addrs if you want the RPC server to listen on different addresses as the WG device.

func (*Server) Close

func (s *Server) Close() error

Close the server now All errors are send to "log" and only the last error is returned.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe the RPC servers on all configured addresses. Blocks while there are open listeners.

In case of a error other then http.ErrServerClosed on one of the listeners, all remaining listeners are closed immediatly.

All errors are send to "log" and only the last error is returned.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown the server gracefully All errors are send to "log" and only the last error is returned.

Jump to

Keyboard shortcuts

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