mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
add two missing functions to ip (subnet, cidrSubnet)
This commit is contained in:
Vendored
+24
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user