Documentation ¶
Index ¶
Constants ¶
This section is empty.
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"` Flood bool `mapstructure:"flood"` Listen string `mapstructure:"listen"` Bootnodes []string `mapstructure:"bootnodes"` MinPeers int `mapstructure:"min-peers"` LowPeers int `mapstructure:"low-peers"` HighPeers int `mapstructure:"high-peers"` AdvertiseAddress string `mapstructure:"advertise-address"` AcceptQueue int `mapstructure:"p2p-accept-queue"` Metrics bool `mapstructure:"p2p-metrics"` }
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.