Documentation ¶
Overview ¶
Package handshake implements the Ouroboros handshake protocol
Index ¶
Constants ¶
View Source
const ( ProtocolName = "handshake" ProtocolId = 0 )
Protocol identifiers
View Source
const ( MessageTypeProposeVersions = 0 MessageTypeAcceptVersion = 1 MessageTypeRefuse = 2 )
Message types
View Source
const ( RefuseReasonVersionMismatch uint64 = 0 RefuseReasonDecodeError uint64 = 1 RefuseReasonRefused uint64 = 2 )
Refusal reasons
Variables ¶
View Source
var StateMap = protocol.StateMap{ // contains filtered or unexported fields }
Handshake 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 Handshake client
type Config ¶
type Config struct { ProtocolVersionMap protocol.ProtocolVersionMap FinishedFunc FinishedFunc Timeout time.Duration }
Config is used to configure the Handshake protocol instance
func NewConfig ¶
func NewConfig(options ...HandshakeOptionFunc) Config
NewConfig returns a new Handshake config object with the provided options
type FinishedFunc ¶
type FinishedFunc func(CallbackContext, uint16, protocol.VersionData) error
Callback function types
type HandshakeOptionFunc ¶
type HandshakeOptionFunc func(*Config)
HandshakeOptionFunc represents a function used to modify the Handshake protocol config
func WithFinishedFunc ¶
func WithFinishedFunc(finishedFunc FinishedFunc) HandshakeOptionFunc
WithFinishedFunc specifies the Finished callback function
func WithProtocolVersionMap ¶ added in v0.63.0
func WithProtocolVersionMap( versionMap protocol.ProtocolVersionMap, ) HandshakeOptionFunc
WithProtocolVersionMap specifies the supported protocol versions
func WithTimeout ¶
func WithTimeout(timeout time.Duration) HandshakeOptionFunc
WithTimeout specifies the timeout for the handshake operation
type MsgAcceptVersion ¶
type MsgAcceptVersion struct { protocol.MessageBase Version uint16 VersionData cbor.RawMessage }
func NewMsgAcceptVersion ¶
func NewMsgAcceptVersion( version uint16, versionData protocol.VersionData, ) *MsgAcceptVersion
type MsgProposeVersions ¶
type MsgProposeVersions struct { protocol.MessageBase VersionMap map[uint16]cbor.RawMessage }
func NewMsgProposeVersions ¶
func NewMsgProposeVersions( versionMap protocol.ProtocolVersionMap, ) *MsgProposeVersions
type MsgRefuse ¶
type MsgRefuse struct { protocol.MessageBase Reason []interface{} }
func NewMsgRefuse ¶
func NewMsgRefuse(reason []interface{}) *MsgRefuse
Click to show internal directories.
Click to hide internal directories.