rundht

package
v0.0.0-...-c8d95c1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package rundht implements the interface between storrent and the DHT. The DHT implementation itself is in package dht.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(ctx context.Context, nodes []net.TCPAddr)

Bootstrap bootstraps the DHT.

func Handle

func Handle(dhtevent <-chan dht.Event)

Handle reacts to events sent by the DHT.

func Read

func Read(filename string) (id []byte, nodes []net.TCPAddr, err error)

Read reads the dht.dat file and returns a set of potential nodes.

func Run

func Run(ctx context.Context, id []byte, port int) (<-chan dht.Event, error)

Run starts the DHT.

func Write

func Write(filename string, id []byte) error

Write writes the dht.dat file.

Types

type BDHT

type BDHT struct {
	Id     []byte `bencode:"id,omitempty"`
	Nodes  []byte `bencode:"nodes,omitempty"`
	Nodes6 []byte `bencode:"nodes6,omitempty"`
}

BDHT represents the contents of the dht.dat file.

Jump to

Keyboard shortcuts

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