Repository navigation
Conversation
Co-authored-by: RPRX <[email protected]>
Co-authored-by: RPRX <[email protected]>
@yuhan6665 @Fangliding @LjhAUMEM @Meo597 @yiguodev @KobeArthurScofield 来测测性能有没有提升 |
|
我怀疑这个 PR 现在的代码仍未将“减少 copy 次数”做到极致,此外还看到大量对 gVisor 组件的引用,这些引用也得去掉 话说在群里看到 @Fangliding 说在搓 SS2022,你那个这几天能 PR 吗, |
|
link #6399 |
他这个 PR 的“system”指的是交给操作系统解析还是自己写的 TCP/IP 栈, |
|
就是天天和gvisor对标的那个system stack而已 他还标个 "lightweight userspace TCP/IP stack" 估计还是经典的vibe到不知道自己在说啥 还带了一堆有的没的其他东西 |
|
|
|
oh no, rprx using ai... |
|
Windows Server 2012 R2 能用 |
|
@4RH1T3CT0R7 我看到你近期有几个 PR 被 close 了,你 |
|
ok, tun is on me |
|
|
gVisor's
stack.Stackis a general-purpose TCP/IP implementation built for a lossy, reordering public network (congestion control, SACK/RACK, retransmission timers, extra copies). TUN traffic instead flows over a local kernel↔userspace channel that neither drops nor reorders packets, so that generality is pure overhead. This adds an optional, purpose-built stack for TUN that drops the unneeded machinery in exchange for less complexity and fewer copies.Backend selection
stackconfig option (proxy/tun/config.proto,infra/conf/tun.go):"gvisor"(default, unchanged behavior) or"system"(new).proxy/tun/stack.go:NewStack()dispatches onStackOptions.Backend;stack_gvisor.gois otherwise untouched (renamed constructor only).New "system" stack (
proxy/tun/stack_system.go,stack_system_tcp.go)GVisorDeviceinterface (now also implemented for this path intun_linux.go/tun_android.go), bypassing gVisor's NIC/routing/stack.Stacklayer entirely.udpConnectionHandler/tun/icmphandlers as-is — that code was already backend-agnostic.net.ConnRead/Write(neverReadMultiBuffer/WriteMultiBuffer) sostat.CounterConnection's byte accounting inhandler.goisn't silently bypassed.Tests
proxy/tun/stack_system_test.goexercises the new stack against a fake in-memoryGVisorDevice: full handshake + bidirectional echo + graceful close, retransmission on a dropped segment, and idle-connection reaping.Example
{ "inbounds": [{ "protocol": "tun", "settings": { "stack": "system" } }] }