feat: optimize code

This commit is contained in:
fengcaiwen
2023-03-16 19:11:22 +08:00
committed by wencaiwulue
parent a545f3a958
commit 1970f30f9d
13 changed files with 173 additions and 144 deletions

View File

@@ -53,7 +53,7 @@ func SetupDNS(clientConfig *miekgdns.ClientConfig, _ []string) error {
func CancelDNS() {
updateHosts("")
getenv := os.Getenv("luid")
getenv := os.Getenv(config.EnvTunNameOrLUID)
parseUint, err := strconv.ParseUint(getenv, 10, 64)
if err != nil {
log.Warningln(err)
@@ -61,6 +61,7 @@ func CancelDNS() {
}
luid := winipcfg.LUID(parseUint)
_ = luid.FlushDNS(windows.AF_INET)
_ = luid.FlushRoutes(windows.AF_INET)
}
func updateNicMetric(name string) error {