centraldisco

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

README

Central Discovery

A client/server solution to peer discovery.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(client *Client, period time.Duration) discovery.Service

func RegisterServer

func RegisterServer(gs *grpc.Server, s *Server)

func RunServer

func RunServer(l net.Listener, s *Server) error

Types

type Client

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

func NewClient

func NewClient(gc grpc.ClientConnInterface) *Client

NewClient returns a client connected using gc, and privatKey for signing announcements

func (*Client) Announce

func (c *Client) Announce(ctx context.Context, privKey inet256.PrivateKey, endpoints []string, ttl time.Duration) error

func (*Client) Find

func (c *Client) Find(ctx context.Context, target inet256.Addr) ([]string, error)

type Server

type Server struct {
	internal.UnimplementedDiscoveryServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(parser discovery.AddrParser) *Server

func (*Server) Announce

func (s *Server) Announce(ctx context.Context, req *internal.AnnounceReq) (*internal.AnnounceRes, error)

func (*Server) Find

func (s *Server) Find(ctx context.Context, req *internal.FindReq) (*internal.FindRes, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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