mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 11:57:44 +08:00
go-ipfs-config: feat: add a transports section for enabling/disabling/prioritizing transports
This commit is contained in:
parent
dfe53cd5b6
commit
4f3aeb7428
@ -1,19 +1,74 @@
|
||||
package config
|
||||
|
||||
type SwarmConfig struct {
|
||||
AddrFilters []string
|
||||
DisableBandwidthMetrics bool
|
||||
DisableNatPortMap bool
|
||||
DisableRelay bool
|
||||
EnableRelayHop bool
|
||||
// AddrFilters specifies a set libp2p addresses that we should never
|
||||
// dial or receive connections from.
|
||||
AddrFilters []string
|
||||
|
||||
// autorelay functionality
|
||||
// if true, then the libp2p host will be constructed with autorelay functionality.
|
||||
// DisableBandwidthMetrics disables recording of bandwidth metrics for a
|
||||
// slight reduction in memory usage. You probably don't need to set this
|
||||
// flag.
|
||||
DisableBandwidthMetrics bool
|
||||
|
||||
// DisableNatPortMap turns off NAT port mapping (UPnP, etc.).
|
||||
DisableNatPortMap bool
|
||||
|
||||
// DisableRelay explicitly disables the relay transport.
|
||||
//
|
||||
// Deprecated: This flag is deprecated and is overridden by
|
||||
// `Transports.Relay` if specified.
|
||||
DisableRelay bool `json:",omitempty"`
|
||||
|
||||
// EnableRelayHop makes this node act as a public relay, relaying
|
||||
// traffic between other nodes.
|
||||
EnableRelayHop bool
|
||||
|
||||
// EnableAutoRelay enables the "auto relay" feature.
|
||||
//
|
||||
// When both EnableAutoRelay and RelayHop are set, this go-ipfs node
|
||||
// will advertise itself as a public relay, instead of finding and using
|
||||
// advertised public relays.
|
||||
EnableAutoRelay bool
|
||||
|
||||
// Transports contains flags to enable/disable libp2p transports.
|
||||
Transports Transports
|
||||
|
||||
// ConnMgr configures the connection manager.
|
||||
ConnMgr ConnMgr
|
||||
}
|
||||
|
||||
type Transports struct {
|
||||
// Network specifies the base transports we'll use for dialing. To
|
||||
// listen on a transport, add the transport to your Addresses.Swarm.
|
||||
Network struct {
|
||||
// All default to on.
|
||||
QUIC Flag `json:",omitempty"`
|
||||
TCP Flag `json:",omitempty"`
|
||||
Websocket Flag `json:",omitempty"`
|
||||
Relay Flag `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Security specifies the transports used to encrypt insecure network
|
||||
// transports.
|
||||
Security struct {
|
||||
// Defaults to 100.
|
||||
TLS Priority `json:",omitempty"`
|
||||
// Defaults to 200.
|
||||
SECIO Priority `json:",omitempty"`
|
||||
// Defaults to 300.
|
||||
Noise Priority `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Multiplexers specifies the transports used to multiplex multiple
|
||||
// connections over a single duplex connection.
|
||||
Multiplex struct {
|
||||
// Defaults to 100.
|
||||
Yamux Priority `json:",omitempty"`
|
||||
// Defaults to 200.
|
||||
Mplex Priority `json:",omitempty"`
|
||||
}
|
||||
}
|
||||
|
||||
// ConnMgr defines configuration options for the libp2p connection manager
|
||||
type ConnMgr struct {
|
||||
Type string
|
||||
|
||||
Loading…
Reference in New Issue
Block a user