Utils (natutils v0.1.0)

Supplies some convenience function to deal with p2p connectivity in ipv4 network.

Summary

Functions

Loads routing table nif based on Netlink socket communication.

Infers local network address in the router network, by connecting to the router and inspecting the socket local IP address.

Returns the public WAN ip address of the router (by having a STUN exchange with google servers).

Returns the equivalent of running "ip r" on a conventional Linux OS.

Returns the router address by inspecting the route table and looking up the default route "via" content.

Functions

Loads routing table nif based on Netlink socket communication.

Link to this function

local_net_ip_addr(router_ip_addr \\ router_ip_addr())

Infers local network address in the router network, by connecting to the router and inspecting the socket local IP address.

Link to this function

public_ip_addr()

Returns the public WAN ip address of the router (by having a STUN exchange with google servers).

Returns the equivalent of running "ip r" on a conventional Linux OS.

Link to this function

router_ip_addr()

Returns the router address by inspecting the route table and looking up the default route "via" content.

The default route and the router gateway are assumed to be unique in the routing table. In other words the networking has to be plain simple: no multihoming.