Return types of os:type/0 and default route discovery
zxq9
zxq9@REDACTED
Fri Feb 5 08:16:55 CET 2021
On 2021/02/05 16:03, zxq9 wrote:
> default_iface({Family, Name} ->
> %...?
I've been made aware of this in the OTP code:
https://github.com/erlang/otp/blob/ed4bc369fe6724083bd0decac961fb7b3462d202/lib/kernel/test/kernel_test_lib.erl?ts=2#L86
{unix, linux}
{unix, openbsd}
{unix, freebsd}
{unix, netbsd}
{unix, darwin}
{unix, sunos}
{win32, nt}
This isn't comprehensive, but it's probably good enough to solve the 90%
problem.
With that in mind...
What commands are the equivalent to `ip route get 8.8.8.8` on Linux
or `route -4` on Windows 10?
Both of those give me the default route, the default gateway, the
default interface and the default interface's address and subnet (or a
way I can get at all of those).
If I can just discover the default interface I can get the rest sorted
out from information in inet:getifaddrs/0.
-Craig
More information about the erlang-questions
mailing list