Documentation
¶
Overview ¶
Package dht wraps libp2p Kademlia DHT to provide DID-based Provide/Find for LinkSelf. DHT key design: namespace "/linkself/did/" + base32(sha256(did)). Value: serialized peer.AddrInfo (JSON or binary).
Index ¶
- Constants
- func DIDKey(didStr string) string
- func FindDID(ctx context.Context, r routing.ValueStore, didStr string) (peer.AddrInfo, error)
- func LinkselfValidator() record.Validator
- func LinkselfValidatorNamespace() record.Validator
- func PutDID(ctx context.Context, r routing.ValueStore, didStr string, info peer.AddrInfo) error
Constants ¶
View Source
const ( // Namespace for LinkSelf DID records in the DHT. Namespace = "linkself" // KeyPrefix is the full key prefix for DID records: /linkself/did/ KeyPrefix = "/" + Namespace + "/did/" )
Variables ¶
This section is empty.
Functions ¶
func LinkselfValidator ¶
LinkselfValidator returns a record.Validator that includes only the linkself namespace. Use with dht.Option: dht.Validator(LinkselfValidator()) for a DHT that only stores linkself records.
func LinkselfValidatorNamespace ¶
LinkselfValidatorNamespace returns the validator for the "linkself" namespace only. Use with dht.NamespacedValidator("linkself", LinkselfValidatorNamespace()) to add to default validators.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.