refactor: New udpnat

This commit is contained in:
世界 2026-07-16 20:57:59 +08:00
parent d1af8aaf7e
commit 95bc107a1c
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
10 changed files with 1218 additions and 52 deletions

View file

@ -5,7 +5,6 @@ import (
"syscall"
"github.com/sagernet/sing-tun/gtcpip/header"
"github.com/sagernet/sing/common"
)
func PacketIPVersion(packet []byte) int {
@ -14,7 +13,7 @@ func PacketIPVersion(packet []byte) int {
func PacketFillHeader(packet []byte, ipVersion int) {
if PacketOffset > 0 {
common.ClearArray(packet[:3])
clear(packet[:3])
switch ipVersion {
case header.IPv4Version:
packet[3] = syscall.AF_INET