dht

package
v0.0.0-...-2ec1701 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotAvailable = errors.New("Not Available")
View Source
var NotFound = errors.New("Not Found")
View Source
var TimeoutExceeded = errors.New("Timeout Exceeded")

Functions

This section is empty.

Types

type DHT

type DHT struct {
	//Network
	Network net.Conn

	// DHT Configuration Settings
	Config DHTConfig

	//Republish
	Republish *DHTRepublish
}

TODO. SEE https://github.com/jbenet/node-ipfs/blob/master/submodules/ipfs-dht/index.js

func (*DHT) FindNode

func (dht *DHT) FindNode(id *peer.ID) error

Looks for a particular node

func (*DHT) GetSloppyValues

func (dht *DHT) GetSloppyValues(key string, count int) ([]*DHTValue, error)

GetSloppyValues finds (at least) a number of values for given key

func (*DHT) GetValue

func (dht *DHT) GetValue(key string) *DHTValue

Retrieves a value for a given key

func (*DHT) PingNode

func (dht *DHT) PingNode(id *peer.ID, timeout time.Duration) error

func (*DHT) SetSloppyValue

func (dht *DHT) SetSloppyValue(key string, value *DHTValue) error

func (*DHT) SetValue

func (dht *DHT) SetValue(key string, value *DHTValue) error

Stores a value for a given key

type DHTConfig

type DHTConfig struct {
	// Time to wait between republishing intervals
	RepublishInterval time.Duration

	// Multihash hash function
	HashType int
}

type DHTObject

type DHTObject struct {
	Key           string
	Value         *DHTValue
	LastPublished *time.Time
}

func (*DHTObject) ShouldRepublish

func (o *DHTObject) ShouldRepublish(interval time.Duration) bool

type DHTRepublish

type DHTRepublish struct {
	Strict []*DHTObject
	Sloppy []*DHTObject
}

TODO: not call this republish

type DHTValue

type DHTValue struct{}

A struct representing a value in the DHT

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳