-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Lines 248 to 266 in 5b2bf7f
| // Define flags | |
| rootCmd.Flags().StringVar(&socksTCPv4, "socks-tcp", "127.0.0.1:9050", "SOCKS TCP4 address") | |
| rootCmd.Flags().StringVar(&socksTCPv6, "socks-tcp6", "[::1]:9050", "SOCKS TCP6 address (IPv6)") | |
| rootCmd.Flags().StringSliceVar(&args, "args", []string{}, "Arguments to pass to the program") | |
| rootCmd.Flags().BoolVar(&killProg, "kill-prog", false, "Kill program on proxy leak (default: false)") | |
| rootCmd.Flags().BoolVar(&logLeaks, "logleaks", false, "Allow and log proxy leaks (default: false)") | |
| rootCmd.Flags().BoolVar(&envVar, "env-var", true, "Use environment variables for SOCKS") | |
| rootCmd.Flags().StringVar(&redirect, "redirect", "socks5", "Redirect leaked connections (options: socks5, http)") | |
| rootCmd.Flags().StringVar(&proxyUser, "proxy-user", "", "Proxy username") | |
| rootCmd.Flags().StringVar(&proxyPass, "proxy-pass", "", "Proxy password") | |
| rootCmd.Flags().BoolVar(&oneCircuit, "one-circuit", false, "Disable random SOCKS behavior (default: false) If a user provides a username or password, those credentials will be used for all connections.") | |
| rootCmd.Flags().BoolVar(&whitelistLoopback, "whitelist-loopback", false, "Allow loopback connections (default: false)") | |
| rootCmd.Flags().BoolVar(&allowNonTCP, "allow-non-tcp", true, "Allow non-TCP connections (Tor Proxy only supports TCP)") | |
| rootCmd.Flags().BoolVar(&blockIncomingTCP, "block-incoming-tcp", false, "Block incoming TCP connections (default: false)") | |
| rootCmd.Flags().StringSliceVar(&allowedAddresses, "allowed-addresses", []string{}, "List of allowed addresses (--allowed-addrs 127.0.0.1:9150,192.168.1.100:1080)") | |
| rootCmd.Flags().BoolVar(&enforceSocks5Auth, "enforce-socks5-auth", false, "Enforce SOCKS5 authentication (default: false)") | |
| rootCmd.Flags().BoolVar(&enforceSocks5TorAuth, "enforce-socks5-tor-auth", false, "Enforce SOCKS5 authentication (default: false)") | |
| rootCmd.Flags().BoolVar(&killAllTracees, "kill-all-tracees", false, "Kill all traced processes (default: false)") | |
| rootCmd.Flags().BoolVar(&coreDump, "core-dump", false, "Enable core dump (default: false)") |
This set of flags has become rather unwieldy. Sometimes a hyphen is present, sometimes not. There's no clear distinction in form between data parameters (e.g. username, password, SOCKS5 addresses) and leak response actions. Both "allow" and "whitelist" show up when they're synonyms. It would be useful to clean this up and have a consistent, well-defined pattern for what these flags look like. I also think we should replace the various boolean leak response action flags with a single action flag that accepts a string (kill, killall, redirect, allow, deny, coredump), as well as one boolean flag indicating whether the leak should be logged. This would be a lot less confusing than having a huge number of booleans that can't be used in arbitrary combinations.
Maybe make these changes after ditching Cobra?