How frzleaf/aolang works
Project Type and Purpose
• This is a network‐proxy tool (“AO LÀNG”) that lets multiple players host and join LAN‐only games (e.g., Warcraft III) over the Internet.
• It comprises two main binaries: a central TCP “proxy_server” and a client‐side “proxy_client” (plus optional “lan_agent” and “sandbox” helpers).
File‐Structure Analysis
• Top level:
• build/, doc/, server.sh, README.md
• src/main/ – entrypoints:
– proxy_server.go (the server app)
– proxy_client.go (the client app)
– lan_agent.go (local network agent for game broadcast interception)
– sandbox.go (network sandbox for isolating/redirecting traffic)
• src/proxy/ – shared library modules (bootstrap, connectors, controller, host/guest logic, logging, monitoring, settings, DTOs, utilities)
• src/test/ – unit tests and mock host/guest apps
• There is no database; the server maintains in‐memory sessions and forwards packets.
README Insights
• Server listens on TCP port 9999; clients connect here.
• Clients optionally build from source or use prebuilt releases.
• Purpose: intercept LAN game traffic, tunnel via Internet proxy, forward to other clients so the game believes participants are on the same LAN.
Key Components and Their Relationships
a. Client Machine Components
• Game executable (e.g. Warcraft III)
• lan_agent: intercepts/broadcasts game discovery packets
• sandbox: sets up virtual NIC or routing rules (isolates game traffic)
• proxy_client:
– LocalConnector: captures outbound UDP/TCP game traffic
– ServerConnector: maintains persistent TCP connection to proxy_server
– Controller: orchestrates guest/host operations
– Logger/Monitor: logs and optionally reports health metrics
b. Central Proxy Server Components
• proxy_server:
– ServerConnector: accepts incoming client TCP connections
– Controller: authenticates and tracks sessions
– Host/Guest modules: manage packet forwarding logic
– Settings: global config (e.g. port, timeouts)
– Logger/Monitor: collects runtime metrics and logs
– DTOs & Util: serialize/deserialize messages, shared helpers
c. Data Flows
1. Game → lan_agent → LocalConnector (proxy_client)
2. LocalConnector → ServerConnector → over Internet → ServerConnector (proxy_server)
3. ServerController dispatches to other clients’ ServerConnector → their LocalConnector → sandbox → game
d. Architectural Patterns
• Modular library (src/proxy) shared between client & server
• Single‐host central server orchestrator
• Packet forwarding (tunnel/proxy) design
• Separation of concerns: connectors vs. controller vs. utils vs. monitoring