Versions in this module Expand all Collapse all v0 v0.4.0 Mar 25, 2024 Changes in this version type Peer + func (p *Peer) Advertise(ctx context.Context, topic string) error + func (p *Peer) Discover(ctx context.Context, topic string) (<-chan peer.AddrInfo, error) v0.3.0 Feb 28, 2024 Changes in this version + const ProtocolBlockCertification + const ProtocolBlockProposal + const ProtocolHandshake + const ProtocolInputForward + const ProtocolLedgerReplicationReq + const ProtocolLedgerReplicationResp + const ProtocolRootIrChangeReq + const ProtocolRootProposal + const ProtocolRootStateReq + const ProtocolRootStateResp + const ProtocolRootTimeout + const ProtocolRootVote + const ProtocolUnicityCertificates + var DefaultValidatorNetworkOptions = ValidatorNetworkOptions + var ErrPeerConfigurationIsNil = errors.New("peer configuration is nil") + func NewLibP2PValidatorNetwork(self *Peer, opts ValidatorNetworkOptions, obs Observability) (*validatorNetwork, error) + func NodeIDFromPublicKeyBytes(pubKey []byte) (peer.ID, error) + type LibP2PNetwork struct + func NewLibP2PRootChainNetwork(self *Peer, capacity uint, sendCertificateTimeout time.Duration, ...) (*LibP2PNetwork, error) + func NewLibP2RootConsensusNetwork(self *Peer, capacity uint, sendTimeout time.Duration, obs Observability) (*LibP2PNetwork, error) + func (n *LibP2PNetwork) ReceivedChannel() <-chan any + func (n *LibP2PNetwork) Send(ctx context.Context, msg any, receivers ...peer.ID) error + type Observability interface + Logger func() *slog.Logger + Meter func(name string, opts ...metric.MeterOption) metric.Meter + Tracer func(name string, options ...trace.TracerOption) trace.Tracer + type Peer struct + func NewPeer(ctx context.Context, conf *PeerConfiguration, log *slog.Logger, ...) (*Peer, error) + func (p *Peer) BootstrapNodes() []peer.AddrInfo + func (p *Peer) Close() error + func (p *Peer) Configuration() *PeerConfiguration + func (p *Peer) CreateStream(ctx context.Context, peerID peer.ID, protocolID string) (network.Stream, error) + func (p *Peer) FilterValidators(exclude peer.ID) []peer.ID + func (p *Peer) GetRandomPeerID() peer.ID + func (p *Peer) ID() peer.ID + func (p *Peer) MultiAddresses() []ma.Multiaddr + func (p *Peer) Network() network.Network + func (p *Peer) PublicKey() (crypto.PubKey, error) + func (p *Peer) RegisterProtocolHandler(protocolID string, handler network.StreamHandler) + func (p *Peer) RemoveProtocolHandler(protocolID string) + func (p *Peer) String() string + func (p *Peer) Validators() []peer.ID + type PeerConfiguration struct + Address string + BootstrapPeers []peer.AddrInfo + ID peer.ID + KeyPair *PeerKeyPair + Validators []peer.ID + func NewPeerConfiguration(addr string, keyPair *PeerKeyPair, bootstrapPeers []peer.AddrInfo, ...) (*PeerConfiguration, error) + type PeerKeyPair struct + PrivateKey []byte + PublicKey []byte + type TxProcessor func(ctx context.Context, tx *types.TransactionOrder) error + type ValidatorNetworkOptions struct + BlockCertificationTimeout time.Duration + BlockProposalTimeout time.Duration + HandshakeTimeout time.Duration + LedgerReplicationRequestTimeout time.Duration + LedgerReplicationResponseTimeout time.Duration + ReceivedChannelCapacity uint + TxBufferHashAlgorithm crypto.Hash + TxBufferSize uint