Improve darwin tun performance

This commit is contained in:
世界 2025-07-02 19:16:14 +08:00
parent 8763c24e49
commit a0881ada32
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
16 changed files with 1894 additions and 159 deletions

7
tun.go
View file

@ -8,6 +8,7 @@ import (
"strconv"
"strings"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/control"
F "github.com/sagernet/sing/common/format"
"github.com/sagernet/sing/common/logger"
@ -45,6 +46,12 @@ type LinuxTUN interface {
TXChecksumOffload() bool
}
type DarwinTUN interface {
Tun
BatchRead() ([]*buf.Buffer, error)
BatchWrite(buffers []*buf.Buffer) error
}
const (
DefaultIPRoute2TableIndex = 2022
DefaultIPRoute2RuleIndex = 9000