docs: Document defaults #382

This commit is contained in:
gpestana 2018-08-05 20:28:00 +03:00
parent 77b7d8f06f
commit 197b42caea
1 changed files with 21 additions and 2 deletions

View File

@ -27,8 +27,27 @@ func ChainOptions(opts ...Option) Option {
} }
} }
// New constructs a new libp2p node with the given options (falling back on // New constructs a new libp2p node with the given options, falling back on
// reasonable defaults). // reasonable defaults. The defaults are:
//
// - If no transport and listen addresses are provided, the node listens to
// the multiaddresses "/ip4/0.0.0.0/tcp/0" and "/ip6/::/tcp/0";
//
// - If no transport options are provided, the node uses TPC and websocket
// transport protocols;
//
// - If no multiplexer configuration is provided, the node is configured by
// default to use the "yamux/1.0.0" and "mplux/6.7.0" stream connection
// multiplexers;
//
// - If no security transport is provided, the host uses the go-libp2p's secio
// encrypted transport to encrypt all traffic;
//
// - If no peer identity is provided, it generates a random RSA 2048 key-par
// and derives a new identity from it;
//
// - If no peerstore is provided, the host is initialized with an empty
// peerstore.
// //
// Canceling the passed context will stop the returned libp2p node. // Canceling the passed context will stop the returned libp2p node.
func New(ctx context.Context, opts ...Option) (host.Host, error) { func New(ctx context.Context, opts ...Option) (host.Host, error) {