From b90873d8dc293860d737ce3799f6e39abb5aec33 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 15 Mar 2017 17:08:00 +0100 Subject: [PATCH] Small improvements on basichost godoc comments. License: MIT Signed-off-by: Hector Sanjuan --- p2p/host/basic/basic_host.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 86c276c..f1270c5 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -1,3 +1,4 @@ +// 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)) } -- GitLab