Skip to content

Commit 57a7cc5

Browse files
committed
Add documentation for goto rules with iptc.easy
1 parent 54c6368 commit 57a7cc5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ High level abstractions
141141
``python-iptables`` implements a low-level interface that tries to closely
142142
match the underlying C libraries. The module ``iptc.easy`` improves the
143143
usability of the library by providing a rich set of high-level functions
144-
designed to simplify the interaction with the library, for example::
144+
designed to simplify the interaction with the library, for example:
145145

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

163+
>>> # Example of goto rule // iptables -A FORWARD -p gre -g TestChainGoto
164+
>>> iptc.easy.add_chain('filter', 'TestChainGoto')
165+
>>> rule_goto_d = {'protocol': 'gre', 'target': {'goto': 'TestChainGoto'}}
166+
>>> iptc.easy.insert_rule('filter', 'FORWARD', rule_goto_d)
167+
163168
Rules
164169
-----
165170

doc/examples.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ High level abstractions
77
``python-iptables`` implements a low-level interface that tries to closely
88
match the underlying C libraries. The module ``iptc.easy`` improves the
99
usability of the library by providing a rich set of high-level functions
10-
designed to simplify the interaction with the library, for example::
10+
designed to simplify the interaction with the library, for example:
1111

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

29+
>>> # Example of goto rule // iptables -A FORWARD -p gre -g TestChainGoto
30+
>>> iptc.easy.add_chain('filter', 'TestChainGoto')
31+
>>> rule_goto_d = {'protocol': 'gre', 'target': {'goto': 'TestChainGoto'}}
32+
>>> iptc.easy.insert_rule('filter', 'FORWARD', rule_goto_d)
33+
2934
Rules
3035
-----
3136

0 commit comments

Comments
 (0)