Skip to content

Create a netmask from an IP range #16

Description

@coderholic

This is an awesome module for creating IP ranges from a given netmask, but it'd be even better if it worked in reverse, eg:

coffee> n = new netmask.Netmask('10.0.0.0/24')
{ bitmask: 24,
maskLong: 4294967040,
netLong: 167772160,
size: 256,
base: '10.0.0.0',
mask: '255.255.255.0',
hostmask: '0.0.0.255',
first: '10.0.0.1',
last: '10.0.0.254',
broadcast: '10.0.0.255' }

coffee> n = new netmask.Netmask('10.0.0.1', '10.0.0.254')
{ bitmask: 24,
maskLong: 4294967040,
netLong: 167772160,
size: 256,
base: '10.0.0.0',
mask: '255.255.255.0',
hostmask: '0.0.0.255',
first: '10.0.0.1',
last: '10.0.0.254',
broadcast: '10.0.0.255' }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions