Add support for client-subnet DNS options

This commit is contained in:
世界
2024-02-09 18:37:25 +08:00
parent 36c89165f2
commit 5ffae06bf2
13 changed files with 90 additions and 51 deletions

View File

@@ -3,6 +3,8 @@ package libbox
import (
"sync"
"time"
"github.com/sagernet/sing-box/log"
)
type servicePauseFields struct {
@@ -16,6 +18,7 @@ func (s *BoxService) Pause() {
if s.pauseTimer != nil {
s.pauseTimer.Stop()
log.Debug("pause() reconfigured")
}
s.pauseTimer = time.AfterFunc(time.Minute, s.pause)
@@ -28,6 +31,8 @@ func (s *BoxService) pause() {
s.pauseManager.DevicePause()
_ = s.instance.Router().ResetNetwork()
s.pauseTimer = nil
log.Debug("pause()")
}
func (s *BoxService) Wake() {
@@ -37,9 +42,11 @@ func (s *BoxService) Wake() {
if s.pauseTimer != nil {
s.pauseTimer.Stop()
s.pauseTimer = nil
log.Debug("pause() ignored")
return
}
s.pauseManager.DeviceWake()
_ = s.instance.Router().ResetNetwork()
log.Debug("wake()")
}