*(home): fixed issues with setting static IP on Mac

This commit is contained in:
Andrey Meshkov
2020-02-13 16:47:30 +03:00
5 changed files with 57 additions and 36 deletions

View File

@@ -43,8 +43,7 @@ func SetStaticIP(ifaceName string) error {
}
if runtime.GOOS == "darwin" {
return fmt.Errorf("cannot do that")
// return setStaticIPDarwin(ifaceName)
return setStaticIPDarwin(ifaceName)
}
return fmt.Errorf("Cannot set static IP on %s", runtime.GOOS)
@@ -190,7 +189,7 @@ func setStaticIPDarwin(ifaceName string) error {
}
args := make([]string, 0)
args = append(args, "-setdnsservers")
args = append(args, "-setdnsservers", portInfo.name)
args = append(args, dnsAddrs...)
// Setting DNS servers is necessary when configuring a static IP