Skip to main content
2025 Python Packaging Survey is now live!  Take the survey now

Port range with support of CIDR-like notation

Project description

port-range

Port range with support of CIDR-like notation.

Last release Unit-tests status Requirements freshness Software license Popularity

Features

Support CIDR-like notation:

>>> from port_range import PortRange
>>> pr = PortRange('1027/15')
>>> pr.port_from
1027
>>> pr.port_to
1028
>>> pr.bounds
(1027, 1028)

Parse and normalize port ranges:

>>> pr = PortRange(' 4242-42 ')
>>> pr.bounds
(42, 4242)
>>> str(pr)
'42-4242'

Access to decimal-representation properties:

>>> pr = PortRange('1027/15')
>>> pr.base
1027
>>> pr.prefix
15
>>> pr.mask
1
>>> pr.offset
3

License

This software is licensed under the BSD 2-Clause License.

ChangeLog

1.0.0 (2014-12-11)

  • Split out port range helpers into its own stand-alone package.

  • First public release.

0.1.0 (2014-02-17)

  • First internal release.

0.0.0 (2014-02-11)

  • First commit.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page