rendezvous

package module
v0.0.0-...-a67d1cc Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 19 Imported by: 1

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 DefaultAddrFactory = func(addrs []ma.Multiaddr) []ma.Multiaddr { return addrs }
View Source
var (
	DiscoverAsyncInterval = 2 * time.Minute
)

Functions

func NewDiscoverMessage

func NewDiscoverMessage(ns string, limit int, cookie []byte) *pb.Message

func NewRegisterMessage

func NewRegisterMessage(privKey crypto.PrivKey, ns string, pi peer.AddrInfo, ttl int) (*pb.Message, error)

func NewRendezvousDiscovery

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

Types

type AddrsFactory

type AddrsFactory func(addrs []ma.Multiaddr) []ma.Multiaddr

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, 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

type RendezvousService struct {
	DB db.DB
}

func NewRendezvousService

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

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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