npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iptoolbox

v1.0.2

Published

Some useful Ip and network commands

Downloads

13

Readme

iptoolbox

Some useful Ip and network commands.

const {IP, Network} = require('iptoolbox');

const nw = new Network("192.168.10.10","255.255.255.0");
const nwCidr = Network.fromCidr("192.168.1.10/24"); // Returns Network. Network instance by initializing from CIDR format.
nw.includes(new IP("192.168.10.50")); // Returns Bool. Does the network contain this ip?
nw.nextNetwork(); // Returns Network. Gives next network. For ex; 192.168.10.1 -> 192.168.11.1
nw.preNetwork(); // Returns Network. Gives previous network. For ex; 192.168.10.1 -> 192.168.9.1
nw.ipList // A list containing all of IPs in this network.
nw.cidr // CIDR format of this network
nw.json // JSON formatted network object
Network.validateCidr("192.168.10.1/29") // Returns Boolean. Validates the cidr format is right.

const ip = new IP("192.168.1.2");
ip.in(nw);  // Returns Boolean. Is the IP in this network?
ip.toBinary(); // Returns String. Converts IP into binary format. For ex; 192.168.1.2 -> 11000000101010000000000100000010
IP.bin2Ip("11000000101010000000000100000010") // Returns IP. Converts binary into IP format. For ex; 11000000101010000000000100000010 -> 192.168.1.2
ip.and(new IP("255.255.255.0")) // Returns IP. Makes logical and operation with another ip. Usefull for calculation network address.
ip.nextIp(); // Returns IP. Gives next network ip. For ex; 192.168.1.2 -> 192.168.1.3
ip.preIp(); // Returns IP. Gives previous network ip. For ex; 192.168.1.2 -> 192.168.1.1
ip.distance(new IP("192.168.1.10")) // Returns Number. Gives how many ip between two address.
ip.type // Returns JSON Object. Gives type of the address. For ex; private, public
IP.validateIp("192.168.1.67") // Returns Boolean. Validates the ip format is right.
await ip.ping(); // Returns String. Gives ping result of the ip.
await ip.pingable(); // Returns Boolean. Gives ip is pingable.
await ip.portOpen(80) // Returns Boolean. Gives port is reachable on this ip.