Socket
Socket
Sign inDemoInstall

llibclassification

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    llibclassification

This is a simple library to parse, encode and match IP addresses.


Version published
Maintainers
1
Created

Readme

Source

IPv4/IPv6 Address Library

This is a simple library to parse, encode and match IP addresses.

IPv4 Class

IPv4 Getters

a-d: number

Gets the 1-4'th byte.

binary: number[]

Gets the bytes of the address.

cidr_range: number

Gets the possibly parsed CIDR range.

cidr: boolean

If the address is a CIDR range.

IPv4 Static Methods

decode(raw: string): IPv4Address

Parses the raw IPv4 address (possible CIDR Range) and returns the address.

IPv4 Methods

encode(): string

Encodes the current address (possible CIDR range) to an string.

cidr_match(cidr: IPv4Address): boolean

Checks if the current address is in the given range.

equals(other: IPv4Address): boolean

Checks if the current address quals the other.

IPv6 class

IPv6 Getters

cidr_range

Gets the CIDR range if there.

cidr

Checks if the address is a CIDR range.

pairs

Gets all the IPv6 Pairs (2-byte pairs)

bytes

Gets the bytes array of the address.

Binary

Gets the binary version of the address (128-bit bigint).

IPv6 Static Methods

decode(raw: string): IPv6Address

Decodes the given raw IPv6 address / CIDR range, and returns it as an address class.

IPv6 Method

encode(): string

Encodes the current address to a string.

cidr_match(cidr: IPv6Address): boolean

Checks if the current address is in the given CIDR range.

equals(other: IPv6Address): boolean

Checks if both addresses are equal.

FAQs

Last updated on 01 Apr 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc