chore: tuic-server support restful api patch

This commit is contained in:
wwqgtxx
2022-11-28 18:53:09 +08:00
parent 4b1d4a3e20
commit 01e382285d
3 changed files with 63 additions and 6 deletions

View File

@ -64,7 +64,8 @@ var (
autoRedirMux sync.Mutex
tcMux sync.Mutex
LastTunConf config.Tun
LastTunConf config.Tun
LastTuicConf config.TuicServer
)
type Ports struct {
@ -88,6 +89,13 @@ func GetTunConf() config.Tun {
return tunLister.Config()
}
func GetTuicConf() config.TuicServer {
if tuicListener == nil {
return config.TuicServer{Enable: false}
}
return tuicListener.Config()
}
func AllowLan() bool {
return allowLan
}
@ -395,7 +403,10 @@ func ReCreateUdpTun(config string, tcpIn chan<- C.ConnContext, udpIn chan<- *inb
func ReCreateTuic(config config.TuicServer, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.PacketAdapter) {
tuicMux.Lock()
defer tuicMux.Unlock()
defer func() {
LastTuicConf = config
tuicMux.Unlock()
}()
shouldIgnore := false
var err error