fix: RESTful API empty tun device name
This commit is contained in:
parent
0fdcd0f5d4
commit
54434df43f
2 changed files with 4 additions and 3 deletions
|
@ -363,7 +363,7 @@ func ReCreateTun(tunConf *config.Tun, tcpIn chan<- C.ConnContext, udpIn chan<- *
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tunLister, err = sing_tun.New(*tunConf, tcpIn, udpIn)
|
tunLister, err = sing_tun.New(tunConf, tcpIn, udpIn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReCreateRedirToTun(ifaceNames []string) {
|
func ReCreateRedirToTun(ifaceNames []string) {
|
||||||
|
|
|
@ -65,10 +65,11 @@ func CalculateInterfaceName(name string) (tunName string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(options config.Tun, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.PacketAdapter) (l *Listener, err error) {
|
func New(options *config.Tun, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.PacketAdapter) (l *Listener, err error) {
|
||||||
tunName := options.Device
|
tunName := options.Device
|
||||||
if tunName == "" {
|
if tunName == "" {
|
||||||
tunName = CalculateInterfaceName(InterfaceName)
|
tunName = CalculateInterfaceName(InterfaceName)
|
||||||
|
options.Device = tunName
|
||||||
}
|
}
|
||||||
tunMTU := options.MTU
|
tunMTU := options.MTU
|
||||||
if tunMTU == 0 {
|
if tunMTU == 0 {
|
||||||
|
@ -121,7 +122,7 @@ func New(options config.Tun, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.P
|
||||||
}
|
}
|
||||||
l = &Listener{
|
l = &Listener{
|
||||||
closed: false,
|
closed: false,
|
||||||
options: options,
|
options: *options,
|
||||||
handler: handler,
|
handler: handler,
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
Loading…
Reference in a new issue