dht

package
v0.0.0-...-511a5e0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package dht provides Go bindings for libdht, a library implementing the BitTorrent DHT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Announce

func Announce(id []byte, ipv6 bool, port uint16) error

Announce announces a value in the DHT.

func Available

func Available() bool

Available returns true if the DHT is available in this build.

func Count

func Count() (good4 int, good6 int,
	dubious4 int, dubious6 int,
	incoming4 int, incoming6 int)

Count returns statistics about the status of the DHT.

func DHT

func DHT(ctx context.Context, myid []byte, port uint16) (<-chan Event, error)

DHT starts the DHT.

func GetNodes

func GetNodes() ([]netip.AddrPort, error)

GetNodes returnes the set of known good nodes.

func Ping

func Ping(addr netip.AddrPort) error

Ping sends a ping message to a DHT node.

Types

type Event

type Event interface {
}

Event is the common interface for all events returned by the DHT.

type ValueEvent

type ValueEvent struct {
	Hash []byte
	Addr netip.AddrPort
}

A ValueEvent is returned by the DHT when values become available.

Jump to

Keyboard shortcuts

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