Documentation ¶
Index ¶
- Constants
- Variables
- func NewDiscoverMessage(ns string, limit int, cookie []byte) *pb.Message
- func NewRegisterMessage(privKey crypto.PrivKey, ns string, pi peer.AddrInfo, ttl int) (*pb.Message, error)
- func NewRendezvousDiscovery(host host.Host, rendezvousPeer peer.ID) discovery.Discovery
- type AddrsFactory
- type Registration
- type RendezvousClient
- type RendezvousError
- type RendezvousPoint
- type RendezvousPointOption
- type RendezvousService
Constants ¶
View Source
const ( RendezvousProto = protocol.ID("/rendezvous/1.0.0") DefaultTTL = 2 * 3600 // 2hr )
View Source
const ( MaxTTL = 72 * 3600 // 72hr MaxNamespaceLength = 256 MaxPeerAddressLength = 2048 MaxRegistrations = 1000 MaxDiscoverLimit = 1000 )
Variables ¶
View Source
var DefaultAddrFactory = func(addrs []ma.Multiaddr) []ma.Multiaddr { return addrs }
View Source
var (
DiscoverAsyncInterval = 2 * time.Minute
)
Functions ¶
func NewRegisterMessage ¶
Types ¶
type RendezvousClient ¶
type RendezvousClient interface { Register(ctx context.Context, ns string, ttl int) (time.Duration, error) Unregister(ctx context.Context, ns string) error Discover(ctx context.Context, ns string, limit int, cookie []byte) ([]peer.AddrInfo, []byte, error) DiscoverAsync(ctx context.Context, ns string) (<-chan peer.AddrInfo, error) }
func NewRendezvousClient ¶
func NewRendezvousClient(host host.Host, rp peer.ID) RendezvousClient
func NewRendezvousClientWithPoint ¶
func NewRendezvousClientWithPoint(rp RendezvousPoint) RendezvousClient
type RendezvousError ¶
type RendezvousError struct { Status pb.Message_ResponseStatus Text string }
func (RendezvousError) Error ¶
func (e RendezvousError) Error() string
type RendezvousPoint ¶
type RendezvousPoint interface { Register(ctx context.Context, ns string, ttl int) (time.Duration, error) Unregister(ctx context.Context, ns string) error Discover(ctx context.Context, ns string, limit int, cookie []byte) ([]Registration, []byte, error) DiscoverAsync(ctx context.Context, ns string) (<-chan Registration, error) }
func NewRendezvousPoint ¶
func NewRendezvousPoint(host host.Host, p peer.ID, opts ...RendezvousPointOption) RendezvousPoint
type RendezvousPointOption ¶
type RendezvousPointOption func(cfg *rendezvousPointConfig)
func ClientWithAddrsFactory ¶
func ClientWithAddrsFactory(factory AddrsFactory) RendezvousPointOption
AddrsFactory configures libp2p to use the given address factory.
type RendezvousService ¶
func NewRendezvousService ¶
func NewRendezvousService(host host.Host, db db.DB) *RendezvousService
Click to show internal directories.
Click to hide internal directories.