messages

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeOptions

type BridgeOptions struct {
	// Timestamp is the timestamp of the connection opening
	Timestamp time.Time

	// The remote URL
	URLRemote url.URL

	// Cipher is the cipher that is used to encrypt the data
	Cipher string

	// Curve is the canonical name of the curve that is used to generate the keys
	Curve string
}

BridgeOptions defines the options for the bridge, which are shared with the relay on the other side of the bridge when this relay attempts to open a connection to the other relay.

type ConnectionAcceptMessage

type ConnectionAcceptMessage struct {
	// PCKey is the ephemeral public connection key, used to encrypt&sign the data for this connection
	PCKey string
}

type ConnectionFailedMessage

type ConnectionFailedMessage struct {
	// Reason is the reason why the connection failed
	Reason string
}

ConnectionFailedMessage is a message that is sent when a connection open attempt failed.

type ConnectionID

type ConnectionID string

type ConnectionOpenMessage

type ConnectionOpenMessage struct {
	// BridgeOptions defines the options for the bridge, which are shared
	BridgeOptions BridgeOptions

	// PCKey is the ephemeral public connection key, used to encrypt&sign the data for this connection
	PCKey string
}

ConnectionOpenMessage is a message that is sent when a connection is opened.

type DataAckMessage

type DataAckMessage struct {
	// Seq is the sequence number of the data
	Seq uint64

	// Retransmitted is a flag that indicates if the ack is for a retransmitted message
	Re bool
}

DataAckMessage is a message that is sent when data with a sequence number is received.

type DataMessage

type DataMessage struct {
	// Seq is the sequence number of the data
	Seq uint64

	// Retransmitted is a flag that indicates if the data is a retransmission
	Re bool

	// Data is the actual payload from the bridged connection
	Data []byte
}

DataMessage is a message that contains data.

type DatagramMessage

type DatagramMessage struct {
	// Addr is the address of the sender
	Source string

	// Target is the address of the recipient
	Target string

	// Data is the actual payload from the bridged connection
	Data []byte
}

DataGramMessage is a message that contains data.

type Message

type Message struct {
	// Header is the plaintext, but authenticated header of the message
	Header MessageHeader

	// Message is the serialized and encrypted message, i.e. a DataMessage
	Message []byte
}

Message is a message that is sent to the portier server.

type MessageHeader

type MessageHeader struct {
	// From is the spider device Id of the sender of the message
	From uuid.UUID

	// To is the spider device Id of the recipient of the message
	To uuid.UUID

	// The type of this message
	Type MessageType

	// CID is a uuid for the connection
	CID ConnectionID
}

type MessageType

type MessageType string
const (
	// ConnectionOpenMessage is a message that is sent when a connection is opened.
	CO MessageType = "CO"

	// ConnectionCloseMessage is a message that is sent when a connection is closed.
	CC MessageType = "CC"

	// ConnectionAcceptMessage is a message that is sent when a connection is accepted.
	CA MessageType = "CA"

	// ConnectionReadyMessage is a message that is sent after CA, when both sides of the connection are ready.
	CR MessageType = "CR"

	// ConnectionFailedMessage is a message that is sent when a connection open attempt failed.
	CF MessageType = "CF"

	// ConnectionNotFoundMessage is a message that is sent when a connection is not found.
	NF MessageType = "NF"

	// DataMessage is a message that contains data.
	D MessageType = "D"

	// DataGram a message that contains data from *gram socket.
	DG MessageType = "DG"

	// DataAckMessage is a message that is sent when data with a sequence number is received.
	DA MessageType = "DA"
)

Jump to

Keyboard shortcuts

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