chore: add recvmsgx and sendmsgx config to tun

Only for advanced users, enabling `recvmsgx` under darwin can improve performance, but enabling `sendmsgx` may cause unknown problems, please use with caution.
This commit is contained in:
wwqgtxx
2025-07-17 22:37:04 +08:00
parent b9260e06b8
commit 8f18d3f6db
5 changed files with 39 additions and 0 deletions

View File

@@ -100,6 +100,10 @@ type tunSchema struct {
Inet6RouteAddress *[]netip.Prefix `yaml:"inet6-route-address" json:"inet6-route-address,omitempty"`
Inet4RouteExcludeAddress *[]netip.Prefix `yaml:"inet4-route-exclude-address" json:"inet4-route-exclude-address,omitempty"`
Inet6RouteExcludeAddress *[]netip.Prefix `yaml:"inet6-route-exclude-address" json:"inet6-route-exclude-address,omitempty"`
// darwin special config
RecvMsgX *bool `yaml:"recvmsgx" json:"recvmsgx,omitempty"`
SendMsgX *bool `yaml:"sendmsgx" json:"sendmsgx,omitempty"`
}
type tuicServerSchema struct {
@@ -243,6 +247,12 @@ func pointerOrDefaultTun(p *tunSchema, def LC.Tun) LC.Tun {
if p.FileDescriptor != nil {
def.FileDescriptor = *p.FileDescriptor
}
if p.RecvMsgX != nil {
def.RecvMsgX = *p.RecvMsgX
}
if p.SendMsgX != nil {
def.SendMsgX = *p.SendMsgX
}
}
return def
}