package aerotun import "time" const ( ProtocolName = "AeroTUN" ProtocolVersion = 1 DefaultMTU = 1420 DefaultPort = 51830 MagicHeader = 0xAE70 // "AE" FlagCompressedLZ4 = 0x01 FlagKeepalive = 0x02 StoragePath = "/etc/proxmox-router/vpn/aerotun_instances.json" ) // TunnelInstance represents a configured AeroTUN interface and its live status type TunnelInstance struct { ID string `json:"id"` Name string `json:"name"` // e.g. "aerotun0" Mode string `json:"mode"` // "server" (listen) or "client" (dial) ListenPort int `json:"listen_port"` // UDP port to bind RemoteEndpoint string `json:"remote_endpoint"` // "host:port" (used if client or static peer) LocalAddress string `json:"local_address"` // CIDR e.g. "10.99.0.1/24" PeerAddress string `json:"peer_address"` // Peer CIDR e.g. "10.99.0.2/24" PSK string `json:"psk"` // 32-byte hex/base64 pre-shared key Compression bool `json:"compression"` // Enable adaptive LZ4 MTU int `json:"mtu"` // e.g. 1420 DefaultRoute bool `json:"default_route"` // Route 0.0.0.0/0 via this tunnel Disabled bool `json:"disabled"` // MikroTik 'X' flag Comment string `json:"comment,omitempty"` CreatedAt time.Time `json:"created_at"` // Runtime state & telemetry Running bool `json:"running"` ActivePeerEndpoint string `json:"active_peer_endpoint,omitempty"` LastHandshake string `json:"last_handshake,omitempty"` RxBytes uint64 `json:"rx_bytes"` TxBytes uint64 `json:"tx_bytes"` RawBytesIn uint64 `json:"raw_bytes_in"` // uncompressed RX payload RawBytesOut uint64 `json:"raw_bytes_out"` // uncompressed TX payload WireBytesIn uint64 `json:"wire_bytes_in"` // actual wire RX WireBytesOut uint64 `json:"wire_bytes_out"`// actual wire TX SavedBytes uint64 `json:"saved_bytes"` // Bandwidth saved through compression CompressionRatio string `json:"compression_ratio,omitempty"` PacketsRx uint64 `json:"packets_rx"` PacketsTx uint64 `json:"packets_tx"` CompressedPackets uint64 `json:"compressed_packets"` RawPackets uint64 `json:"raw_packets"` } // SummaryStats aggregates performance across all AeroTUN tunnels type SummaryStats struct { TotalTunnels int `json:"total_tunnels"` ActiveTunnels int `json:"active_tunnels"` TotalRxBytes uint64 `json:"total_rx_bytes"` TotalTxBytes uint64 `json:"total_tx_bytes"` TotalSavedBytes uint64 `json:"total_saved_bytes"` AverageRatio string `json:"average_ratio"` AlgorithmCrypto string `json:"algorithm_crypto"` AlgorithmCompress string `json:"algorithm_compress"` }