-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add config file support #42
base: master
Are you sure you want to change the base?
Conversation
@@ -365,6 +373,16 @@ def parse_args_and_env(args=None, environ=os.environ): | |||
env = parse_env(environ) | |||
return p, args, env | |||
|
|||
def parse_routes_from_list(args, routes): | |||
for x in routes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter x
need to parse by net_or_host_param()
before checking.
Otherwise it will not handle the subnet and alias cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check 2f0b464
Any idea what would the startup performance looks like when putting in a large configuration file? |
for my use case I try with 10-20 lines, if you need 10k line are you sure you need to slice the vpn tunel? I will check the performance when I get some time. |
I tested the file parsing, here are the results:
got config file: vpn_slice_10.txt
elapsed time: 8.869171142578125e-05 s; number lines: 10
Must be called as vpnc-script, with $reason set; use --help for more information
got config file: vpn_slice_10k.txt
elapsed time: 0.0041501522064208984 s; number lines: 10000
Must be called as vpnc-script, with $reason set; use --help for more information the bottle neck should be somewhere else, not in the file parsing |
Is there a reason that you wrote this to accept only routes/hostnames/aliases in the configuration file, and not other arbitrary arguments? |
no reason, I took the idea from here #17 (comment) |
last commit d988aa3 enable from_prefix_chars option for ArgumentParser which enable the parse from file by prefixing the character "@" to config filename vpn-slice @list_of_routes.txt with this change, option --config could be remove, what do you think? |
first implementation for config file support issue #17