Using go, I would like to obtain the value of some RTF_*
flags, (UGHS) from netstat(1) man page:
G RTF_GATEWAY Destination requires forwarding by intermediary
H RTF_HOST Host entry (net otherwise)
S RTF_STATIC Manually added
U RTF_UP Route usable
Any idea of what syscall/methods could I use to retrieve does values? I see they are declared https://golang.org/pkg/syscall/ but would like to know to use them?
I need this to find the IP of gateways added to the route table, mainly when connecting to VPN's, currently using netstat for this (withing macOS, FreeBSD):
netstat -rna -f inet | grep UGHS | awk '{print $1}'
Any ideas?