33 lines
1.7 KiB
Python
33 lines
1.7 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',
|
||
|
default = '~/.config/he_tunnelbroker.ini',
|
||
|
help = ('The path to the config. '
|
||
|
'Default: ~/.config/he_tunnelbroker.ini'))
|
||
|
args.add_argument('-t', '--tunnel-id',
|
||
|
dest = 'tun_id',
|
||
|
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)
|