Refactor: use native Win32 API to detect interface changed on Windows

This commit is contained in:
yaling888
2022-05-28 09:50:09 +08:00
parent 67905bcf7e
commit 985dc99b5d
8 changed files with 262 additions and 76 deletions

View File

@@ -18,10 +18,21 @@ var StackTypeMapping = map[string]TUNStack{
const (
TunGvisor TUNStack = iota
TunSystem
TunDisabled TUNState = iota
TunEnabled
TunPaused
)
type TUNStack int
type TUNState int
type TUNChangeCallback interface {
Pause()
Resume()
}
// UnmarshalYAML unserialize TUNStack with yaml
func (e *TUNStack) UnmarshalYAML(unmarshal func(any) error) error {
var tp string