From 9feb4d666809eb64dfdb17376bdd918146c373fc Mon Sep 17 00:00:00 2001 From: YanceyChiew <35898533+YanceyChiew@users.noreply.github.com> Date: Sat, 2 Sep 2023 01:14:26 +0800 Subject: [PATCH] fix: RESTful api missing TunConf.device In commit 54fee7b, due to failure to take into account that not all required parameters of `sing_tun.server.New` have default values provided by `LC.Tun`, the name of the tun device cannot be obtained when `TunConf.device` is not explicitly configured. This commit fixed the issue. --- hub/executor/executor.go | 2 +- listener/listener.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hub/executor/executor.go b/hub/executor/executor.go index d5ca4afb..8cb8358f 100644 --- a/hub/executor/executor.go +++ b/hub/executor/executor.go @@ -134,7 +134,7 @@ func GetGeneral() *config.General { RedirPort: ports.RedirPort, TProxyPort: ports.TProxyPort, MixedPort: ports.MixedPort, - Tun: listener.LastTunConf, + Tun: listener.GetTunConf(), TuicServer: listener.GetTuicConf(), ShadowSocksConfig: ports.ShadowSocksConfig, VmessConfig: ports.VmessConfig, diff --git a/listener/listener.go b/listener/listener.go index 7b513fa7..a340d3a2 100644 --- a/listener/listener.go +++ b/listener/listener.go @@ -84,9 +84,7 @@ type Ports struct { func GetTunConf() LC.Tun { if tunLister == nil { - return LC.Tun{ - Enable: false, - } + return LastTunConf } return tunLister.Config() }