Documentation ¶
Index ¶
- Variables
- type Handshaker
- type Packet
- func (m *Packet) CloneMessageVT() proto.Message
- func (m *Packet) CloneVT() *Packet
- func (*Packet) Descriptor() ([]byte, []int)deprecated
- func (this *Packet) EqualMessageVT(thatMsg proto.Message) bool
- func (this *Packet) EqualVT(that *Packet) bool
- func (x *Packet) GetCompletePkt() *Packet_Complete
- func (x *Packet) GetInitAckPkt() *Packet_InitAck
- func (x *Packet) GetInitPkt() *Packet_Init
- func (x *Packet) GetPacketType() PacketType
- func (m *Packet) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Packet) MarshalToVT(dAtA []byte) (int, error)
- func (m *Packet) MarshalVT() (dAtA []byte, err error)
- func (*Packet) ProtoMessage()
- func (x *Packet) ProtoReflect() protoreflect.Message
- func (x *Packet) Reset()
- func (m *Packet) SizeVT() (n int)
- func (x *Packet) String() string
- func (m *Packet) UnmarshalVT(dAtA []byte) error
- type PacketType
- type Packet_Ciphertext
- func (m *Packet_Ciphertext) CloneMessageVT() proto.Message
- func (m *Packet_Ciphertext) CloneVT() *Packet_Ciphertext
- func (*Packet_Ciphertext) Descriptor() ([]byte, []int)deprecated
- func (this *Packet_Ciphertext) EqualMessageVT(thatMsg proto.Message) bool
- func (this *Packet_Ciphertext) EqualVT(that *Packet_Ciphertext) bool
- func (x *Packet_Ciphertext) GetExtraInfo() []byte
- func (x *Packet_Ciphertext) GetReceiverKeyKnown() bool
- func (x *Packet_Ciphertext) GetSenderPubKey() []byte
- func (x *Packet_Ciphertext) GetTupleSignature() []byte
- func (m *Packet_Ciphertext) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Packet_Ciphertext) MarshalToVT(dAtA []byte) (int, error)
- func (m *Packet_Ciphertext) MarshalVT() (dAtA []byte, err error)
- func (*Packet_Ciphertext) ProtoMessage()
- func (x *Packet_Ciphertext) ProtoReflect() protoreflect.Message
- func (x *Packet_Ciphertext) Reset()
- func (m *Packet_Ciphertext) SizeVT() (n int)
- func (x *Packet_Ciphertext) String() string
- func (m *Packet_Ciphertext) UnmarshalVT(dAtA []byte) error
- type Packet_Complete
- func (m *Packet_Complete) CloneMessageVT() proto.Message
- func (m *Packet_Complete) CloneVT() *Packet_Complete
- func (*Packet_Complete) Descriptor() ([]byte, []int)deprecated
- func (this *Packet_Complete) EqualMessageVT(thatMsg proto.Message) bool
- func (this *Packet_Complete) EqualVT(that *Packet_Complete) bool
- func (x *Packet_Complete) GetCiphertext() []byte
- func (m *Packet_Complete) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Packet_Complete) MarshalToVT(dAtA []byte) (int, error)
- func (m *Packet_Complete) MarshalVT() (dAtA []byte, err error)
- func (*Packet_Complete) ProtoMessage()
- func (x *Packet_Complete) ProtoReflect() protoreflect.Message
- func (x *Packet_Complete) Reset()
- func (m *Packet_Complete) SizeVT() (n int)
- func (x *Packet_Complete) String() string
- func (m *Packet_Complete) UnmarshalVT(dAtA []byte) error
- type Packet_Init
- func (m *Packet_Init) CloneMessageVT() proto.Message
- func (m *Packet_Init) CloneVT() *Packet_Init
- func (*Packet_Init) Descriptor() ([]byte, []int)deprecated
- func (this *Packet_Init) EqualMessageVT(thatMsg proto.Message) bool
- func (this *Packet_Init) EqualVT(that *Packet_Init) bool
- func (x *Packet_Init) GetReceiverPeerId() []byte
- func (x *Packet_Init) GetSenderEphPub() []byte
- func (x *Packet_Init) GetSenderPeerId() []byte
- func (m *Packet_Init) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Packet_Init) MarshalToVT(dAtA []byte) (int, error)
- func (m *Packet_Init) MarshalVT() (dAtA []byte, err error)
- func (*Packet_Init) ProtoMessage()
- func (x *Packet_Init) ProtoReflect() protoreflect.Message
- func (x *Packet_Init) Reset()
- func (m *Packet_Init) SizeVT() (n int)
- func (x *Packet_Init) String() string
- func (m *Packet_Init) UnmarshalVT(dAtA []byte) error
- func (m *Packet_Init) Validate() error
- type Packet_InitAck
- func (m *Packet_InitAck) CloneMessageVT() proto.Message
- func (m *Packet_InitAck) CloneVT() *Packet_InitAck
- func (*Packet_InitAck) Descriptor() ([]byte, []int)deprecated
- func (this *Packet_InitAck) EqualMessageVT(thatMsg proto.Message) bool
- func (this *Packet_InitAck) EqualVT(that *Packet_InitAck) bool
- func (x *Packet_InitAck) GetCiphertext() []byte
- func (x *Packet_InitAck) GetSenderEphPub() []byte
- func (m *Packet_InitAck) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Packet_InitAck) MarshalToVT(dAtA []byte) (int, error)
- func (m *Packet_InitAck) MarshalVT() (dAtA []byte, err error)
- func (*Packet_InitAck) ProtoMessage()
- func (x *Packet_InitAck) ProtoReflect() protoreflect.Message
- func (x *Packet_InitAck) Reset()
- func (m *Packet_InitAck) SizeVT() (n int)
- func (x *Packet_InitAck) String() string
- func (m *Packet_InitAck) UnmarshalVT(dAtA []byte) error
- func (m *Packet_InitAck) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ( PacketType_name = map[int32]string{ 0: "PacketType_INIT", 1: "PacketType_INIT_ACK", 2: "PacketType_COMPLETE", } PacketType_value = map[string]int32{ "PacketType_INIT": 0, "PacketType_INIT_ACK": 1, "PacketType_COMPLETE": 2, } )
Enum value maps for PacketType.
var File_github_com_aperturerobotics_bifrost_handshake_identity_s2s_s2s_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Handshaker ¶
type Handshaker struct {
// contains filtered or unexported fields
}
Handshaker implements the Station to Station handshake protocol.
func NewHandshaker ¶
func NewHandshaker( privKey crypto.PrivKey, expectedRemotePub crypto.PubKey, writePacket func(data []byte) error, lookupPubKey func(pid peer.ID) crypto.PubKey, initiator bool, extraData []byte, ) (*Handshaker, error)
NewHandshaker builds a new handshaker. ExpectedRemotePub speeds up the handshake by indicating an expected remote public key. It can be nil.
func (*Handshaker) Close ¶
func (h *Handshaker) Close()
Close cleans up any resources allocated by the handshake.
func (*Handshaker) Execute ¶
Execute executes the handshake with a context. Initiator indicates the handshaker is the initiator of the handshake. Returning an error cancels the attempt.
func (*Handshaker) Handle ¶
func (h *Handshaker) Handle(data []byte) bool
Handle handles an incoming packet. The buffer is re-used upon return. Returns if another packet is expected.
type Packet ¶
type Packet struct { // PacketType is the packet type. PacketType PacketType `protobuf:"varint,1,opt,name=packet_type,json=packetType,proto3,enum=s2s.PacketType" json:"packet_type,omitempty"` // InitPkt is the init packet. InitPkt *Packet_Init `protobuf:"bytes,2,opt,name=init_pkt,json=initPkt,proto3" json:"init_pkt,omitempty"` // InitAck is the init-ack packet. InitAckPkt *Packet_InitAck `protobuf:"bytes,3,opt,name=init_ack_pkt,json=initAckPkt,proto3" json:"init_ack_pkt,omitempty"` // Complete is the complete packet. CompletePkt *Packet_Complete `protobuf:"bytes,4,opt,name=complete_pkt,json=completePkt,proto3" json:"complete_pkt,omitempty"` // contains filtered or unexported fields }
Packet is a handshake packet.
func (*Packet) CloneMessageVT ¶ added in v0.15.6
func (*Packet) Descriptor
deprecated
func (*Packet) EqualMessageVT ¶ added in v0.15.6
func (*Packet) GetCompletePkt ¶
func (x *Packet) GetCompletePkt() *Packet_Complete
func (*Packet) GetInitAckPkt ¶
func (x *Packet) GetInitAckPkt() *Packet_InitAck
func (*Packet) GetInitPkt ¶
func (x *Packet) GetInitPkt() *Packet_Init
func (*Packet) GetPacketType ¶
func (x *Packet) GetPacketType() PacketType
func (*Packet) MarshalToSizedBufferVT ¶ added in v0.2.0
func (*Packet) ProtoMessage ¶
func (*Packet) ProtoMessage()
func (*Packet) ProtoReflect ¶ added in v0.2.0
func (x *Packet) ProtoReflect() protoreflect.Message
func (*Packet) UnmarshalVT ¶ added in v0.2.0
type PacketType ¶
type PacketType int32
const ( // INIT initializes the handshake. PacketType_PacketType_INIT PacketType = 0 // INIT_ACK is the reply to the init. PacketType_PacketType_INIT_ACK PacketType = 1 // COMPLETE is the completion of the handshake. PacketType_PacketType_COMPLETE PacketType = 2 )
func (PacketType) Descriptor ¶ added in v0.2.0
func (PacketType) Descriptor() protoreflect.EnumDescriptor
func (PacketType) Enum ¶ added in v0.2.0
func (x PacketType) Enum() *PacketType
func (PacketType) EnumDescriptor
deprecated
func (PacketType) EnumDescriptor() ([]byte, []int)
Deprecated: Use PacketType.Descriptor instead.
func (PacketType) Number ¶ added in v0.2.0
func (x PacketType) Number() protoreflect.EnumNumber
func (PacketType) String ¶
func (x PacketType) String() string
func (PacketType) Type ¶ added in v0.2.0
func (PacketType) Type() protoreflect.EnumType
type Packet_Ciphertext ¶
type Packet_Ciphertext struct { // TupleSignature is the signature of the two ephemeral pub keys. // The signature is made using the sender's public key. // The keys are concatinated as AB TupleSignature []byte `protobuf:"bytes,1,opt,name=tuple_signature,json=tupleSignature,proto3" json:"tuple_signature,omitempty"` // SenderPubKey contains B's public key if necessary. SenderPubKey []byte `protobuf:"bytes,2,opt,name=sender_pub_key,json=senderPubKey,proto3" json:"sender_pub_key,omitempty"` // ReceiverKeyKnown indicates that A's public key is known. ReceiverKeyKnown bool `protobuf:"varint,3,opt,name=receiver_key_known,json=receiverKeyKnown,proto3" json:"receiver_key_known,omitempty"` // ExtraInfo contains extra information supplied by the transport. // Example: in UDP this is information about what port to dial KCP on. ExtraInfo []byte `protobuf:"bytes,4,opt,name=extra_info,json=extraInfo,proto3" json:"extra_info,omitempty"` // contains filtered or unexported fields }
func (*Packet_Ciphertext) CloneMessageVT ¶ added in v0.15.6
func (m *Packet_Ciphertext) CloneMessageVT() proto.Message
func (*Packet_Ciphertext) CloneVT ¶ added in v0.8.3
func (m *Packet_Ciphertext) CloneVT() *Packet_Ciphertext
func (*Packet_Ciphertext) Descriptor
deprecated
func (*Packet_Ciphertext) Descriptor() ([]byte, []int)
Deprecated: Use Packet_Ciphertext.ProtoReflect.Descriptor instead.
func (*Packet_Ciphertext) EqualMessageVT ¶ added in v0.15.6
func (this *Packet_Ciphertext) EqualMessageVT(thatMsg proto.Message) bool
func (*Packet_Ciphertext) EqualVT ¶ added in v0.3.0
func (this *Packet_Ciphertext) EqualVT(that *Packet_Ciphertext) bool
func (*Packet_Ciphertext) GetExtraInfo ¶
func (x *Packet_Ciphertext) GetExtraInfo() []byte
func (*Packet_Ciphertext) GetReceiverKeyKnown ¶
func (x *Packet_Ciphertext) GetReceiverKeyKnown() bool
func (*Packet_Ciphertext) GetSenderPubKey ¶
func (x *Packet_Ciphertext) GetSenderPubKey() []byte
func (*Packet_Ciphertext) GetTupleSignature ¶
func (x *Packet_Ciphertext) GetTupleSignature() []byte
func (*Packet_Ciphertext) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *Packet_Ciphertext) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*Packet_Ciphertext) MarshalToVT ¶ added in v0.2.0
func (m *Packet_Ciphertext) MarshalToVT(dAtA []byte) (int, error)
func (*Packet_Ciphertext) MarshalVT ¶ added in v0.2.0
func (m *Packet_Ciphertext) MarshalVT() (dAtA []byte, err error)
func (*Packet_Ciphertext) ProtoMessage ¶
func (*Packet_Ciphertext) ProtoMessage()
func (*Packet_Ciphertext) ProtoReflect ¶ added in v0.2.0
func (x *Packet_Ciphertext) ProtoReflect() protoreflect.Message
func (*Packet_Ciphertext) Reset ¶
func (x *Packet_Ciphertext) Reset()
func (*Packet_Ciphertext) SizeVT ¶ added in v0.2.0
func (m *Packet_Ciphertext) SizeVT() (n int)
func (*Packet_Ciphertext) String ¶
func (x *Packet_Ciphertext) String() string
func (*Packet_Ciphertext) UnmarshalVT ¶ added in v0.2.0
func (m *Packet_Ciphertext) UnmarshalVT(dAtA []byte) error
type Packet_Complete ¶
type Packet_Complete struct { // Ciphertext is a Ciphertext message encoded and encrypted with the shared key. Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` // contains filtered or unexported fields }
func (*Packet_Complete) CloneMessageVT ¶ added in v0.15.6
func (m *Packet_Complete) CloneMessageVT() proto.Message
func (*Packet_Complete) CloneVT ¶ added in v0.8.3
func (m *Packet_Complete) CloneVT() *Packet_Complete
func (*Packet_Complete) Descriptor
deprecated
func (*Packet_Complete) Descriptor() ([]byte, []int)
Deprecated: Use Packet_Complete.ProtoReflect.Descriptor instead.
func (*Packet_Complete) EqualMessageVT ¶ added in v0.15.6
func (this *Packet_Complete) EqualMessageVT(thatMsg proto.Message) bool
func (*Packet_Complete) EqualVT ¶ added in v0.3.0
func (this *Packet_Complete) EqualVT(that *Packet_Complete) bool
func (*Packet_Complete) GetCiphertext ¶
func (x *Packet_Complete) GetCiphertext() []byte
func (*Packet_Complete) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *Packet_Complete) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*Packet_Complete) MarshalToVT ¶ added in v0.2.0
func (m *Packet_Complete) MarshalToVT(dAtA []byte) (int, error)
func (*Packet_Complete) MarshalVT ¶ added in v0.2.0
func (m *Packet_Complete) MarshalVT() (dAtA []byte, err error)
func (*Packet_Complete) ProtoMessage ¶
func (*Packet_Complete) ProtoMessage()
func (*Packet_Complete) ProtoReflect ¶ added in v0.2.0
func (x *Packet_Complete) ProtoReflect() protoreflect.Message
func (*Packet_Complete) Reset ¶
func (x *Packet_Complete) Reset()
func (*Packet_Complete) SizeVT ¶ added in v0.2.0
func (m *Packet_Complete) SizeVT() (n int)
func (*Packet_Complete) String ¶
func (x *Packet_Complete) String() string
func (*Packet_Complete) UnmarshalVT ¶ added in v0.2.0
func (m *Packet_Complete) UnmarshalVT(dAtA []byte) error
type Packet_Init ¶
type Packet_Init struct { // SenderPeerID is the peer ID of the sender. SenderPeerId []byte `protobuf:"bytes,1,opt,name=sender_peer_id,json=senderPeerId,proto3" json:"sender_peer_id,omitempty"` // ReceiverPeerID is the receiver peer ID, if known. // If this does not match, the public key is included in the next message. ReceiverPeerId []byte `protobuf:"bytes,2,opt,name=receiver_peer_id,json=receiverPeerId,proto3" json:"receiver_peer_id,omitempty"` // SenderEphPub is the ephemeral public key of the sender. SenderEphPub []byte `protobuf:"bytes,3,opt,name=sender_eph_pub,json=senderEphPub,proto3" json:"sender_eph_pub,omitempty"` // contains filtered or unexported fields }
func (*Packet_Init) CloneMessageVT ¶ added in v0.15.6
func (m *Packet_Init) CloneMessageVT() proto.Message
func (*Packet_Init) CloneVT ¶ added in v0.8.3
func (m *Packet_Init) CloneVT() *Packet_Init
func (*Packet_Init) Descriptor
deprecated
func (*Packet_Init) Descriptor() ([]byte, []int)
Deprecated: Use Packet_Init.ProtoReflect.Descriptor instead.
func (*Packet_Init) EqualMessageVT ¶ added in v0.15.6
func (this *Packet_Init) EqualMessageVT(thatMsg proto.Message) bool
func (*Packet_Init) EqualVT ¶ added in v0.3.0
func (this *Packet_Init) EqualVT(that *Packet_Init) bool
func (*Packet_Init) GetReceiverPeerId ¶
func (x *Packet_Init) GetReceiverPeerId() []byte
func (*Packet_Init) GetSenderEphPub ¶
func (x *Packet_Init) GetSenderEphPub() []byte
func (*Packet_Init) GetSenderPeerId ¶
func (x *Packet_Init) GetSenderPeerId() []byte
func (*Packet_Init) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *Packet_Init) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*Packet_Init) MarshalToVT ¶ added in v0.2.0
func (m *Packet_Init) MarshalToVT(dAtA []byte) (int, error)
func (*Packet_Init) MarshalVT ¶ added in v0.2.0
func (m *Packet_Init) MarshalVT() (dAtA []byte, err error)
func (*Packet_Init) ProtoMessage ¶
func (*Packet_Init) ProtoMessage()
func (*Packet_Init) ProtoReflect ¶ added in v0.2.0
func (x *Packet_Init) ProtoReflect() protoreflect.Message
func (*Packet_Init) Reset ¶
func (x *Packet_Init) Reset()
func (*Packet_Init) SizeVT ¶ added in v0.2.0
func (m *Packet_Init) SizeVT() (n int)
func (*Packet_Init) String ¶
func (x *Packet_Init) String() string
func (*Packet_Init) UnmarshalVT ¶ added in v0.2.0
func (m *Packet_Init) UnmarshalVT(dAtA []byte) error
func (*Packet_Init) Validate ¶
func (m *Packet_Init) Validate() error
Validate validates the message.
type Packet_InitAck ¶
type Packet_InitAck struct { // SenderEphPub is the ephemeral public key of the sender. // This is used to compute the shared secret and decode AckInner. SenderEphPub []byte `protobuf:"bytes,1,opt,name=sender_eph_pub,json=senderEphPub,proto3" json:"sender_eph_pub,omitempty"` // Ciphertext is a Ciphertext message encoded and encrypted with the shared key. Ciphertext []byte `protobuf:"bytes,2,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` // contains filtered or unexported fields }
func (*Packet_InitAck) CloneMessageVT ¶ added in v0.15.6
func (m *Packet_InitAck) CloneMessageVT() proto.Message
func (*Packet_InitAck) CloneVT ¶ added in v0.8.3
func (m *Packet_InitAck) CloneVT() *Packet_InitAck
func (*Packet_InitAck) Descriptor
deprecated
func (*Packet_InitAck) Descriptor() ([]byte, []int)
Deprecated: Use Packet_InitAck.ProtoReflect.Descriptor instead.
func (*Packet_InitAck) EqualMessageVT ¶ added in v0.15.6
func (this *Packet_InitAck) EqualMessageVT(thatMsg proto.Message) bool
func (*Packet_InitAck) EqualVT ¶ added in v0.3.0
func (this *Packet_InitAck) EqualVT(that *Packet_InitAck) bool
func (*Packet_InitAck) GetCiphertext ¶
func (x *Packet_InitAck) GetCiphertext() []byte
func (*Packet_InitAck) GetSenderEphPub ¶
func (x *Packet_InitAck) GetSenderEphPub() []byte
func (*Packet_InitAck) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *Packet_InitAck) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*Packet_InitAck) MarshalToVT ¶ added in v0.2.0
func (m *Packet_InitAck) MarshalToVT(dAtA []byte) (int, error)
func (*Packet_InitAck) MarshalVT ¶ added in v0.2.0
func (m *Packet_InitAck) MarshalVT() (dAtA []byte, err error)
func (*Packet_InitAck) ProtoMessage ¶
func (*Packet_InitAck) ProtoMessage()
func (*Packet_InitAck) ProtoReflect ¶ added in v0.2.0
func (x *Packet_InitAck) ProtoReflect() protoreflect.Message
func (*Packet_InitAck) Reset ¶
func (x *Packet_InitAck) Reset()
func (*Packet_InitAck) SizeVT ¶ added in v0.2.0
func (m *Packet_InitAck) SizeVT() (n int)
func (*Packet_InitAck) String ¶
func (x *Packet_InitAck) String() string
func (*Packet_InitAck) UnmarshalVT ¶ added in v0.2.0
func (m *Packet_InitAck) UnmarshalVT(dAtA []byte) error
func (*Packet_InitAck) Validate ¶
func (m *Packet_InitAck) Validate() error
Validate validates the init ack packet.