TUN inbound: Add FreeBSD support (#5891)

And reverts "refactor `mtu` to support setting IPv4/v6 separately" https://github.com/XTLS/Xray-core/pull/5891#issuecomment-4245677624

And fixes `autoOutboundsInterface` on Windows https://github.com/XTLS/Xray-core/pull/5887#issuecomment-4251719900

---------

Co-authored-by: LjhAUMEM <llnu14702@gmail.com>
This commit is contained in:
Boris Korzun
2026-04-15 15:40:19 +03:00
committed by GitHub
parent ff6126463b
commit 6780045550
10 changed files with 209 additions and 45 deletions
+3 -6
View File
@@ -7,7 +7,7 @@ import (
type TunConfig struct {
Name string `json:"name"`
MTU []uint32 `json:"mtu"`
MTU uint32 `json:"mtu"`
Gateway []string `json:"gateway"`
DNS []string `json:"dns"`
UserLevel uint32 `json:"userLevel"`
@@ -34,11 +34,8 @@ func (v *TunConfig) Build() (proto.Message, error) {
if config.Name == "" {
config.Name = "xray0"
}
if len(config.MTU) == 0 {
config.MTU = []uint32{1500, 1280}
}
if len(config.MTU) == 1 {
config.MTU = append(config.MTU, config.MTU[0])
if config.MTU == 0 {
config.MTU = 1500
}
return config, nil
}