Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadRecord = errors.New("bad dht record")
ErrBadRecord is returned any time a dht record is found to be incorrectly formatted or signed.
var ErrInvalidRecordType = errors.New("invalid record keytype")
ErrInvalidRecordType is returned if a DHTRecord keys prefix is not found in the Validator map of the DHT.
Functions ¶
func MakePutRecord ¶
MakePutRecord creates a dht record for the given key/value pair
func PublicKeySelector ¶
PublicKeySelector just selects the first entry. All valid public key records will be equivalent.
func PublicKeyValidator ¶
func PublicKeyValidator(r *ValidationRecord) error
ValidatePublicKeyRecord implements ValidatorFunc and verifies that the passed in record value is the PublicKey that matches the passed in key.
Types ¶
type Selector ¶
type Selector map[string]SelectorFunc
type SelectorFunc ¶
A SelectorFunc selects the best value for the given key from a slice of possible values and returns the index of the chosen one
type ValidationRecord ¶
type Validator ¶
type Validator map[string]ValidatorFunc
Validator is an object that helps ensure routing records are valid. It is a collection of validator functions, each of which implements its own notion of validity.
type ValidatorFunc ¶
type ValidatorFunc func(*ValidationRecord) error
ValidatorFunc is a function that is called to validate a given type of DHTRecord.
