client

package
v0.5.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Ping(ctx context.Context, addr netip.AddrPort) (PingResult, error)
	FindNode(ctx context.Context, addr netip.AddrPort, target protocol.ID) (FindNodeResult, error)
	GetPeers(ctx context.Context, addr netip.AddrPort, infoHash protocol.ID) (GetPeersResult, error)
	GetPeersScrape(ctx context.Context, addr netip.AddrPort, infoHash protocol.ID) (GetPeersScrapeResult, error)
	SampleInfoHashes(ctx context.Context, addr netip.AddrPort, target protocol.ID) (SampleInfoHashesResult, error)
}

type FindNodeResult

type FindNodeResult struct {
	ID    protocol.ID
	Nodes []NodeInfo
}

type GetPeersResult

type GetPeersResult struct {
	ID     protocol.ID
	Values []netip.AddrPort
	Nodes  []NodeInfo
}

type GetPeersScrapeResult

type GetPeersScrapeResult struct {
	ID        protocol.ID
	Values    []netip.AddrPort
	Nodes     []NodeInfo
	BfPeers   bloom.BloomFilter
	BfSeeders bloom.BloomFilter
}

type NodeInfo

type NodeInfo struct {
	ID   protocol.ID
	Addr netip.AddrPort
}

type Params

type Params struct {
	fx.In
	NodeID protocol.ID `name:"dht_node_id"`
	Server lazy.Lazy[server.Server]
	Logger *zap.SugaredLogger
}

type PingResult

type PingResult struct {
	ID protocol.ID
}

type Result

type Result struct {
	fx.Out
	Client lazy.Lazy[Client]
}

func New

func New(p Params) Result

type SampleInfoHashesResult

type SampleInfoHashesResult struct {
	ID       protocol.ID
	Samples  []protocol.ID
	Nodes    []NodeInfo
	Num      int
	Interval int
}

Jump to

Keyboard shortcuts

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