protocol

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRegister       = "register"
	TypeConnectRequest = "connect_request"
	TypeConnectAccept  = "connect_accept"
	TypeConnectReject  = "connect_reject"
	TypePublicKey      = "public_key"
	TypeAESKey         = "aes_key"
	TypeMessage        = "message"
	TypeACK            = "ack"
	TypeHeartbeat      = "heartbeat"
	TypeDisconnect     = "disconnect"
)

Packet Types

Variables

This section is empty.

Functions

This section is empty.

Types

type Packet

type Packet struct {
	Type      string `json:"type"`
	From      string `json:"from"`
	To        string `json:"to"`
	Payload   string `json:"payload,omitempty"` // Base64 encoded data
	Timestamp int64  `json:"timestamp,omitempty"`
	MessageID string `json:"message_id,omitempty"`
}

Packet represents the standard message structure.

func NewPacket

func NewPacket(pType, from, to, payload string) Packet

NewPacket creates a new packet with a timestamp.

Jump to

Keyboard shortcuts

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