Documentation ¶
Index ¶
- Constants
- func Discover(ctx context.Context, host host.Host, dht *dht.IpfsDHT, protocol protocol.ID)
- func Get(url string, headers map[string]string) ([]byte, error)
- func GetBootNodesMultiAddress(bootstrapNodes []string) ([]multiaddr.Multiaddr, error)
- func GetMultiAddressesForHost(host host.Host) ([]multiaddr.Multiaddr, error)
- func GetMultiAddressesForHostQuiet(host host.Host) []multiaddr.Multiaddr
- func GetPriorityAddress(addrs []multiaddr.Multiaddr) multiaddr.Multiaddr
- func Patch(url string, rawJSON json.RawMessage, headers map[string]string) ([]byte, error)
- func Post(url string, rawJSON json.RawMessage, headers map[string]string) ([]byte, error)
- func Put(url string, rawJSON json.RawMessage, headers map[string]string) ([]byte, error)
- func WithDHT(ctx context.Context, host host.Host, bootstrapNodes []multiaddr.Multiaddr, ...) (*dht.IpfsDHT, error)
- func WithMDNS(host host.Host, rendezvous string, peerChan chan PeerEvent) error
- type PeerEvent
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" PATCH = "PATCH" )
View Source
const ( PeerAdded = "PeerAdded" PeerRemoved = "PeerRemoved" )
View Source
const PeerFound = "PeerFound"
Variables ¶
This section is empty.
Functions ¶
func Discover ¶
Discover searches for and connects to peers that support the given protocol ID. It initializes discovery via the DHT and advertises this node. It runs discovery in a loop with a ticker, re-advertising and finding new peers. For each discovered peer, it checks if already connected, and if not, dials them.
func GetBootNodesMultiAddress ¶
GetBootNodesMultiAddress returns the multiaddresses for the bootstrap nodes
func GetMultiAddressesForHost ¶
GetMultiAddressesForHost returns the multiaddresses for the host
func GetMultiAddressesForHostQuiet ¶
GetMultiAddressesForHostQuiet returns the multiaddresses for the host without logging
func GetPriorityAddress ¶
func GetPriorityAddress(addrs []multiaddr.Multiaddr) multiaddr.Multiaddr
GetPriorityAddress returns the best public or private IP address
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.