ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches

🌐 Discovery server TCP connection manager

🌐 Discovery server TCP connection manager

Server-side ACIP (ascii-chat IP Protocol) utilities for:

  • Packet validation and parsing
  • Protocol compliance checking
  • Error response generation
  • Common server-side packet handling

ACDS Server Protocol

Server Role in ACIP

The ACDS (ascii-chat Discovery Service) server orchestrates:

  1. Session Management: Creating, joining, leaving sessions
  2. Credential Verification: Password/identity authentication
  3. Connection Brokerage: Revealing host IP only to authenticated clients
  4. WebRTC Coordination: Relaying SDP and ICE candidates
  5. Participant Tracking: Maintaining session roster and state

Packet Processing Flow

  1. Receive: acip_transport_recv() reads packet from socket
  2. Validate: Verify packet header (magic, CRC32, length)
  3. Dispatch: Route to appropriate handler (session, webrtc, etc.)
  4. Process: Handler executes business logic
  5. Respond: Send response packet back to client

Security Features

  • Identity Verification: Ed25519 digital signatures (replay-protected with timestamps)
  • Password Auth: Argon2id hashing (resistant to brute-force)
  • IP Privacy: Host IP only revealed after authentication
  • CRC32 Validation: Detect payload corruption
  • Timestamp Validation: Prevent replay attacks (5-minute window)

Session Database

  • Storage: SQLite (persistent across restarts)
  • Schema: session_id (UUID) → session_info (metadata, expiration)
  • Expiration: Sessions expire after 24 hours
  • Cleanup: Automatic garbage collection of expired sessions

Packet Type Reference (Server Perspective)

  • Inbound: SESSION_CREATE, SESSION_LOOKUP, SESSION_JOIN, SESSION_LEAVE, WEBRTC_SDP, WEBRTC_ICE
  • Outbound: SESSION_CREATED, SESSION_INFO, SESSION_JOINED, SESSION_END, PARTICIPANT_JOINED, PARTICIPANT_LEFT
  • Broadcast: PARTICIPANT_* notifications to all session members

ACIP Protocol Overview:

  • Binary TCP protocol (not HTTP/JSON)
  • Packet-based with CRC32 validation
  • Ed25519 identity signatures for authentication
  • Session management and WebRTC signaling

Primary Use Case: Library functions for building ACIP servers (like ACDS - ascii-chat Discovery Service). Provides reusable validation and packet handling logic that any ACIP server implementation can use.

Integration:

  • Used by src/acds/ ACDS server implementation
  • Can be used by custom ACIP server implementations
  • Complements network/acip/acds_client.h (client-side protocol)
Note
This module provides library-level utilities. The ACDS server application code is in src/acds/.
See also
network/acip/acds_client.h for client-side ACIP library
network/acip/acds.h for ACDS message structures
network/acip/protocol.h for ACIP packet types
network/acip/transport.h for transport abstraction layer
Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026
Version
1.0 (ACDS Server API)