gnet
Networking Frameworkgnet
is a high-performance, lightweight, non-blocking, event-driven networking framework developed in Go. It is designed to serve as an alternative for performance-critical network services within the Go ecosystem. Created by Andy Pan and hosted on GitHub under the repository panjf2000/gnet, it is licensed under the Apache License 2.0. The framework utilizes system-specific optimizations like epoll
on Linux and kqueue
on BSD-like systems to achieve high performance and scalability. It supports multiple protocols including TCP, UDP, and Unix Domain Sockets, enabling developers to build diverse network applications such as HTTP servers or Redis servers by implementing respective protocols atop gnet
. The project has been recognized for its performance, consistently topping benchmark rankings against other Go networking frameworks.
gnet
, managing pull requests and issues, and updating documentation and benchmarks.The development team led by Andy Pan demonstrates strong commitment to maintaining and enhancing gnet
. Activities primarily revolve around optimizing features, refining the codebase, updating documentation, and managing community contributions through pull requests and issues. The use of GitHub Actions for automated deployments highlights an efficient workflow that keeps project artifacts like websites synchronized with repository changes.
gnet
continues to evolve with significant input from its main maintainer and contributions from the community. The focus remains on enhancing performance, expanding features like protocol support, and maintaining robust documentation and benchmarks. This ongoing development effort positions gnet
as a reliable choice for developers looking to implement high-performance network services using Go.
gnet
server.gnet.Conn
.kevent
function calls on FreeBSD 11.2.SO_BINDTODEVICE
.gnet
, modifying the Go standard TLS library to be non-blocking.github.com/0-haha/gnet_go_tls
.Recommendation: 1. Prioritize the review and integration of TLS support (PR #565), ensuring it meets security and performance standards. 2. Resolve any outstanding CI issues and ensure all new features are fully tested across supported platforms. 3. Consider closing older, superseded pull requests (like PR #435) to clean up the project backlog and focus on current implementations.
The codebase is well-organized with clear separation of concerns, evident from structuring into different files for different functionalities (e.g., /listener_unix.go
, /engine_unix.go
, /poller_kqueue_ultimate.go
). Conditional compilation directives ensure that only relevant code is compiled per platform.
kqueue
.Overall, the project adheres to high standards of code quality with a strong emphasis on performance optimization, concurrency handling, and robustness. Documentation within the codebase is adequate but could be enhanced to better describe complex logic and internal APIs.
Developer | Avatar | Branches | PRs | Commits | Files | Changes |
---|---|---|---|---|---|---|
gh-actions | 1 | 0/0/0 | 7 | 239 | 5570 | |
Andy Pan | 2 | 14/14/0 | 26 | 78 | 4329 | |
Gabor Lekeny (leki75) | 0 | 0/0/1 | 0 | 0 | 0 |
PRs: created by that dev and opened/merged/closed-unmerged during the period
gnet
is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go. It is designed to offer an alternative for performance-critical network services within the Go ecosystem. The project was created by Andy Pan and is hosted on GitHub under the repository panjf2000/gnet. It is licensed under the Apache License 2.0.
The framework leverages system-specific optimizations such as epoll
on Linux and kqueue
on BSD-like systems to achieve high performance and scalability. It supports multiple protocols like TCP, UDP, and Unix Domain Sockets, allowing developers to build various network applications like HTTP servers or Redis servers by implementing the respective protocols on top of gnet
.
As of the latest updates, gnet
has been actively maintained with regular updates and contributions from the community. The project has received significant recognition for its performance, topping benchmark rankings against other Go networking frameworks.
gnet
.The development team led by Andy Pan shows a strong commitment to maintaining and enhancing gnet
. The majority of recent activity revolves around optimizing existing features, refining codebases, updating documentation, and managing community contributions through pull requests and issues. The use of GitHub Actions to automate deployments highlights an efficient workflow that keeps project artifacts like websites synchronized with repository changes.
The frequent updates and attention to detail in handling issues and pull requests suggest a healthy, active project environment. Andy Pan’s role is pivotal not only in direct code contributions but also in steering the project’s direction by reviewing and integrating community contributions.
gnet
continues to evolve with significant input from its main maintainer and contributions from the community. The focus remains on enhancing performance, expanding features like protocol support, and maintaining robust documentation and benchmarks. This ongoing development effort positions gnet
as a reliable choice for developers looking to implement high-performance network services using Go.
panjf2000/gnet
RepositoryIssue #565: feat: support TLS server
gnet
server, which is a significant feature addition. The discussion includes modifications to the Go standard library's TLS package to support non-blocking operations.Issue #557: [Feature]: add synchronization for Conn to make it concurrency-safe
gnet.Conn
to make its methods concurrency-safe, potentially using a sync.Locker
.Issue #552: [Question]: gnet engine is stopping with error: kevent add|clear:function not implemented
kevent
function calls on FreeBSD 11.2, suggesting a compatibility or implementation issue with kqueue.Issue #534: [Feature]: Can this be part of the roadmap for practical use case as top priority. tls / ktls support first.
Issue #532: [Feature]: Support for SO_BINDTODEVICE?
SO_BINDTODEVICE
, which is crucial for certain network applications.Issue #595: [Bug]: example gnet for echo tcp uses too much memory
Issue #594: patch: v2.5.1
panjf2000/gnet
Repositorydev
, targeting dev
.gnet
, modifying the Go standard TLS library to be non-blocking. This PR is a significant feature addition, providing TLS capabilities which were previously marked as a future enhancement in the project's README.dev
, targeting dev
.github.com/0-haha/gnet_go_tls
. This PR seems to have been superseded by newer attempts (e.g., PR #565).go.mod
.dev
to master
.dev
.dev
.The repository is actively managed with frequent updates and patches. The major ongoing effort is towards integrating TLS support into gnet
, with multiple pull requests opened over time addressing this feature. The recent focus on platform compatibility and code optimization indicates a move towards stabilizing the framework across various environments.
Recommendation: 1. Prioritize the review and integration of TLS support (PR #565), ensuring it meets security and performance standards. 2. Resolve any outstanding CI issues and ensure all new features are fully tested across supported platforms. 3. Consider closing older, superseded pull requests (like PR #435) to clean up the project backlog and focus on current implementations.
This pull request introduces TLS support to the gnet
networking framework, a significant enhancement for secure communication. The changes involve modifying the Go standard library's TLS package to support non-blocking operations, particularly during the TLS handshake process. This adaptation is crucial for gnet
, which is designed around non-blocking, event-driven architecture.
Modification of the TLS Library: The PR includes a "magically modified" version of the Go standard TLS library to handle non-blocking operations. This involves:
Integration with gnet
:
tlsConn
and tlsEventHandler
which wrap the standard gnet.Conn
and EventHandler
to handle TLS operations.WithTLSConfig
in engine options to enable TLS configurations easily.Testing and Validation:
gnet
server with TLS and use a standard Go TLS client to verify the handshake and data encoding/decoding processes.gnet
architecture by extending current interfaces and classes rather than restructuring major components, which minimizes the risk of introducing bugs.The PR #565 is a substantial contribution to the gnet
project, introducing TLS support which is crucial for secure communications in network applications. The changes are well-integrated with the existing codebase and accompanied by necessary tests. However, given the complexity of the changes, particularly around modifying low-level TLS functionalities, a thorough review by domain experts is recommended before merging. Additionally, resolving CI issues will ensure that the new code adheres to the project's quality standards.
This pull request (PR) aims to introduce Transport Layer Security (TLS) support into the gnet
networking library. The changes involve integrating TLS functionality that allows gnet
to handle secure communications over its existing non-blocking, event-driven architecture. The implementation leverages an external library specifically designed for different Go versions, starting with Go 1.20.
The PR introduces significant changes to several core components of the gnet
library:
TLS Integration in Core Components:
acceptor_unix.go
and connection_unix.go
to integrate TLS handshake and data handling mechanisms.UpgradeTLS
, writeTLS
, and readTLS
are added to manage TLS connections.External TLS Library Usage:
github.com/0-haha/gnet-tls-go1-20
) tailored for Go 1.20 to handle the specifics of TLS, including configurations and cipher suites.gnet
library, facilitating easier updates and maintenance.Kernel TLS Support:
Configuration and API Changes:
Options
structure to include TLSconfig
, which holds the configuration for TLS connections.Error Handling and Optimization:
Clarity and Maintainability: The code modifications and additions are structured logically. The use of an external library for handling different Go versions is a strategic choice that enhances maintainability. However, the complexity of integrating TLS into a high-performance networking library like gnet
inherently increases the cognitive load for future maintenance.
Documentation and Comments: The PR includes comments explaining critical changes, especially around complex operations like buffer management and kernel offloading. However, some parts of the code could benefit from more detailed comments explaining the rationale behind specific decisions.
Testing and Reliability: The PR description does not explicitly mention new tests for the added TLS functionality. Ensuring robust test coverage is crucial, especially for security features like TLS.
Performance: By offloading encryption tasks to kTLS when available, the PR potentially improves performance. However, benchmarking results would be necessary to quantify performance gains under various conditions.
The PR #435 represents a significant enhancement for gnet
, introducing TLS support to enable secure communications. The use of an external library for handling different Go versions is a commendable approach that could facilitate easier updates and compatibility adjustments. However, thorough testing, documentation, and possibly simplifying some parts of the implementation would be essential steps before merging this PR into the production codebase.
gnet
project is a high-performance, event-driven networking framework written in Go, leveraging system-specific optimizations through epoll
and kqueue
.listener_unix.go
, engine_unix.go
, poller_kqueue_ultimate.go
).// +build
) directives ensures that only relevant code is compiled per platform, which is crucial for maintaining performance across different operating systems./listener_unix.go
sync.Once
) to ensure thread-safe operations.close()
method where file descriptors are closed and potential errors are logged.unix.Close
) directly indicates a deep integration with the underlying OS for performance reasons./gnet.go
/engine_unix.go
eventLoops
, listeners
, and worker pools demonstrates a well-thought-out architecture focusing on concurrency and scalability./internal/netpoll/poller_kqueue_ultimate.go
kqueue
for BSD variants including macOS.Overall, the gnet
project's source code reflects a sophisticated understanding of both Go programming practices and network-level optimizations necessary for high-performance server applications.