p2p

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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