Зеркало Leadaxe/sing-tun-lx — сабмодуль ядра sing-box-lx. GPLv3.
Upstream acceptLoop treats any Accept error as terminal and silently returns, leaving the stack alive but every new TCP SYN NAT-rewritten onto a dead port (instant RST) until a full restart. When the listener fd is closed out from under the stack (a stray close on a reused fd number from another runtime in the same process), all new TCP dies forever while UDP/QUIC/DNS keep working. - System.Close() now marks a deliberate shutdown first; acceptLoop still exits quietly on it. - Any other Accept error is logged (the errno names the killer path), the listener is recreated on the same address, the forwarder port is republished atomically, and the loop keeps serving. - If the rebind fails, the loop logs an error and gives up - no worse than upstream. - acceptRecoveries counter is kept as telemetry. tcpPort/tcpPort6 become atomic (written by the heal path, read from the tunLoop dispatch/NAT path); listener replacement is serialized against Close() with a mutex. |
||
|---|---|---|
| .github | ||
| gtcpip | ||
| internal | ||
| ping | ||
| .gitignore | ||
| .golangci.yml | ||
| flow.go | ||
| flow_dispatch.go | ||
| flow_dns.go | ||
| flow_mtu.go | ||
| flow_nat.go | ||
| flow_parse.go | ||
| flow_reject.go | ||
| flow_rewrite.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| monitor.go | ||
| monitor_android.go | ||
| monitor_darwin.go | ||
| monitor_linux.go | ||
| monitor_linux_default.go | ||
| monitor_other.go | ||
| monitor_shared.go | ||
| monitor_windows.go | ||
| netns_linux.go | ||
| netns_other.go | ||
| nfqueue_linux.go | ||
| packages.go | ||
| packages_android.go | ||
| packages_stub.go | ||
| README.md | ||
| redirect.go | ||
| redirect_iptables.go | ||
| redirect_linux.go | ||
| redirect_nftables.go | ||
| redirect_nftables_docker.go | ||
| redirect_nftables_exprs.go | ||
| redirect_nftables_rules.go | ||
| redirect_nftables_rules_openwrt.go | ||
| redirect_route_linux.go | ||
| redirect_server.go | ||
| redirect_stub.go | ||
| stack.go | ||
| stack_gvisor.go | ||
| stack_gvisor_filter.go | ||
| stack_gvisor_icmp.go | ||
| stack_gvisor_lazy.go | ||
| stack_gvisor_log.go | ||
| stack_gvisor_stub.go | ||
| stack_gvisor_tcp.go | ||
| stack_gvisor_tcp_conn.go | ||
| stack_gvisor_tcpbuf_default.go | ||
| stack_gvisor_tcpbuf_ios.go | ||
| stack_gvisor_udp.go | ||
| stack_mixed.go | ||
| stack_system.go | ||
| stack_system_nat.go | ||
| stack_system_nonwindows.go | ||
| stack_system_packet.go | ||
| stack_system_selfheal_test.go | ||
| stack_system_windows.go | ||
| tun.go | ||
| tun_darwin.go | ||
| tun_darwin_gvisor.go | ||
| tun_linux.go | ||
| tun_linux_flags.go | ||
| tun_linux_gvisor.go | ||
| tun_nondarwin.go | ||
| tun_nonlinux.go | ||
| tun_offload.go | ||
| tun_offload_errors.go | ||
| tun_offload_linux.go | ||
| tun_other.go | ||
| tun_rules.go | ||
| tun_windows.go | ||
| tun_windows_gvisor.go | ||
| udp_egress.go | ||
| udp_egress_conn.go | ||
| udp_nat.go | ||
| udp_nat_cleanup.go | ||
sing-tun
Simple transparent proxy library.
For Linux, Windows, macOS and iOS.
License
Copyright (C) 2022 by nekohasekai <contact-sagernet@sekai.icu>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.