Skip to content
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

❇️ cli usage with toml config and ctrlc handling #4

Closed
wants to merge 1 commit into from

Conversation

xgdgsc
Copy link
Contributor

@xgdgsc xgdgsc commented Aug 26, 2022

fix #2 . Added toml config auto reloading and ctrl c handling. Hope I didn' t make any mistake since I' ve only used rust for 2 days.

@sigmaSd
Copy link
Owner

sigmaSd commented Aug 26, 2022

Thanks again for your work!

I'll need some time to review this

Just skimming through, a couple of points:

  • You have clap but you're not using it completely , basically if std::env::args().contains("-c") feels wrong
  • I prefer that this whole logic moves into another crate, same like we have a gui crate, we can add another frontend crate for toml parsing, this is because I want to keep tc crate very simple since its the only thing that runs with root using pkexec so the less code the better
  • Also I'm thinking about writing other frontends, (I'm testing egui, js html), so this would fit nicely and we would also improve the ipc layer as needed

@@ -43,7 +53,7 @@ This allows to run the gui as a normal user, and ask for higher privilege only f
- pkexec pkill bandwhich

## Current State
Works on my pc (TM)
Works on developer' s PC.
Copy link
Owner

Choose a reason for hiding this comment

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

I like this 👍

@sigmaSd
Copy link
Owner

sigmaSd commented Aug 30, 2022

I wrote another front-end to test that the back-end is independent enough https://github.com/sigmaSd/bandito

I also added some ctrlc handling here 179debf

@sigmaSd
Copy link
Owner

sigmaSd commented Jun 30, 2023

hello again @xgdgsc

I added ctrlc handling to eltrafico-tc directly, (so now it can automatically cleanup)

I also added another frontend based on your idea here, which reads a toml config and applies the settings (with auto reloading)

code: https://github.com/sigmaSd/Eltrafico/tree/master/frontend/traffictoll
commit: 5e0987b

Its using deno, but the code is really simple, you can port it to rust if you like

thanks for your work

@sigmaSd sigmaSd closed this Jun 30, 2023
@sigmaSd
Copy link
Owner

sigmaSd commented Jun 30, 2023

Actually I changed it to yaml and made it so in theory , the original traffictoll yaml config files should work with it, I think that's even cooler to match with upstream

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.

Support usage from a toml configuration
2 participants