A TCP server framework for Go with graceful shutdown and custom protocol support.
xtcp is a TCP server framework for Go that simplifies building network servers with custom protocols and graceful shutdown capabilities. It provides a structured way to handle connections, send/receive data, and manage server lifecycle events. The framework solves the problem of implementing reliable TCP communication with tailored data formats without reinventing low-level networking logic.
Go developers building custom TCP servers, network services, or applications requiring specific binary protocols. It's suitable for those who need fine-grained control over packet handling and connection management.
Developers choose xtcp for its clean separation of protocol definition and event handling, built-in graceful shutdown options, and thread-safe sending. It offers a balance between flexibility and structure, avoiding the complexity of raw socket programming while not imposing rigid conventions.
A TCP Server Framework with graceful shutdown, custom protocol.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides three distinct stop modes (immediate, graceful without wait, graceful with wait) to ensure data integrity during server termination, as detailed in the README.
Allows defining any packet format via the Protocol interface, enabling tailored communication for specific needs without imposing rigid conventions.
Notifies handlers on key events (accept, connected, receive, closed), making it straightforward to implement custom logic for connection lifecycle management.
The Send method is safe to call from any goroutine, simplifying concurrent data transmission without manual synchronization.
Logging is disabled by default and requires implementing a custom logger interface, which complicates debugging and monitoring out of the box.
Every project must implement the Protocol and Handler interfaces from scratch, adding boilerplate code even for simple or common protocol use cases.
Lacks community plugins or extensions for features like encryption, compression, or connection pooling, forcing developers to build these themselves.