mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-12 20:31:17 +08:00
fix: new tun with fd unneeded calculate interface name
This commit is contained in:
parent
910f236696
commit
f305e440ef
@ -136,9 +136,8 @@ func New(options LC.Tun, tunnel C.Tunnel, additions ...inbound.Addition) (l *Lis
|
||||
options.AutoRedirect = false
|
||||
}
|
||||
tunName := options.Device
|
||||
if tunName == "" || !checkTunName(tunName) {
|
||||
if options.FileDescriptor == 0 && (tunName == "" || !checkTunName(tunName)) {
|
||||
tunName = CalculateInterfaceName(InterfaceName)
|
||||
options.Device = tunName
|
||||
}
|
||||
routeAddress := options.RouteAddress
|
||||
if len(options.Inet4RouteAddress) > 0 {
|
||||
@ -440,6 +439,9 @@ func New(options LC.Tun, tunnel C.Tunnel, additions ...inbound.Addition) (l *Lis
|
||||
|
||||
//l.openAndroidHotspot(tunOptions)
|
||||
|
||||
if options.FileDescriptor != 0 {
|
||||
tunName = fmt.Sprintf("%s(fd=%d)", tunName, options.FileDescriptor)
|
||||
}
|
||||
l.addrStr = fmt.Sprintf("%s(%s,%s), mtu: %d, auto route: %v, auto redir: %v, ip stack: %s",
|
||||
tunName, tunOptions.Inet4Address, tunOptions.Inet6Address, tunMTU, options.AutoRoute, options.AutoRedirect, options.Stack)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user