Documentation ¶
Index ¶
- Constants
- type MessageOpts
- type P2PMessageService
- func (ms *P2PMessageService) Close() error
- func (ms *P2PMessageService) Id() peer.ID
- func (ms *P2PMessageService) InitComplete() <-chan struct{}
- func (ms *P2PMessageService) Out() <-chan protocols.Message
- func (ms *P2PMessageService) PeerInfoReceived() <-chan basicPeerInfo
- func (ms *P2PMessageService) Send(msg protocols.Message) error
Constants ¶
View Source
const ( DHT_RECORD_PREFIX = "/" + DHT_NAMESPACE + "/" DHT_NAMESPACE = "scaddr" DHT_RECORD_MAX_AGE = 24 * time.Hour DHT_REPUBLISH_INTERVAL = 4 * time.Hour )
View Source
const ( DHT_PROTOCOL_PREFIX protocol.ID = "/nitro" // use /nitro/kad/1.0.0 instead of /ipfs/kad/1.0.0 GENERAL_MSG_PROTOCOL_ID protocol.ID = "/nitro/msg/1.0.0" DELIMITER = '\n' BUFFER_SIZE = 1_000 NUM_CONNECT_ATTEMPTS = 10 RETRY_SLEEP_DURATION = 5 * time.Second BOOTSTRAP_SLEEP_DURATION = 100 * time.Millisecond // how often we check for bootpeers in Peerstore )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageOpts ¶ added in v0.1.2
type P2PMessageService ¶
type P2PMessageService struct { MultiAddr string // contains filtered or unexported fields }
P2PMessageService is a rudimentary message service that uses TCP to send and receive messages.
func NewMessageService ¶
func NewMessageService(opts MessageOpts) *P2PMessageService
NewMessageService returns a running P2PMessageService listening on the given ip, port and message key.
func (*P2PMessageService) Close ¶
func (ms *P2PMessageService) Close() error
Close closes the P2PMessageService
func (*P2PMessageService) Id ¶
func (ms *P2PMessageService) Id() peer.ID
Id returns the libp2p peer ID of the message service.
func (*P2PMessageService) InitComplete ¶
func (ms *P2PMessageService) InitComplete() <-chan struct{}
InitComplete returns a chan that gets closed once the message service is initalized
func (*P2PMessageService) Out ¶
func (ms *P2PMessageService) Out() <-chan protocols.Message
Out returns a channel that can be used to receive messages from the message service
func (*P2PMessageService) PeerInfoReceived ¶
func (ms *P2PMessageService) PeerInfoReceived() <-chan basicPeerInfo
PeerInfoReceived returns a channel that receives a PeerInfo when a peer is discovered
Click to show internal directories.
Click to hide internal directories.