Commit ad5b7b9b authored by Steven Allen's avatar Steven Allen
Browse files

add options for disabling the default listen address/transports

So, in go-ipfs at least, we *don't* pass the listen addresses into the libp2p
constructor. Instead, we specify them later.

This option allows us to tell libp2p to not listen by default.
parent c67b87ce
......@@ -241,3 +241,21 @@ func NATManager(nm config.NATManagerC) Option {
return nil
}
}
// NoListen will configure libp2p to not listen by default.
//
// This will both clear any configured listen addrs and prevent libp2p from
// applying the default listen address option.
var NoListen = func(cfg *Config) error {
cfg.ListenAddrs = []ma.Multiaddr{}
return nil
}
// NoTransports will configure libp2p to not enable any transports.
//
// This will both clear any configured transports (specified in prior libp2p
// options) and prevent libp2p from applying the default transports.
var NoTransports = func(cfg *Config) error {
cfg.Transports = []config.TptC{}
return nil
}
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