Documentation
¶
Index ¶
Constants ¶
View Source
const LoggerTag = "LIBP2P"
View Source
const TransportName = "libp2p"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Mode describes in what mode the node should operate.
Mode Mode
// Topics is a list of subscribed topics. A value of the map a type of
// message given as a nil pointer, e.g.: (*Message)(nil).
Topics map[string]transport.Message
// PeerPrivKey is a key used for peer identity. If empty, then random key
// is used. Ignored in bootstrap mode.
PeerPrivKey crypto.PrivKey
// MessagePrivKey is a key used to sign messages. If empty, then message
// are signed with the same key which is used for peer identity. Ignored
// in bootstrap mode.
MessagePrivKey crypto.PrivKey
// ListenAddrs is a list of multiaddresses on which this node will be
// listening on. If empty, the localhost, and a random port will be used.
ListenAddrs []string
// ExternalAddr is a multiaddress of the node that will be advertised to peers.
ExternalAddr multiaddr.Multiaddr
// BootstrapAddrs is a list multiaddresses of initial peers to connect to.
// This option is ignored when discovery is disabled.
BootstrapAddrs []string
// DirectPeersAddrs is a list multiaddresses of peers to which messages
// will be sent directly. This option has to be configured symmetrically
// at both ends.
DirectPeersAddrs []string
// BlockedAddrs is a list of multiaddresses to which connection will be
// blocked. If an address on that list contains an IP and a peer ID, both
// will be blocked separately.
BlockedAddrs []string
// AuthorAllowlist is a list of allowed message authors. Only messages from
// these addresses will be accepted.
AuthorAllowlist []types.Address
// Discovery indicates whenever peer discovery should be enabled.
// If discovery is disabled, then DirectPeersAddrs must be used
// to connect to the network. Always enabled in bootstrap mode.
Discovery bool
// Signer used to verify price messages. Ignored in bootstrap mode.
Signer wallet.Key
// Logger is a custom logger instance. If not provided then null
// logger is used.
Logger log.Logger
// Application info:
AppName string
AppVersion string
}
Config is the configuration for the P2P transport. TODO: This Config should not be responsible for parsing multiAddresses.
type Mode ¶
type Mode int
Mode describes operating mode of the node.
const ( // ClientMode operates the node as client. ClientMode can publish and read messages // and provides peer discovery service for other nodes. ClientMode Mode = iota // BootstrapMode operates the node as a bootstrap node. BootstrapMode node provides // only peer discovery service for other nodes. BootstrapMode )
type P2P ¶
type P2P struct {
// contains filtered or unexported fields
}
P2P is the wrapper for the Node that implements the transport.Transport interface.
func (*P2P) Messages ¶
func (p *P2P) Messages(topic string) <-chan transport.ReceivedMessage
Messages implements the transport.Transport interface.
func (*P2P) ServiceName ¶ added in v0.20.0
ServiceName implements the supervisor.WithName interface.
Click to show internal directories.
Click to hide internal directories.