Using Go what package, native function, syscall could be used to obtain the default gateway on a *nix system
I would like to avoid creating a wrapper arround netstat, route, ip, etc commands, or read, parse an existing file, the idea is to obtain the values the most os/platform agnostic way posible.
For example this is the output of the route command:
$ route -n get default
route to: default
destination: default
mask: default
gateway: 192.168.1.1
interface: en1
flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
0 0 0 0 0 0 1500 0
I would like to do something simliar in order to just print/obtain the gateeway address/interface.