-
Notifications
You must be signed in to change notification settings - Fork 64
Added TCP support to vnet #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #375 +/- ##
==========================================
- Coverage 84.67% 83.01% -1.67%
==========================================
Files 38 41 +3
Lines 3074 3756 +682
==========================================
+ Hits 2603 3118 +515
- Misses 339 446 +107
- Partials 132 192 +60
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
25aba74 to
fb434b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds TCP support to the vnet package, implementing virtual TCP connections, listeners, NAT translation, and comprehensive test coverage. The implementation includes TCP connection state machine, handshake logic, data transfer with ACK mechanism, and integration with the existing virtual network infrastructure.
Changes:
- Added TCP connection (
TCPConn) and listener (TCPListener) implementations with full handshake and state management - Extended NAT to support TCP translation for both NAPT and 1:1 NAT modes
- Added comprehensive test coverage for TCP functionality including connection tests, NAT behavior tests, and integration tests
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| vnet/tcp_conn.go | Core TCP connection implementation with state machine, handshake, read/write operations |
| vnet/tcp_listener.go | TCP listener implementation for accepting incoming connections |
| vnet/tcp_map.go | Port mapping structures for TCP listeners and connections |
| vnet/tcp_test.go | Integration test for TCP dial/listen functionality |
| vnet/tcp_conn_test.go | Unit tests for TCP connection behavior |
| vnet/tcp_nat_test.go | Comprehensive NAT behavior tests for TCP |
| vnet/tcp_map_test.go | Unit tests for TCP mapping structures |
| vnet/net.go | Extended Net to support TCP operations, added constants and routing logic |
| vnet/nat.go | Extended NAT translator to support TCP in addition to UDP |
| vnet/chunk.go | Enhanced TCP chunk structure with sequence/ACK numbers |
| vnet/net_test.go | Added TCP loopback and dial tests |
| vnet/chunk_test.go | Updated test to use tcp constant |
| vnet/errors.go | Added nolint directive for single-use function |
| vnet/udpproxy_direct_test.go | Updated to use network constants instead of string literals |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1078635 to
29d1733
Compare
Added TCP support to vnet. Github Copilot/GPT-5.2 did a good job :)
Ref: #27