Documentation ¶
Index ¶
- Constants
- type Message
- type MessageType
- type Network
- func (n *Network) Broadcast(ctx context.Context, data []byte) error
- func (n *Network) ConnectToPeer(ctx context.Context, peerInfo peer.AddrInfo) error
- func (n *Network) GetHost() host.Host
- func (n *Network) GetPeers() []peer.ID
- func (n *Network) GetSubscription() *pubsub.Subscription
- func (n *Network) HandlePeerFound(pi peer.AddrInfo)
- func (n *Network) SendToPeer(ctx context.Context, peerID peer.ID, data []byte) error
- func (n *Network) Start(ctx context.Context) error
- func (n *Network) Stop() error
Constants ¶
View Source
const ( ProtocolID = "/3ds/1.0.0" DiscoveryNamespace = "3ds-network" PubsubTopic = "3ds-messages" ConnectionTimeout = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageType ¶
type MessageType int
Message types for network communication
const ( MessageTypeModelAnnouncement MessageType = iota MessageTypeChunkRequest MessageTypeChunkResponse MessageTypeStorageProof MessageTypeNodeStatus )
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
func (*Network) ConnectToPeer ¶
ConnectToPeer exports the peer connection functionality
func (*Network) GetSubscription ¶
func (n *Network) GetSubscription() *pubsub.Subscription
GetSubscription returns the pubsub subscription for testing
func (*Network) HandlePeerFound ¶
HandlePeerFound implements the mdns.Notifee interface
func (*Network) SendToPeer ¶
Click to show internal directories.
Click to hide internal directories.