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
init()
Loads routing table nif based on Netlink socket communication.
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.
public_ip_addr()
Returns the public WAN ip address of the router (by having a STUN exchange with google servers).
route_table()
Returns the equivalent of running "ip r" on a conventional Linux OS.
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.