Skip to content

Commit

Permalink
Add documentation for goto rules with iptc.easy
Browse files Browse the repository at this point in the history
  • Loading branch information
jllorente committed May 19, 2019
1 parent 54c6368 commit 57a7cc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ High level abstractions
``python-iptables`` implements a low-level interface that tries to closely
match the underlying C libraries. The module ``iptc.easy`` improves the
usability of the library by providing a rich set of high-level functions
designed to simplify the interaction with the library, for example::
designed to simplify the interaction with the library, for example:

>>> import iptc
>>> iptc.easy.dump_table('nat', ipv6=False)
Expand All @@ -160,6 +160,11 @@ designed to simplify the interaction with the library, for example::
[{'protocol': 'tcp', 'target': 'ACCEPT', 'tcp': {'dport': '22'}}]
>>> iptc.easy.delete_chain('filter', 'TestChain', flush=True)

>>> # Example of goto rule // iptables -A FORWARD -p gre -g TestChainGoto
>>> iptc.easy.add_chain('filter', 'TestChainGoto')
>>> rule_goto_d = {'protocol': 'gre', 'target': {'goto': 'TestChainGoto'}}
>>> iptc.easy.insert_rule('filter', 'FORWARD', rule_goto_d)

Rules
-----

Expand Down
7 changes: 6 additions & 1 deletion doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ High level abstractions
``python-iptables`` implements a low-level interface that tries to closely
match the underlying C libraries. The module ``iptc.easy`` improves the
usability of the library by providing a rich set of high-level functions
designed to simplify the interaction with the library, for example::
designed to simplify the interaction with the library, for example:

>>> import iptc
>>> iptc.easy.dump_table('nat', ipv6=False)
Expand All @@ -26,6 +26,11 @@ designed to simplify the interaction with the library, for example::
[{'protocol': 'tcp', 'target': 'ACCEPT', 'tcp': {'dport': '22'}}]
>>> iptc.easy.delete_chain('filter', 'TestChain', flush=True)

>>> # Example of goto rule // iptables -A FORWARD -p gre -g TestChainGoto
>>> iptc.easy.add_chain('filter', 'TestChainGoto')
>>> rule_goto_d = {'protocol': 'gre', 'target': {'goto': 'TestChainGoto'}}
>>> iptc.easy.insert_rule('filter', 'FORWARD', rule_goto_d)

Rules
-----

Expand Down

0 comments on commit 57a7cc5

Please sign in to comment.