Documentation
¶
Index ¶
- func HostToString(h host.Host) string
- func NewDefaultP2PHost() (*host.Host, error)
- type DHTValidator
- type Instance
- func (i *Instance) Build() (*Instance, error)
- func (i *Instance) ConnectFromMultiaddr(ctx context.Context, str string)
- func (i *Instance) JoinTopic(topic string) error
- func (i *Instance) Publish(topic string, message []byte) error
- func (i *Instance) SetP2PHost(existingHost *host.Host) *Instance
- func (i *Instance) Start() error
- func (i *Instance) Stop() error
- func (i *Instance) Subscribe(topic string) (<-chan *pubsub.Message, error)
- type PeerDiscovery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostToString ¶
func NewDefaultP2PHost ¶
NewDefaultP2PHost initialise a new libp2p host
Types ¶
type DHTValidator ¶
type DHTValidator struct{}
DHTValidator is used to validate the record in the DHT
func NewDHTValidator ¶
func NewDHTValidator() *DHTValidator
NewDHTValidator initialise a new DHT validator
type Instance ¶
type Instance struct { Host *host.Host // Host for libp2p. DHT *dht.IpfsDHT // Kademlia DHT for resource locating. Discovery *PeerDiscovery // mDNS peer discovery instance. PubSub *pubsub.PubSub // Gossip pub-sub service. // contains filtered or unexported fields }
Instance is the libp2p instance for networking usage.
func NewInstance ¶
NewInstance initialises a blank libp2p instance.
func (*Instance) ConnectFromMultiaddr ¶
func (*Instance) SetP2PHost ¶
SetP2PHost uses an existing libp2p host to initialise the instance.
type PeerDiscovery ¶
PeerDiscovery is the mDNS peer discovery notify instance
func NewPeerDiscovery ¶
func NewPeerDiscovery() *PeerDiscovery
NewPeerDiscovery initialise a new peer discovery instance
func (*PeerDiscovery) HandlePeerFound ¶
func (d *PeerDiscovery) HandlePeerFound(p peer.AddrInfo)
HandlePeerFound will be called when a new peer is discovered
Click to show internal directories.
Click to hide internal directories.