jackpal / gateway

A golang library for discovering the address of a LAN gateway.
BSD 3-Clause "New" or "Revised" License
226 stars 69 forks source link

Identify default gateway in Linux route file #24

Closed alejandrodnm closed 4 years ago

alejandrodnm commented 4 years ago

When parsing the linux route file /proc/net/route instead of returning the gateway of the first entry on the file, we identify the default gateway as the entry with the Destination 0 and return its IP.