Skip to content

Commit

Permalink
use Rst for README to please pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
Job Snijders committed Nov 12, 2024
1 parent 8b762b6 commit 41fe794
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ all:
cp README.md aggregate6.7.ronn
ronn -r --pipe aggregate6.7.ronn > aggregate6.7
rm aggregate6.7.ronn
pandoc --from=markdown --to=rst --output=README.rst README.md

clean:
rm -rf *.egg *.egg-info dist build
111 changes: 111 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
|Requirements Status| |Coverage Status|

aggregate6
==========

aggregate6 will compress an unsorted list of IP prefixes (both IPv4 and
IPv6).

Description
-----------

Takes a list of IPv6 prefixes in conventional format on stdin, and
performs two optimisations to attempt to reduce the length of the prefix
list. The first optimisation is to remove any supplied prefixes which
are superfluous because they are already included in another supplied
prefix. For example, ``2001:67c:208c:10::/64`` would be removed if
``2001:67c:208c::/48`` was also supplied.

The second optimisation identifies adjacent prefixes that can be
combined under a single, shorter-length prefix. For example,
``2001:67c:208c::/48`` and ``2001:67c:208d::/48`` can be combined into
the single prefix ``2001:67c:208c::/47``.

The above optimalisation steps are often useful in context of
compressing firewall rules or BGP prefix-list filters.

The following command line options are available:

::

-4 Only output IPv4 prefixes
-6 Only output IPv6 prefixes
-h, --help show help message and exit
-m N Sets the maximum prefix length for entries read, longer prefixes will be discarded prior to processing
-t truncate IP/mask to network/mask
-v Display verbose information about the optimisations
-V Display aggregate6 version

Installation
------------

OpenBSD:

``$ doas pkg_add aggregate6``

CentOS/RHEL/Rocky:

| ``$ yum install epel-release``
| ``$ yum install aggregate6``
Fedora:

``$ dnf install aggregate6``

Other platforms:

``$ pip3 install aggregate6``

CLI Usage
---------

Either provide the list of IPv4 and IPv6 prefixes on STDIN, or give
filenames containing lists of IPv4 and IPv6 prefixes as arguments.

::

$ # via STDIN
$ cat file_with_list_of_prefixes | aggregate6
... output ...

$ # with a filename as argument
$ aggregate6 file_with_list_of_prefixes [ ... optional_other_prefix_lists ]
... output ...

$ # Whitespace separated works too
$ echo 2001:67c:208c::/48 2000::/3 | aggregate6
2000::/3

$ # You can combine IPv4 and IPv6
$ echo 10.0.0.0/16 10.0.0.0/24 2000::/3 | aggregate6
10.0.0.0/16
2000::/3

Library Usage
-------------

Aggregate6 can be used in your own pyp/python2/python3 project as python
module. Currently there is just one simple public function:
``aggregate()`` which takes a list as parameter.

::

>>> from aggregate6 import aggregate
>>> aggregate(["10.0.0.0/8", "10.0.0.0/24"])
['10.0.0.0/8']
>>>

Bugs
----

Please report bugs at https://github.com/job/aggregate6/issues

Author
------

Job Snijders job@instituut.net

.. |Requirements Status| image:: https://requires.io/github/job/aggregate6/requirements.svg?branch=master
:target: https://requires.io/github/job/aggregate6/requirements/?branch=master
.. |Coverage Status| image:: https://coveralls.io/repos/github/job/aggregate6/badge.svg?branch=master
:target: https://coveralls.io/github/job/aggregate6?branch=master
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
open('aggregate6/__init__.py').read(),
re.M).group(1)

with codecs.open(join(here, 'README.md'), encoding='utf-8') as f:
with codecs.open(join(here, 'README.rst'), encoding='utf-8') as f:
README = f.read()

if sys.argv[-1] == 'publish':
Expand Down

0 comments on commit 41fe794

Please sign in to comment.