dial

package
v1.3.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FakeTracker fakeTracker

Functions

func New

func New(opts ...Option) message.Dialer

New creates a new message.Dialer. New will panic if the connector, discoverer, or tracker is unspecified.

Types

type ConnectionRequest

type ConnectionRequest struct {
	Service  *api.ServiceAddress
	PeerID   peer.ID
	PeerAddr multiaddr.Multiaddr
}

type Connector

type Connector interface {
	Connect(context.Context, *ConnectionRequest) (message.Stream, error)
}

type DiscoveredLocal

type DiscoveredLocal func(context.Context) (message.Stream, error)

type DiscoveredPeers

type DiscoveredPeers <-chan peer.AddrInfo

type Discoverer

type Discoverer interface {
	Discover(context.Context, *DiscoveryRequest) (DiscoveryResponse, error)
}

type DiscoveryRequest

type DiscoveryRequest struct {
	Network string
	Service *api.ServiceAddress
	Limit   int
	Timeout time.Duration
}

type DiscoveryResponse

type DiscoveryResponse interface {
	// contains filtered or unexported methods
}

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithConnector

func WithConnector(v Connector) Option

func WithDiscoverer

func WithDiscoverer(v Discoverer) Option

func WithTracker

func WithTracker(v Tracker) Option

type PersistentTracker

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

func (*PersistentTracker) All

func (t *PersistentTracker) All(addr multiaddr.Multiaddr, status api.KnownPeerStatus) []peer.ID

func (*PersistentTracker) Connect

func (*PersistentTracker) DB

func (t *PersistentTracker) DB() *peerdb.DB

func (*PersistentTracker) Discover

func (*PersistentTracker) Mark

func (t *PersistentTracker) Mark(peer peer.ID, addr multiaddr.Multiaddr, status api.KnownPeerStatus)

func (*PersistentTracker) Next

func (t *PersistentTracker) Next(addr multiaddr.Multiaddr, status api.KnownPeerStatus) (peer.ID, bool)

func (*PersistentTracker) ScanPeers

func (t *PersistentTracker) ScanPeers(duration time.Duration)

func (*PersistentTracker) Status

func (t *PersistentTracker) Status(peer peer.ID, addr multiaddr.Multiaddr) api.KnownPeerStatus

func (*PersistentTracker) Stop

func (t *PersistentTracker) Stop()

type PersistentTrackerOptions

type PersistentTrackerOptions struct {
	Network          string
	Filename         string
	Host             Connector
	Peers            Discoverer
	PersistFrequency time.Duration
	ScanFrequency    time.Duration
}

type SimpleTracker

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

func (*SimpleTracker) All

func (t *SimpleTracker) All(service multiaddr.Multiaddr, status api.KnownPeerStatus) []peer.ID

func (*SimpleTracker) Mark

func (t *SimpleTracker) Mark(peer peer.ID, service multiaddr.Multiaddr, status api.KnownPeerStatus)

func (*SimpleTracker) Next

func (t *SimpleTracker) Next(service multiaddr.Multiaddr, status api.KnownPeerStatus) (peer.ID, bool)

func (*SimpleTracker) Status

func (t *SimpleTracker) Status(peer peer.ID, service multiaddr.Multiaddr) api.KnownPeerStatus

type Tracker

type Tracker interface {
	Mark(peer peer.ID, service multiaddr.Multiaddr, status api.KnownPeerStatus)
	Status(peer peer.ID, service multiaddr.Multiaddr) api.KnownPeerStatus
	Next(service multiaddr.Multiaddr, status api.KnownPeerStatus) (peer.ID, bool)
	All(service multiaddr.Multiaddr, status api.KnownPeerStatus) []peer.ID
}

Jump to

Keyboard shortcuts

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