Commit b90873d8 authored by Hector Sanjuan's avatar Hector Sanjuan
Browse files

Small improvements on basichost godoc comments.



License: MIT
Signed-off-by: default avatarHector Sanjuan <hector@protocol.ai>
parent a1240fdd
// Package basichost provides a basic libp2p Host implementation.
package basichost
import (
......@@ -21,6 +22,8 @@ import (
var log = logging.Logger("basichost")
// NegotiateTimeout sets a deadline to perform stream handling
// negotiation (exchange of protocol IDs)
var NegotiateTimeout = time.Second * 60
// Option is a type used to pass in options to the host.
......@@ -53,7 +56,9 @@ type BasicHost struct {
bwc metrics.Reporter
}
// New constructs and sets up a new *BasicHost with given Network
// New constructs and sets up a new *BasicHost with given Network. It can take
// additional options. Currently NATPortMap (see "Constants"
// documentation) and a custom metrics.Reporter are supported.
func New(net inet.Network, opts ...interface{}) *BasicHost {
h := &BasicHost{
network: net,
......@@ -167,12 +172,12 @@ func (h *BasicHost) Network() inet.Network {
return h.network
}
// Mux returns the Mux multiplexing incoming streams to protocol handlers
// Mux returns the Mux multiplexing incoming streams to protocol handlers.
func (h *BasicHost) Mux() *msmux.MultistreamMuxer {
return h.mux
}
// IDService returns
// IDService returns the IDService for this host.
func (h *BasicHost) IDService() *identify.IDService {
return h.ids
}
......@@ -201,7 +206,7 @@ func (h *BasicHost) SetStreamHandlerMatch(pid protocol.ID, m func(string) bool,
})
}
// RemoveStreamHandler returns ..
// RemoveStreamHandler removes the handler matching the given protocol ID.
func (h *BasicHost) RemoveStreamHandler(pid protocol.ID) {
h.Mux().RemoveHandler(string(pid))
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment