Documentation ¶
Overview ¶
Package peersharing implements the Ouroboros PeerSharing protocol
Index ¶
Constants ¶
View Source
const ( MessageTypeDone = 2 )
Message types
View Source
const ( ProtocolName = "peer-sharing" ProtocolId = 10 )
Protocol identifiers
Variables ¶
View Source
var StateMap = protocol.StateMap{ // contains filtered or unexported fields }
PeerSharing protocol state machine
Functions ¶
Types ¶
type CallbackContext ¶ added in v0.78.0
type CallbackContext struct { ConnectionId connection.ConnectionId Client *Client Server *Server }
Callback context
type Client ¶
Client implements the PeerSharing client
type Config ¶
Config is used to configure the PeerSharing protocol instance
func NewConfig ¶
func NewConfig(options ...PeerSharingOptionFunc) Config
NewConfig returns a new PeerSharing config object with the provided options
type MsgDone ¶
type MsgDone struct {
protocol.MessageBase
}
func NewMsgDone ¶
func NewMsgDone() *MsgDone
type MsgSharePeers ¶
type MsgSharePeers struct {}
func NewMsgSharePeers ¶
func NewMsgSharePeers(peerAddresses []PeerAddress) *MsgSharePeers
type MsgShareRequest ¶
type MsgShareRequest struct {}
func NewMsgShareRequest ¶
func NewMsgShareRequest(amount uint8) *MsgShareRequest
type PeerAddress ¶ added in v0.75.0
func (*PeerAddress) UnmarshalCBOR ¶ added in v0.75.0
func (p *PeerAddress) UnmarshalCBOR(cborData []byte) error
type PeerSharing ¶
PeerSharing is a wrapper object that holds the client and server instances
func New ¶
func New(protoOptions protocol.ProtocolOptions, cfg *Config) *PeerSharing
New returns a new PeerSharing object
type PeerSharingOptionFunc ¶
type PeerSharingOptionFunc func(*Config)
PeerSharingOptionFunc represents a function used to modify the PeerSharing protocol config
func WithShareRequestFunc ¶ added in v0.76.0
func WithShareRequestFunc( shareRequestFunc ShareRequestFunc, ) PeerSharingOptionFunc
WithShareRequestFunc specifies the ShareRequest callback function
func WithTimeout ¶
func WithTimeout(timeout time.Duration) PeerSharingOptionFunc
WithTimeout specifies the timeout for the handshake operation
type ShareRequestFunc ¶ added in v0.76.0
type ShareRequestFunc func(CallbackContext, int) ([]PeerAddress, error)
Callback function types
Click to show internal directories.
Click to hide internal directories.