Documentation ¶
Index ¶
- func New(opts ...ClientOption) inet256.Service
- type Client
- type ClientOption
- type Endpoint
- type ListenPacketConn
- type Node
- func (n *Node) Close() error
- func (n *Node) FindAddr(ctx context.Context, prefix []byte, nbits int) (inet256.Addr, error)
- func (n *Node) LocalAddr() inet256.Addr
- func (n *Node) LookupPublicKey(ctx context.Context, target inet256.Addr) (inet256.PublicKey, error)
- func (n *Node) MTU(ctx context.Context, dst inet256.Addr) int
- func (n *Node) PublicKey() inet256.PublicKey
- func (n *Node) Receive(ctx context.Context, fn func(inet256.Message)) error
- func (n *Node) Send(ctx context.Context, dst inet256.Addr, data []byte) error
- type Server
- func (s *Server) Addr() string
- func (s *Server) Close() error
- func (s *Server) Dial(ctx context.Context, req *protocol.DialReq) (*protocol.DialRes, error)
- func (s *Server) FindAddr(ctx context.Context, req *protocol.FindAddrReq) (*protocol.FindAddrRes, error)
- func (s *Server) Listen(req *protocol.ListenReq, srv protocol.Control_ListenServer) (retErr error)
- func (s *Server) LookupPublicKey(ctx context.Context, req *protocol.LookupPublicKeyReq) (*protocol.LookupPublicKeyRes, error)
- func (s *Server) PublicKey() inet256.PublicKey
- func (s *Server) Run(ctx context.Context) error
- func (s *Server) Wait() error
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type ClientOption ¶
type ClientOption = func(*Client)
func WithEndpoint ¶
func WithEndpoint(id inet256.ID, addr string) ClientOption
func WithListenPacketConn ¶
func WithListenPacketConn(fn ListenPacketConn) ClientOption
func WithLogger ¶
func WithLogger(log *logrus.Logger) ClientOption
type Endpoint ¶
Endpoint is a INET256 address plus UDP address or domain name.
func ParseEndpoint ¶
ParseEndpoint parses an endpoint in <INET256>@<host>:<port> format.
type ListenPacketConn ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) LookupPublicKey ¶
type Server ¶
type Server struct { protocol.UnimplementedControlServer // contains filtered or unexported fields }
func NewServer ¶
func NewServer(pconn net.PacketConn, privateKey inet256.PrivateKey, opts ...ServerOption) (*Server, error)
func (*Server) FindAddr ¶
func (s *Server) FindAddr(ctx context.Context, req *protocol.FindAddrReq) (*protocol.FindAddrRes, error)
FindAddr implements ControlServer.FindAddr
func (*Server) LookupPublicKey ¶
func (s *Server) LookupPublicKey(ctx context.Context, req *protocol.LookupPublicKeyReq) (*protocol.LookupPublicKeyRes, error)
LookupPublicKey implements ControlServer.LookupPublicKey
type ServerOption ¶ added in v0.0.3
type ServerOption func(c *serverConfig)
func WithFindAddrMinBits ¶ added in v0.0.3
func WithFindAddrMinBits(n int) ServerOption
Click to show internal directories.
Click to hide internal directories.