mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
add two missing functions to ip (subnet, cidrSubnet)
This commit is contained in:
parent
7bab855ae3
commit
4e752c7705
@ -16,4 +16,6 @@ ip.mask("192.168.0.1", "255.255.255.0");
|
||||
ip.not("255.255.255.0");
|
||||
ip.or("192.168.0.1", "255.255.255.0");
|
||||
var buff:any = ip.toBuffer(myIP);
|
||||
ip.toString(buff);
|
||||
ip.toString(buff);
|
||||
ip.subnet('192.168.1.134', '255.255.255.192');
|
||||
ip.cidrSubnet('192.168.1.134/26');
|
||||
|
||||
24
ip/ip.d.ts
vendored
24
ip/ip.d.ts
vendored
@ -5,6 +5,17 @@
|
||||
|
||||
interface NodeBuffer { }
|
||||
|
||||
interface SubnetInfo {
|
||||
networkAddress: string;
|
||||
firstAddress: string;
|
||||
lastAddress: string;
|
||||
broadcastAddress: string;
|
||||
subnetMask: string;
|
||||
subnetMaskLength: number;
|
||||
numHosts: number;
|
||||
length: number;
|
||||
}
|
||||
|
||||
declare module "ip" {
|
||||
/**
|
||||
* Check two IP address are the same.
|
||||
@ -88,4 +99,17 @@ declare module "ip" {
|
||||
* Convert an IPv4 IP address from its the long numeric value to a string.
|
||||
**/
|
||||
export function fromLong(ip: number): string;
|
||||
|
||||
/**
|
||||
* Get the subnet information.
|
||||
* @param ip IP address.
|
||||
* @param subnet Subnet address.
|
||||
*/
|
||||
export function subnet(ip: string, subnet: string): SubnetInfo;
|
||||
|
||||
/**
|
||||
* Get the subnet information.
|
||||
* @param cidr CIDR address.
|
||||
*/
|
||||
export function cidrSubnet(cidr: string): SubnetInfo;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user