Skip to content

Commit 50074e9

Browse files
committed
Removed if __name__== '__main__' section
1 parent 0e69462 commit 50074e9

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

iptc/easy.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -444,42 +444,3 @@ def _filter_empty_field(data_d):
444444
return data_d
445445

446446
### /INTERNAL FUNCTIONS ###
447-
448-
449-
# How to use
450-
if __name__== '__main__':
451-
import uuid
452-
# Generate chain name
453-
chain = uuid.uuid4().hex[:10]
454-
455-
for ipv6 in [False, True]:
456-
table = 'filter'
457-
if not has_chain(table, chain, ipv6):
458-
print('Create new chain {}.{} ipv6={}'.format(table, chain, ipv6))
459-
add_chain(table, chain, ipv6)
460-
else:
461-
print('Flush existing chain {}.{} ipv6={}'.format(table, chain, ipv6))
462-
flush_chain(table, chain, ipv6)
463-
464-
rule_d = {'in_interface':'wan0',
465-
'protocol':'tcp',
466-
'tcp': {'tcp-flags': ['FIN,SYN,RST,ACK', 'SYN']},
467-
'conntrack': {'ctstate': ['NEW,RELATED']},
468-
'comment':{'comment':'New incoming TCP connection'},
469-
'mark':[{'mark': '0x1'},{'mark': '0x2'}],
470-
'target':'ACCEPT'}
471-
# Append new rule
472-
add_rule(table, chain, rule_d, position=0, ipv6=ipv6)
473-
# Show chain rules
474-
print('Display chain {}.{} ipv6={}'.format(table, chain, ipv6))
475-
print(dump_chain(table, chain, ipv6))
476-
# Show first rule
477-
print('Display chain 1st rule {}.{} ipv6={}'.format(table, chain, ipv6))
478-
print(get_rule(table, chain, position=1, ipv6=ipv6))
479-
# Delete chain
480-
delete_chain(table, chain, ipv6, flush=True)
481-
print('Display table {} ipv6={}'.format(table, ipv6))
482-
print(dump_table(table, ipv6))
483-
# Show remaining chains of table
484-
print('Display table chains {} ipv6={}'.format(table, ipv6))
485-
print(get_chains(table))

0 commit comments

Comments
 (0)