Re: Return types of os:type/0 and default route discovery

zxq9 <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.