ip-address icon indicating copy to clipboard operation
ip-address copied to clipboard

Address4 support for isLookback()

Open elyscape opened this issue 6 years ago • 2 comments

While it is a common misconception that 127.0.0.1 is the only IPv4 loopback address, the entire 127.0.0.0/8 block is considered loopback. It would be nice if Address4 provided an isLoopback() method as syntactic sugar for address.isInSubnet(new Address4('127.0.0.0/8')).

elyscape avatar Jul 24 '17 19:07 elyscape

@elyscape happy to merge a PR for this one if you'd like to add it! (i will implement it eventually if you don't but it could be a few days); you'd add it to lib/ipv4.js and a corresponding test in test/functionality-v4-test.js

beaugunderson avatar Jul 24 '17 19:07 beaugunderson

An alternate option would be to implement it similarly to how it's implemented in Address6, by implementing address types. IPv4 has link-local, private, and multicast addresses, and it might be a good idea to provide detection of those.

elyscape avatar Jul 24 '17 20:07 elyscape