Skip to content

brh55/ip-class

Repository files navigation

ip-class Travis XO code style

Get the IPv4 address class of an ip address for classful networks

Install

$ npm install --save ip-class

Usage

const ipClass = require('ip-class');

ipClass('127.255.255.255');
//=> 'A'

ipClass('191.255.255.255');
//=> 'B'

ipClass('223.255.255.255');
//=> 'C'

ipClass('239.255.255.255');
//=> 'D'

ipClass('255.255.255.254');
//=> 'E'

API

ipClass(ip)

Returns the class of the ip

ip

Type: string

A valid IPv4 address.

Related

min-host-bits - 💻 Calculate minimum host bits needed for desired number of hosts

min-prefix-length - 🔢 Calculate the minimum prefix length for an IPv4 subnet based on a desired number of host

filter-ips - ⛔ Filter a list of IPv4 addresses based on a list of exclusion IPs or addresses containing wildcards.

License

MIT © Brandon Him

About

🔠 Return the classful network class (A, B, C, D, E) of an IPv4 address

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published