Documentation
¶
Index ¶
- Constants
- type Client
- type PacketType
- type Server
- func (v *Server) DisconnectClient(clientID uuid.UUID)
- func (v *Server) GetClientCount() int
- func (v *Server) GetConnectedClients() []uuid.UUID
- func (v *Server) GetListeningClients(packet *VCSPacket, senderId uuid.UUID) []*Client
- func (v *Server) Listen(address string, stopChan chan struct{}) error
- func (v *Server) PlayVoiceData(payload []byte)
- func (v *Server) Stop() error
- type VCSPacket
- func (p *VCSPacket) FrequencyAsFloat32() float32
- func (p *VCSPacket) FrequencyMHz() float64
- func (p *VCSPacket) IsIntercom() bool
- func (p *VCSPacket) IsPTTActive() bool
- func (p *VCSPacket) SerializePacket() []byte
- func (p *VCSPacket) SetFrequencyMHz(freqMHz float64)
- func (p *VCSPacket) SetIntercom(active bool)
- func (p *VCSPacket) SetPTT(active bool)
- func (p *VCSPacket) String() string
Constants ¶
View Source
const ( HeaderSize = 27 // Total header size in bytes MagicVCS = "VCS" )
Constants
View Source
const ( BufferSize = 1024 // UDP buffer size JitterBufferSize = 10 // Number of packets to buffer PlayoutDelay = 60 * time.Millisecond // Initial playout delay )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PacketType ¶
type PacketType uint8
PacketType represents the different packet types
const ( PacketTypeVoice PacketType = iota PacketTypeHello PacketTypeHelloAck PacketTypeKeepalive PacketTypeBye )
func (PacketType) String ¶
func (pt PacketType) String() string
String returns the string representation of PacketType
type Server ¶
func NewServer ¶
func NewServer(state *state.ServerState, logger *slog.Logger, distributionState *state.DistributionState, settingsState *state.SettingsState) *Server
func (*Server) DisconnectClient ¶
func (*Server) GetClientCount ¶
func (*Server) GetConnectedClients ¶
func (*Server) GetListeningClients ¶
func (*Server) PlayVoiceData ¶
Simple, direct PlayVoiceData without dejitter buffer - for clean local test playback
type VCSPacket ¶
type VCSPacket struct {
Magic [3]byte // Protocol identifier (VCS)
Version uint8 // Protocol version (4 bits)
Type PacketType // Packet type (4 bits)
Flags uint8 // Flags (1. bit PTT, 2. bit Intercom, 6 bits reserved)
Sequence uint32 // 24-bit sequence number
Frequency uint32 // 24-bit frequency in kHz
SenderID uuid.UUID // UUIDv4 session identifier
Payload []byte // Variable payload data
}
VCSPacket represents a parsed VCS protocol packet
func NewVCSHelloAckPacket ¶
func NewVCSKeepalivePacket ¶
func NewVCSVoicePacket ¶
func ParsePacket ¶
ParsePacket parses a raw UDP packet into a VCSPacket struct
func (*VCSPacket) FrequencyAsFloat32 ¶
func (*VCSPacket) FrequencyMHz ¶
FrequencyMHz returns the frequency in MHz as a float64
func (*VCSPacket) IsIntercom ¶
IsIntercom returns true if the Intercom flag is set
func (*VCSPacket) IsPTTActive ¶
IsPTTActive returns true if the PTT flag is set
func (*VCSPacket) SerializePacket ¶
SerializePacket converts a VCSPacket struct back to raw bytes
func (*VCSPacket) SetFrequencyMHz ¶
SetFrequencyMHz sets the frequency from MHz (converts to kHz internally)
func (*VCSPacket) SetIntercom ¶
SetIntercom sets or clears the Intercom flag
Click to show internal directories.
Click to hide internal directories.