dht

package
v0.0.0-...-cb1d36a Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {

	// OnAnnoucePeer is called for each peer that announces itself
	OnAnnouncePeer func(models.Peer)
	// OnBadPeer is called for each bad peer
	OnBadPeer func(models.Peer)
	// contains filtered or unexported fields
}

Node joins the DHT network

func NewNode

func NewNode(opts ...Option) (*Node, error)

NewNode creates a new DHT node

func (*Node) Close

func (n *Node) Close() error

Close stuff

func (*Node) Run

func (n *Node) Run()

Run starts the node on the DHT

type Option

type Option func(*Node) error

func SetAddress

func SetAddress(ip string) Option

SetAddress sets the IP address to listen on

func SetBlacklist

func SetBlacklist(bl *lru.ARCCache) Option

SetBlacklist sets the size of the node blacklist

func SetIPv6

func SetIPv6(b bool) Option

SetIPv6 enables IPv6

func SetLogger

func SetLogger(l logger.Logger) Option

SetLogger sets the logger

func SetOnAnnouncePeer

func SetOnAnnouncePeer(f func(models.Peer)) Option

func SetOnBadPeer

func SetOnBadPeer(f func(models.Peer)) Option

func SetPort

func SetPort(p int) Option

SetPort sets the port to listen on

func SetUDPTimeout

func SetUDPTimeout(s int) Option

SetUDPTimeout sets the number of seconds to wait for UDP connections

Jump to

Keyboard shortcuts

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