34 lines
1.8 KiB
Python
34 lines
1.8 KiB
Python
import argparse
|
|
|
|
|
|
def parseArgs():
|
|
args = argparse.ArgumentParser(description = ('Dynamically update and enable/disable '
|
|
'Hurricane Electric Tunnelbroker'))
|
|
args.add_argument('-i', '--no-wan-ip',
|
|
dest = 'wan_ip',
|
|
action = 'store_false',
|
|
help = ('If specified, use the RFC1918 IP address assigned to this machine instead of the WAN '
|
|
'IP (necessary if this machine is behind NAT)'))
|
|
args.add_argument('-c', '--config',
|
|
dest = 'conf_xml',
|
|
default = '~/.config/he_tunnelbroker.xml',
|
|
help = ('The path to the config. See example.tunnelbroker.xml '
|
|
'Default: ~/.config/he_tunnelbroker.xml'))
|
|
args.add_argument('-t', '--tunnel-id',
|
|
dest = 'tun_id',
|
|
type = int,
|
|
help = ('The tunnel profile ID/name to use in -c/--config. '
|
|
'Default is to use the first one found'))
|
|
args.add_argument('-u', '--no-update',
|
|
dest = 'update',
|
|
action = 'store_false',
|
|
help = ('If specified, do not perform the automatic update for start operations. Has no effect '
|
|
'for other operations'))
|
|
args.add_argument('oper',
|
|
metavar = 'OPERATION',
|
|
choices = ('update', 'start', 'stop'),
|
|
help = ('The operation to perform ("start", "stop", or "update"). "update" is performed '
|
|
'automatically by "start", but otherwise will just update the IPv4 address on record '
|
|
'at tunnelbroker'))
|
|
return(args)
|