Migrate clashtcpip to gVisor tcpip copied

This commit is contained in:
世界 2024-10-22 15:33:49 +08:00
parent 7f8e556bb0
commit 1793988a6d
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
43 changed files with 7370 additions and 1340 deletions

View file

@ -15,7 +15,7 @@ import (
"io"
"unsafe"
"github.com/sagernet/sing-tun/internal/clashtcpip"
"github.com/sagernet/sing-tun/internal/gtcpip/checksum"
E "github.com/sagernet/sing/common/exceptions"
"golang.org/x/sys/unix"
@ -746,7 +746,7 @@ func handleVirtioRead(in []byte, bufs [][]byte, sizes []int, offset int) (int, e
}
func checksumNoFold(b []byte, initial uint64) uint64 {
return initial + uint64(clashtcpip.Sum(b))
return uint64(checksum.Checksum(b, uint16(initial)))
}
func checksumFold(b []byte, initial uint64) uint16 {