util/net/gateway/gateway_darwin.go

17 lines
259 B
Go
Raw Normal View History

2017-09-11 09:59:00 +00:00
package gateway
import (
"net"
"os/exec"
)
func DiscoverGateway() (net.IP, string, error) {
routeCmd := exec.Command("netstat", "-rn")
output, err := routeCmd.CombinedOutput()
if err != nil {
return nil, err
}
return parseDarwinRouteGet(output)
}