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.
This commit is contained in:
YanceyChiew 2023-09-02 01:14:26 +08:00 committed by Larvan2
parent a366e9a4b5
commit 9feb4d6668
2 changed files with 2 additions and 4 deletions

View file

@ -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,

View file

@ -84,9 +84,7 @@ type Ports struct {
func GetTunConf() LC.Tun {
if tunLister == nil {
return LC.Tun{
Enable: false,
}
return LastTunConf
}
return tunLister.Config()
}