Documentation
¶
Index ¶
- type Client
- func (c *Client) Bootstrap(ctx context.Context) error
- func (c *Client) FindPeer(ctx context.Context, id peer.ID) (peer.PeerInfo, error)
- func (c *Client) FindProvidersAsync(ctx context.Context, k u.Key, max int) <-chan peer.PeerInfo
- func (c *Client) GetValue(ctx context.Context, k u.Key) ([]byte, error)
- func (c *Client) Ping(ctx context.Context, id peer.ID) (time.Duration, error)
- func (c *Client) Provide(ctx context.Context, k u.Key) error
- func (c *Client) PutValue(ctx context.Context, k u.Key, v []byte) error
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(px proxy.Proxy, h host.Host, ps peer.Peerstore, local peer.ID) (*Client, error)
TODO take in datastore/cache
func (*Client) FindPeer ¶
func (c *Client) FindPeer(ctx context.Context, id peer.ID) (peer.PeerInfo, error)
func (*Client) FindProvidersAsync ¶
func (c *Client) FindProvidersAsync(ctx context.Context, k u.Key, max int) <-chan peer.PeerInfo
type Server ¶
type Server struct {
*proxy.Loopback // so server can be injected into client
// contains filtered or unexported fields
}
Server handles routing queries using a database backend
func NewServer ¶
func NewServer(ds datastore.ThreadSafeDatastore, ps peer.Peerstore, local peer.ID) (*Server, error)
NewServer creates a new Supernode routing Server
func (*Server) HandleRequest ¶
func (s *Server) HandleRequest(ctx context.Context, p peer.ID, req *dhtpb.Message) *dhtpb.Message
HandleLocalRequest implements the proxy.RequestHandler interface. This is where requests are received from the outside world.
Click to show internal directories.
Click to hide internal directories.