resolver

package
v0.15.6 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrNoPeersToAsk = errors.Error("no peers to ask")
)

Variables

This section is empty.

Functions

func WithBoostrapPeers

func WithBoostrapPeers(ps ...*peer.ConnectionInfo) func(*resolver)

WithBoostrapPeers overrides the default bootstrap peers for the resolver.

Types

type LookupFilter

type LookupFilter func(*hyperspace.Announcement) bool

LookupOptions

type LookupOption

type LookupOption func(*LookupOptions)

LookupOptions

func LookupByContentHash

func LookupByContentHash(hash object.Hash) LookupOption

LookupByContentHash matches content hashes

func LookupByPeerKey added in v0.14.1

func LookupByPeerKey(keys ...crypto.PublicKey) LookupOption

LookupByPeerKey matches the peer key

func LookupOnlyLocal

func LookupOnlyLocal() LookupOption

LookupOnlyLocal forces the discoverer to only look at its cache

type LookupOptions

type LookupOptions struct {
	Local bool
	// Lookups are strings we are looking for, will be used to create a
	// bloom filter when forwarding the lookup request to providers
	Lookups []string
	// filters are the lookups equivalents for matching local peers
	Filters []LookupFilter
}

LookupOptions

func ParseLookupOptions

func ParseLookupOptions(opts ...LookupOption) *LookupOptions

func (LookupOptions) Match

type Option

type Option func(*resolver)

Option for customizing a new resolver

type Resolver

type Resolver interface {
	Lookup(
		ctx context.Context,
		opts ...LookupOption,
	) ([]*peer.ConnectionInfo, error)
	LookupPeer(
		ctx context.Context,
		publicKey crypto.PublicKey,
	) (*peer.ConnectionInfo, error)
}

func New

func New(
	ctx context.Context,
	netw network.Network,
	opts ...Option,
) Resolver

New returns a new resolver

Jump to

Keyboard shortcuts

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