feat: RESTful API support disable sniffer

This commit is contained in:
adlyq
2022-05-24 12:43:26 +08:00
parent c0eb9aac1c
commit 149b4b5b43
5 changed files with 35 additions and 16 deletions

View File

@ -119,6 +119,8 @@ func GetGeneral() *config.General {
IPv6: !resolver.DisableIPv6,
GeodataLoader: G.LoaderName(),
Tun: P.GetTunConf(),
Interface: dialer.DefaultInterface.Load(),
Sniffing: tunnel.IsSniffing(),
}
return general

View File

@ -36,6 +36,7 @@ type configSchema struct {
Mode *tunnel.TunnelMode `json:"mode"`
LogLevel *log.LogLevel `json:"log-level"`
IPv6 *bool `json:"ipv6"`
Sniffing *bool `json:"sniffing"`
}
func getConfigs(w http.ResponseWriter, r *http.Request) {
@ -67,6 +68,10 @@ func patchConfigs(w http.ResponseWriter, r *http.Request) {
P.SetBindAddress(*general.BindAddress)
}
if general.Sniffing != nil {
tunnel.SetSniffing(*general.Sniffing)
}
ports := P.GetPorts()
tcpIn := tunnel.TCPIn()