fix: patch update support tun
This commit is contained in:
@ -23,18 +23,14 @@ import (
|
||||
)
|
||||
|
||||
// New TunAdapter
|
||||
func New(tunConf *config.Tun, dnsConf *config.DNS, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.PacketAdapter) (ipstack.Stack, error) {
|
||||
var tunAddressPrefix string
|
||||
if dnsConf.FakeIPRange != nil {
|
||||
tunAddressPrefix = dnsConf.FakeIPRange.IPNet().String()
|
||||
}
|
||||
func New(tunConf *config.Tun, tunAddressPrefix *netip.Prefix, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.PacketAdapter) (ipstack.Stack, error) {
|
||||
|
||||
var (
|
||||
tunAddress, _ = netip.ParsePrefix(tunAddressPrefix)
|
||||
devName = tunConf.Device
|
||||
stackType = tunConf.Stack
|
||||
autoRoute = tunConf.AutoRoute
|
||||
mtu = 9000
|
||||
tunAddress = netip.Prefix{}
|
||||
devName = tunConf.Device
|
||||
stackType = tunConf.Stack
|
||||
autoRoute = tunConf.AutoRoute
|
||||
mtu = 9000
|
||||
|
||||
tunDevice device.Device
|
||||
tunStack ipstack.Stack
|
||||
@ -42,6 +38,10 @@ func New(tunConf *config.Tun, dnsConf *config.DNS, tcpIn chan<- C.ConnContext, u
|
||||
err error
|
||||
)
|
||||
|
||||
if tunAddressPrefix != nil {
|
||||
tunAddress = *tunAddressPrefix
|
||||
}
|
||||
|
||||
if devName == "" {
|
||||
devName = generateDeviceName()
|
||||
}
|
||||
|
Reference in New Issue
Block a user