|
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 | +============================== |
5 | 4 |
|
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 | + ) |
8 | 50 |
|
9 | 51 | .. automodule:: iptools |
10 | 52 | :members: |
11 | 53 | :exclude-members: IpRange, IpRangeList |
12 | 54 |
|
13 | | -======= |
14 | 55 | IpRange |
15 | 56 | ======= |
16 | 57 | .. autoclass:: IpRange |
17 | 58 | :members: |
18 | 59 | :special-members: |
19 | 60 |
|
20 | | -=========== |
21 | 61 | IpRangeList |
22 | 62 | =========== |
23 | 63 | .. autoclass:: IpRangeList |
24 | 64 | :members: |
25 | 65 | :special-members: |
26 | 66 |
|
27 | | -========= |
28 | 67 | Constants |
29 | 68 | ========= |
30 | 69 | .. automodule:: iptools.constants |
|
0 commit comments