boot

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0, MIT Imports: 15 Imported by: 1

Documentation

Overview

Package boot provides utilities for parsing and instantiating boot services

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownBootProto = errors.New("unknown boot protocol")

ErrUnknownBootProto is returned when the multiaddr passed to Parse does not contain a recognized boot protocol.

Functions

func Dial

func Dial(h host.Host, maddr ma.Multiaddr, opt ...socket.Option) (discovery.Discoverer, error)

func DialCIDR

func DialCIDR(h host.Host, maddr ma.Multiaddr, opt ...socket.Option) (*crawl.Crawler, error)

func DialMulticast

func DialMulticast(h host.Host, maddr ma.Multiaddr, opt ...socket.Option) (*survey.Surveyor, error)

func DialPortRange

func DialPortRange(h host.Host, maddr ma.Multiaddr, opt ...socket.Option) (*crawl.Crawler, error)

func DialString

func DialString(h host.Host, s string, opt ...socket.Option) (discovery.Discoverer, error)

func IsCIDR

func IsCIDR(maddr ma.Multiaddr) bool

func IsMulticast

func IsMulticast(maddr ma.Multiaddr) bool

func IsP2P

func IsP2P(maddr ma.Multiaddr) bool

func IsPortRange

func IsPortRange(maddr ma.Multiaddr) bool

IsPortRange returns true if maddr is a UDP address with no subprotocols. This function MAY be extended to support port ranges ranges in the near future.

func IsSurvey

func IsSurvey(maddr ma.Multiaddr) bool

func Listen

func Listen(h host.Host, maddr ma.Multiaddr, opt ...socket.Option) (discovery.Discovery, error)

func ListenCIDR

func ListenCIDR(h host.Host, maddr ma.Multiaddr, opt ...socket.Option) (*crawl.Crawler, error)

func ListenString

func ListenString(h host.Host, s string, opt ...socket.Option) (discovery.Discovery, error)

Types

type Namespace

type Namespace struct {
	Match   func(string) bool
	Target  discovery.Discovery
	Default discovery.Discovery
}

func (Namespace) Advertise

func (n Namespace) Advertise(ctx context.Context, ns string, opt ...discovery.Option) (time.Duration, error)

func (Namespace) FindPeers

func (n Namespace) FindPeers(ctx context.Context, ns string, opt ...discovery.Option) (<-chan peer.AddrInfo, error)

type StaticAddrs

type StaticAddrs []peer.AddrInfo

StaticAddrs is a set of bootstrap-peer addresses.

func NewStaticAddrStrings

func NewStaticAddrStrings(ss ...string) (as StaticAddrs, _ error)

func NewStaticAddrs

func NewStaticAddrs(as ...ma.Multiaddr) (StaticAddrs, error)

NewStaticAddrs from one or more multiaddrs.

func (StaticAddrs) Advertise

func (as StaticAddrs) Advertise(_ context.Context, _ string, opt ...discovery.Option) (time.Duration, error)

Advertise is a nop that defaults to PermanentAddrTTL.

func (StaticAddrs) Close

func (StaticAddrs) Close() error

Close is a nop method. It exists to satisfy boot.DiscoveryCloser.

func (StaticAddrs) Filter

func (as StaticAddrs) Filter(f func(peer.AddrInfo) bool) StaticAddrs

func (StaticAddrs) FindPeers

func (as StaticAddrs) FindPeers(_ context.Context, _ string, opt ...discovery.Option) (<-chan peer.AddrInfo, error)

FindPeers converts the static addresses into AddrInfos

func (StaticAddrs) Len

func (as StaticAddrs) Len() int

func (StaticAddrs) Less

func (as StaticAddrs) Less(i, j int) bool

func (StaticAddrs) Swap

func (as StaticAddrs) Swap(i, j int)

Directories

Path Synopsis
Package socket implements signed sockets for bootstrap services.
Package socket implements signed sockets for bootstrap services.

Jump to

Keyboard shortcuts

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