Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/netmask

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/netmask

TypeScript definitions for netmask

  • 2.0.5
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Installation

npm install --save @types/netmask

Summary

This package contains type definitions for netmask (https://github.com/rs/node-netmask).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/netmask.

index.d.ts

/**
 * converts long to an ip address
 */
export function long2ip(long: number): string;
/**
 * converts ip address to long
 */
export function ip2long(ip: string): number;

export class Netmask {
    /**
     * The base address of the network block as a string (eg: 216.240.32.0). Base does not give an indication of the size of the network block.
     */
    base: string;
    /**
     * The netmask as a string (eg: 255.255.255.0).
     */
    mask: string;
    /**
     * The netmask as a number of bits in the network portion of the address for this block (eg: 24).
     */
    bitmask: number;
    /**
     * The host mask which is the opposite of the netmask (eg: 0.0.0.255).
     */
    hostmask: string;
    /**
     * The blocks broadcast address (eg: 192.168.1.0/24 => 192.168.1.255)
     */
    broadcast: string;
    /**
     * The number of IP addresses in a block (eg: 256).
     */
    size: number;
    /**
     * First useable address
     */
    first: string;
    /**
     * Last useable address
     */
    last: string;

    maskLong: number;
    netLong: number;

    /**
     * Returns a true if the IP number ip is part of the network. That is, a true value is returned if ip is between base and broadcast.
     * If a Netmask object or a block is given, it returns true only of the given block fits inside the network.
     */
    contains(address: string | Netmask | number): boolean;
    /**
     * Similar to the Array prototype method. It loops through all the useable addresses, ie between first and last.
     */
    forEach(cb: (ip: string, long: number, index: number) => void): void;
    /**
     * Without a count, return the next block of the same size after the current one. With a count, return the Nth block after the current one.
     * A count of -1 returns the previous block. Undef will be returned if out of legal address space.
     */
    next(count?: number): Netmask;
    /**
     * The netmask in base/bitmask format (e.g., '216.240.32.0/24')
     */
    toString(): string;

    /**
     * @param net A network - e.g 216.240.32.0/24
     * @param mask - optional netmask if not provided in `net`
     */
    constructor(net: string, mask?: string | number);
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by Matt Frantz, JanST123, and Junxiao Shi.

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc