Documentation ¶
Index ¶
Constants ¶
View Source
const ( PublicReachability = "public" PrivateReachability = "private" )
Variables ¶
This section is empty.
Functions ¶
func EnsureIdentity ¶ added in v1.0.0
EnsureIdentity generates an identity key file in given directory.
func PrettyIdentityInfoFromDir ¶ added in v1.0.0
PrettyIdentityInfoFromDir returns a printable ID from a given identity directory.
Types ¶
type Config ¶ added in v1.0.0
type Config struct { DataDir string LogLevel log.Level GracePeersShutdown time.Duration MaxMessageSize int // see https://lwn.net/Articles/542629/ for reuseport explanation DisableReusePort bool `mapstructure:"disable-reuseport"` DisableNatPort bool `mapstructure:"disable-natport"` DisableConnectionManager bool `mapstructure:"disable-connection-manager"` DisableResourceManager bool `mapstructure:"disable-resource-manager"` DisableDHT bool `mapstructure:"disable-dht"` Flood bool `mapstructure:"flood"` Listen string `mapstructure:"listen"` Bootnodes []string `mapstructure:"bootnodes"` Direct []string `mapstructure:"direct"` MinPeers int `mapstructure:"min-peers"` LowPeers int `mapstructure:"low-peers"` HighPeers int `mapstructure:"high-peers"` AutoscalePeers bool `mapstructure:"autoscale-peers"` AdvertiseAddress string `mapstructure:"advertise-address"` AcceptQueue int `mapstructure:"p2p-accept-queue"` Metrics bool `mapstructure:"p2p-metrics"` Bootnode bool `mapstructure:"p2p-bootnode"` ForceReachability string `mapstructure:"p2p-reachability"` EnableHolepunching bool `mapstructure:"p2p-holepunching"` DisableLegacyDiscovery bool `mapstructure:"p2p-disable-legacy-discovery"` PrivateNetwork bool `mapstructure:"p2p-private-network"` RelayServer RelayServer `mapstructure:"relay-server"` }
Config for all things related to p2p layer.
type Host ¶ added in v1.0.0
Host is a conveniency wrapper for all p2p related functionality required to run a full spacemesh node.
func New ¶
func New(_ context.Context, logger log.Log, cfg Config, prologue []byte, opts ...Opt) (*Host, error)
New initializes libp2p host configured for spacemesh.
type Opt ¶ added in v1.0.0
type Opt func(fh *Host)
Opt is for configuring Host.
func WithContext ¶ added in v1.0.0
WithContext set context for Host.
func WithNodeReporter ¶ added in v1.0.0
func WithNodeReporter(reporter func()) Opt
WithNodeReporter updates reporter that is notified every time when node added or removed a peer.
Directories ¶
Path | Synopsis |
---|---|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
nolint
|
nolint |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.