certexchange

package
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0, MIT Imports: 26 Imported by: 3

Documentation

Index

Constants

View Source
const NoLimit uint64 = math.MaxUint64

Request unlimited certificates.

Variables

This section is empty.

Functions

func FetchProtocolName

func FetchProtocolName(nn gpbft.NetworkName) protocol.ID

func FindInitialPowerTable added in v0.0.5

func FindInitialPowerTable(ctx context.Context, c Client, powerTableCID cid.Cid, ecPeriod time.Duration) (gpbft.PowerEntries, error)

Types

type Client

type Client struct {
	Host           host.Host
	NetworkName    gpbft.NetworkName
	RequestTimeout time.Duration
}

Client is a libp2p certificate exchange client for requesting finality certificates from specific peers.

func (*Client) Request

func (c *Client) Request(ctx context.Context, p peer.ID, req *Request) (_rh *ResponseHeader, _ch <-chan *certs.FinalityCertificate, _err error)

Request finality certificates from the specified peer. Returned finality certificates start at the requested instance number and are sequential, but are otherwise unvalidated.

type Request

type Request struct {
	// First instance to fetch.
	FirstInstance uint64
	// Max number of instances to fetch. The server may respond with fewer certificates than
	// requested, even if more are available.
	Limit uint64
	// Include the full power table needed to validate the first finality certificate.
	// Checked by the user against their last finality certificate.
	IncludePowerTable bool
}

func (*Request) MarshalCBOR

func (t *Request) MarshalCBOR(w io.Writer) error

func (*Request) UnmarshalCBOR

func (t *Request) UnmarshalCBOR(r io.Reader) (err error)

type ResponseHeader

type ResponseHeader struct {
	// The next instance to be finalized. This is 0 when no instances have been finalized.
	PendingInstance uint64
	// Power table, if requested, or empty.
	PowerTable gpbft.PowerEntries
}

func (*ResponseHeader) MarshalCBOR

func (t *ResponseHeader) MarshalCBOR(w io.Writer) error

func (*ResponseHeader) UnmarshalCBOR

func (t *ResponseHeader) UnmarshalCBOR(r io.Reader) (err error)

type Server

type Server struct {
	// Request timeouts. If non-zero, requests will be canceled after the specified duration.
	RequestTimeout time.Duration
	NetworkName    gpbft.NetworkName
	Host           host.Host
	Store          *certstore.Store
	// contains filtered or unexported fields
}

Server is libp2p a certificate exchange server.

func (*Server) Start

func (s *Server) Start(startCtx context.Context) error

Start the server.

func (*Server) Stop

func (s *Server) Stop(stopCtx context.Context) error

Stop the server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL