Fedor just landed it : https://github.com/indutny/node-netroute
Route table bindings for node.js On Mon, Aug 6, 2012 at 8:41 AM, Marak Squires <marak.squi...@gmail.com>wrote: > FYI - Here is my use-case: https://github.com/marak/natman > > I only linked it because the project name is hilarious. > > > On Mon, Aug 6, 2012 at 8:03 AM, Aleksander Adamowski < > aleksander.adamow...@gmail.com> wrote: > >> On Monday, August 6, 2012 1:26:07 PM UTC+2, Ben Noordhuis wrote: >>> >>> I would reject the PR. It's a rather esoteric feature that almost no >>> one needs. Core is not a dumping ground, that's what add-ons are for. >>> :-) >>> >> >> Ben, why would you? >> If core has a function to enumerate network interfaces, then it's only >> logical to also expose the routing table. >> >> Interfaces and the routing table are complementary, sort of like sun and >> moon. >> >> People also need it, as Marak and V1 demonstrate, and their hacks are >> much worse than having a new function in the core API. >> >> >> os.networkRoutes(), perhaps? Like in Marak's GIST: >> https://gist.github.com/3273796#gistcomment-391815 >> >> I can imagine that some telecoms will soon start using Node.JS for near >> real time network signaling software and this will become essential. >> >> >>> Besides, you *can* accomplish this from an add-on. On most Unices, >>> it's a matter of creating a socket of the address family you're >>> interested in (AF_INET, AF_INET6) and calling some ioctls to get the >>> routing table. Windows has a more elaborate API that's documented >>> here[1]. >>> >>> >> On Unices, one can also parse /proc/net/route and it seems to be the way >> some implementations of the "route" shell tool accomplish this: >> >> http://stackoverflow.com/questions/3885746/how-to-determine-using-c-api-the-systems-default-nic >> >> >> >> >