You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7 lines
332 B
7 lines
332 B
export function convertIntToIpAddress(int: number): string {
|
|
return `${int & 0xff}.${(int >> 8) & 0xff}.${(int >> 16) & 0xff}.${(int >> 24) & 0xff}`;
|
|
}
|
|
|
|
export function convertIpAddressToInt(ip: string): number | null {
|
|
return ip.split('.').reverse().reduce((ipnum, octet) => { return (ipnum<<8) + parseInt(octet)}, 0) >>> 0;
|
|
}
|
|
|