finds.dev

magiclvzs/antnet

A game server net framework in Golang go(Golang)游戏服务器网络框架

View on GitHub

★ 523Goupdated Apr 2024

// the take

antnet is a Go networking framework purpose-built for game servers: TCP/UDP/WebSocket transports, a message-queue abstraction over all three, pluggable parsers (protobuf, json, msgpack, cmd-line, raw), and a redis-backed data model. It's aimed at Go developers building a custom game server stack who want to write their own protocol/handler layer on top of a transport library instead of adopting a full engine.

The global/group broadcast path is deliberately designed so each message queue's own goroutine sends independently instead of one dispatcher looping over all connections - this actually uses multiple cores instead of serializing every broadcast through a single blocking send. The redis data model stores protobuf-defined structs as msgpack specifically so individual fields can be mutated via Lua/EVALSHA, then converts to protobuf wire format on the way out to clients - a genuinely useful bridge between flexible storage and a fixed client protocol. The cmd-style parser (reflection + struct tags) gives you telnet-style GM/debug commands against a running server for free, which is a real operational win for game backends. It's been used in production for shipped mobile titles at real scale, so the TCP/UDP connection-close edge cases the author talks about have presumably been exercised.

Almost all documentation - the README and the deeper design rationale - is in Chinese, with the design docs living on Zhihu rather than in the repo; that's a real adoption barrier for a non-Chinese-reading team. The project looks dormant: last push was April 2024 and it reads like a one-person effort, so bug fixes or Go version compatibility issues are unlikely to get prompt attention. The author explicitly flags that the code has intentional unsynchronized reads/writes on shared variables (race detector warnings he says are safe by design) - that's a real liability for anyone who needs to modify this code without the author's full mental model of the invariants. There's no RUDP in the open-sourced core - the author says that's handled per-game in a higher layer - and the 'real' production framework (union) is explicitly closed source, so what you get here is the stripped-down base layer, not the complete battle-tested system those production games actually ran.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
523
Forks
118
Language
Go
Last commit
25 Apr 2024

// nearby

If antnet isn't quite it.

All repos →