Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultModule = "p2pv2" DefaultPort = 47101 // p2p port DefaultAddress = "/ip4/127.0.0.1/tcp/47101" DefaultNetKeyPath = "netkeys" // node private key path DefaultNetIsNat = true // use NAT DefaultNetIsTls = false // use tls secure transport DefaultNetIsHidden = false DefaultMaxStreamLimits = 1024 DefaultMaxMessageSize = 128 DefaultTimeout = 30 DefaultStreamIPLimitSize = 10 DefaultMaxBroadcastPeers = 20 DefaultServiceName = "localhost" DefaultIsBroadCast = true )
default settings
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetConf ¶
type NetConf struct { // Module is the name of p2p module plugin Module string `yaml:"module,omitempty"` // Port the p2p network listened for p2pv1 Port int32 `yaml:"port,omitempty"` // Address multiaddr string, /ip4/127.0.0.1/tcp/8080 Address string `yaml:"address,omitempty"` // keyPath is the node private key path, xuper will gen a random one if is nil KeyPath string `yaml:"keyPath,omitempty"` // isNat config whether the node use NAT manager IsNat bool `yaml:"isNat,omitempty"` // isHidden config whether the node can be found IsHidden bool `yaml:"isHidden,omitempty"` // bootNodes config the bootNodes the node to connect BootNodes []string `yaml:"bootNodes,omitempty"` // staticNodes config the nodes which you trust StaticNodes map[string][]string `yaml:"staticNodes,omitempty"` // isBroadCast config whether broadcast to all StaticNodes IsBroadCast bool `yaml:"isBroadCast,omitempty"` // maxStreamLimits config the max stream num MaxStreamLimits int32 `yaml:"maxStreamLimits,omitempty"` // maxMessageSize config the max message size MaxMessageSize int64 `yaml:"maxMessageSize,omitempty"` // timeout config the timeout of Request with response Timeout int64 `yaml:"timeout,omitempty"` // StreamIPLimitSize set the limitation size for same ip StreamIPLimitSize int64 `yaml:"streamIPLimitSize,omitempty"` // MaxBroadcastPeers limit the number of common peers in a broadcast, // this number do not include MaxBroadcastCorePeers. MaxBroadcastPeers int `yaml:"maxBroadcastPeers,omitempty"` // isTls config the node use tls secure transparent IsTls bool `yaml:"isTls,omitempty"` // ServiceName ServiceName string `yaml:"serviceName,omitempty"` }
Config is the config of p2p server. Attention, config of dht are not expose
func GetDefP2PConf ¶
func GetDefP2PConf() *NetConf
func LoadP2PConf ¶
Click to show internal directories.
Click to hide internal directories.