Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddrsFactory ¶
type AddrsFactory = bhost.AddrsFactory
AddrsFactory is a function that takes a set of multiaddrs we're listening on and returns the set of multiaddrs we should advertise to the network.
type AutoNATConfig ¶ added in v0.8.0
type AutoNATConfig struct { ForceReachability *network.Reachability EnableService bool ThrottleGlobalLimit int ThrottlePeerLimit int ThrottleInterval time.Duration }
autoNATConfig defines the AutoNAT behavior for the libp2p host.
type Config ¶
type Config struct { // UserAgent is the identifier this node will send to other peers when // identifying itself, e.g. via the identify protocol. // // Set it via the UserAgent option function. UserAgent string PeerKey crypto.PrivKey Transports []TptC Muxers []MsMuxC SecurityTransports []MsSecC Insecure bool PSK pnet.PSK RelayCustom bool Relay bool RelayOpts []circuit.RelayOpt ListenAddrs []ma.Multiaddr AddrsFactory bhost.AddrsFactory Filters *filter.Filters ConnManager connmgr.ConnManager NATManager NATManagerC Peerstore peerstore.Peerstore Reporter metrics.Reporter DisablePing bool Routing RoutingC EnableAutoRelay bool AutoNATConfig StaticRelays []peer.AddrInfo }
Config describes a set of settings for a libp2p node
This is *not* a stable interface. Use the options defined in the root package.
type MuxC ¶
type MuxC func(h host.Host) (mux.Multiplexer, error)
MuxC is a stream multiplex transport constructor.
func MuxerConstructor ¶
MuxerConstructor creates a multiplex constructor from the passed parameter using reflection.
type NATManagerC ¶
type NATManagerC func(network.Network) bhost.NATManager
NATManagerC is a NATManager constructor.
type Option ¶
Option is a libp2p config option that can be given to the libp2p constructor (`libp2p.New`).
type SecC ¶
type SecC func(h host.Host) (sec.SecureTransport, error)
SecC is a security transport constructor.
func SecurityConstructor ¶
SecurityConstructor creates a security constructor from the passed parameter using reflection.
type TptC ¶
TptC is the type for libp2p transport constructors. You probably won't ever implement this function interface directly. Instead, pass your transport constructor to TransportConstructor.
func TransportConstructor ¶
TransportConstructor uses reflection to turn a function that constructs a transport into a TptC.
You can pass either a constructed transport (something that implements `transport.Transport`) or a function that takes any of:
* The local peer ID. * A transport connection upgrader. * A private key. * A public key. * A Host. * A Network. * A Peerstore. * An address filter. * A security transport. * A stream multiplexer transport. * A private network protection key.
And returns a type implementing transport.Transport and, optionally, an error (as the second argument).