p2p

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInstance

func NewInstance(netAddr net.Addr, weight int) discovery.Instance

func NewNetAddr

func NewNetAddr(network, address string) net.Addr

func NewP2PResolver

func NewP2PResolver(network, target string) discovery.Resolver

Types

type Instance

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

func (*Instance) Address

func (i *Instance) Address() net.Addr

func (*Instance) Tag

func (i *Instance) Tag(key string) (value string, exist bool)

func (*Instance) Weight

func (i *Instance) Weight() int

type NetAddr

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

func (*NetAddr) Network

func (na *NetAddr) Network() string

func (*NetAddr) String

func (na *NetAddr) String() string

type P2PResolver

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

func (*P2PResolver) Diff

func (p *P2PResolver) Diff(cacheKey string, prev discovery.Result, next discovery.Result) (discovery.Change, bool)

Diff computes the difference between two results. When `next` is cacheable, the Change should be cacheable, too. And the `Result` field's CacheKey in the return value should be set with the given cacheKey.

func (*P2PResolver) Name

func (p *P2PResolver) Name() string

Name returns the name of the resolver.

func (*P2PResolver) Resolve

func (p *P2PResolver) Resolve(ctx context.Context, desc string) (discovery.Result, error)

func (*P2PResolver) Target

func (p *P2PResolver) Target(ctx context.Context, target rpcinfo.EndpointInfo) (description string)

Target should return a description for the given target that is suitable for being a key for cache.

Jump to

Keyboard shortcuts

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