Documentation

Index

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 (
	DiscoverAsyncInterval = 2 * time.Minute
)

Functions

func NewRendezvousDiscovery

func NewRendezvousDiscovery(host host.Host, rendezvousPeer peer.ID) discovery.Discovery

Types

type Registration

type Registration struct {
	Peer peer.AddrInfo
	Ns   string
	Ttl  int
}

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) RendezvousPoint

type RendezvousService

type RendezvousService struct {
	DB db.DB
	// contains filtered or unexported fields
}

func NewRendezvousService

func NewRendezvousService(host host.Host, db db.DB, rzs ...RendezvousSync) *RendezvousService

type RendezvousSync

type RendezvousSync interface {
	Register(p peer.ID, ns string, addrs [][]byte, ttl int, counter uint64)
	Unregister(p peer.ID, ns string)
}

Directories

Path Synopsis
db