package gateway import ( "log" "net" "os/exec" ) func DiscoverGateway() (ip net.IP, iface string, err error) { output, err := exec.Command("cmd.exe", "/C", "chcp 437 && route print 0.0.0.0").CombinedOutput() if err != nil { panic(err) } log.Println(string(output)) if err != nil { return nil, "", err } return parseWindowsRoutePrint(output) }