Skip to content

Commit a3b2518

Browse files
committed
Continue to reorganize source.
1 parent 6febe6d commit a3b2518

9 files changed

Lines changed: 633 additions & 594 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.pyc
2+
.coverage
23
.venv
34
build
45
dist

docs/index.rst

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,69 @@
1-
.. python-iptools documentation master file, created by
2-
sphinx-quickstart on Thu May 24 18:28:05 2012.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
1+
==============================
2+
iptools - IP Address Utilities
3+
==============================
54

6-
iptools's documentation
7-
=======================
5+
Utilities for dealing with IPv4 addresses.
6+
7+
:Functions:
8+
- :func:`cidr2block`: Convert a CIDR notation ip address into a tuple
9+
containing network block start and end addresses.
10+
- :func:`hex2ip`: Convert a hex encoded network byte order 32-bit
11+
integer to a dotted-quad ip address.
12+
- :func:`ip2hex`: Convert a dotted-quad ip address to a hex encoded
13+
network byte order 32-bit integer.
14+
- :func:`ip2long`: Convert a dotted-quad ip address to a network byte
15+
order 32-bit integer.
16+
- :func:`ip2network`: Convert a dotted-quad ip to base network number.
17+
- :func:`long2ip`: Convert a network byte order 32-bit integer to
18+
a dotted quad ip address.
19+
- :func:`netmask2prefix`: Convert a dotted-quad netmask into a CIDR
20+
prefix.
21+
- :func:`subnet2block`: Convert a dotted-quad ip address including
22+
a netmask into a tuple containing the network block start and end
23+
addresses.
24+
- :func:`validate_cidr`: Validate a CIDR notation ip address.
25+
- :func:`validate_ip`: Validate a dotted-quad ip address.
26+
- :func:`validate_netmask`: Validate that a dotted-quad ip address is
27+
a valid netmask.
28+
- :func:`validate_subnet`: Validate a dotted-quad ip address including
29+
a netmask.
30+
31+
:Objects:
32+
- :class:`IpRange`: Range of ip addresses supporting ``in`` and iteration.
33+
- :class:`IpRangeList`: List of IpRange objects supporting ``in`` and
34+
iteration.
35+
36+
:Constants:
37+
- :mod:`iptools.constants`: Common and special use IPv4 address blocks.
38+
39+
The :class:`IpRangeList` object can be used in a django settings file to
40+
allow CIDR notation and/or (start, end) ranges to be used in the
41+
INTERNAL_IPS list.
42+
43+
**Example**::
44+
45+
INTERNAL_IPS = IpRangeList(
46+
'127.0.0.1',
47+
'192.168/16',
48+
('10.0.0.1', '10.0.0.19'),
49+
)
850

951
.. automodule:: iptools
1052
:members:
1153
:exclude-members: IpRange, IpRangeList
1254

13-
=======
1455
IpRange
1556
=======
1657
.. autoclass:: IpRange
1758
:members:
1859
:special-members:
1960

20-
===========
2161
IpRangeList
2262
===========
2363
.. autoclass:: IpRangeList
2464
:members:
2565
:special-members:
2666

27-
=========
2867
Constants
2968
=========
3069
.. automodule:: iptools.constants

0 commit comments

Comments
 (0)