Skip to content

add config file support#42

Open
AASanchezA wants to merge 3 commits into
dlenski:masterfrom
AASanchezA:master
Open

add config file support#42
AASanchezA wants to merge 3 commits into
dlenski:masterfrom
AASanchezA:master

Conversation

@AASanchezA

Copy link
Copy Markdown

first implementation for config file support issue #17

Comment thread vpn_slice/__main__.py
return p, args, env

def parse_routes_from_list(args, routes):
for x in routes:

Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check 2f0b464

@scw1109

scw1109 commented Apr 15, 2020

Copy link
Copy Markdown

Any idea what would the startup performance looks like when putting in a large configuration file?
I did i brief try with 10k more line of subnet configuration, it doesn't look good.
But I am not familiar with vpn-slice enough to get into details.

@AASanchezA

Copy link
Copy Markdown
Author

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.
thanks for the comments

@AASanchezA

Copy link
Copy Markdown
Author

I tested the file parsing, here are the results:

  • 10 lines file
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
  • 10k lines
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

@dlenski

dlenski commented Apr 15, 2020

Copy link
Copy Markdown
Owner

Is there a reason that you wrote this to accept only routes/hostnames/aliases in the configuration file, and not other arbitrary arguments?

@AASanchezA

Copy link
Copy Markdown
Author

no reason, I took the idea from here #17 (comment)
but, yeah it could be extended to use a yml or json or toml, what do you think?

@AASanchezA

Copy link
Copy Markdown
Author

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?
also remove some complexity introduce by file parsing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants