Make --insecure-concurrency option public

Can't stop people who want to use it.
This commit is contained in:
klzgrad 2021-10-28 20:57:33 +08:00
parent c37f1a92d6
commit 090afa7492
3 changed files with 15 additions and 6 deletions

View File

@ -58,6 +58,16 @@ Options:
Routes traffic via the proxy server. Connects directly by default. Routes traffic via the proxy server. Connects directly by default.
Available proto: https, quic. Infers port by default. Available proto: https, quic. Infers port by default.
--insecure-concurrency=<N>
Use N concurrent tunnel connections to be more robust under bad network
conditions. More connections make the tunneling easier to detect and less
secure. This project strives for the strongest security against traffic
analysis. Using it in an insecure way defeats its purpose.
If you must use this, try N=2 first to see if it solves your issues.
Strongly recommend against using more than 4 connections here.
--extra-headers=... --extra-headers=...
Appends extra headers in requests to the proxy server. Appends extra headers in requests to the proxy server.

View File

@ -5,7 +5,6 @@
#include "net/tools/naive/naive_proxy.h" #include "net/tools/naive/naive_proxy.h"
#include <algorithm>
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
@ -39,7 +38,7 @@ NaiveProxy::NaiveProxy(std::unique_ptr<ServerSocket> listen_socket,
protocol_(protocol), protocol_(protocol),
listen_user_(listen_user), listen_user_(listen_user),
listen_pass_(listen_pass), listen_pass_(listen_pass),
concurrency_(std::min(4, std::max(1, concurrency))), concurrency_(concurrency),
resolver_(resolver), resolver_(resolver),
session_(session), session_(session),
net_log_( net_log_(

View File

@ -137,7 +137,7 @@ void GetCommandLine(const base::CommandLine& proc, CommandLine* cmdline) {
" redir (Linux only)\n" " redir (Linux only)\n"
"--proxy=<proto>://[<user>:<pass>@]<hostname>[:<port>]\n" "--proxy=<proto>://[<user>:<pass>@]<hostname>[:<port>]\n"
" proto: https, quic\n" " proto: https, quic\n"
"--concurrency=<N> Use N connections, less secure\n" "--insecure-concurrency=<N> Use N connections, insecure\n"
"--extra-headers=... Extra headers split by CRLF\n" "--extra-headers=... Extra headers split by CRLF\n"
"--host-resolver-rules=... Resolver rules\n" "--host-resolver-rules=... Resolver rules\n"
"--resolver-range=... Redirect resolver range\n" "--resolver-range=... Redirect resolver range\n"
@ -155,7 +155,7 @@ void GetCommandLine(const base::CommandLine& proc, CommandLine* cmdline) {
cmdline->listen = proc.GetSwitchValueASCII("listen"); cmdline->listen = proc.GetSwitchValueASCII("listen");
cmdline->proxy = proc.GetSwitchValueASCII("proxy"); cmdline->proxy = proc.GetSwitchValueASCII("proxy");
cmdline->concurrency = proc.GetSwitchValueASCII("concurrency"); cmdline->concurrency = proc.GetSwitchValueASCII("insecure-concurrency");
cmdline->extra_headers = proc.GetSwitchValueASCII("extra-headers"); cmdline->extra_headers = proc.GetSwitchValueASCII("extra-headers");
cmdline->host_resolver_rules = cmdline->host_resolver_rules =
proc.GetSwitchValueASCII("host-resolver-rules"); proc.GetSwitchValueASCII("host-resolver-rules");
@ -189,7 +189,7 @@ void GetCommandLineFromConfig(const base::FilePath& config_path,
if (proxy) { if (proxy) {
cmdline->proxy = *proxy; cmdline->proxy = *proxy;
} }
const auto* concurrency = value->FindStringKey("concurrency"); const auto* concurrency = value->FindStringKey("insecure-concurrency");
if (concurrency) { if (concurrency) {
cmdline->concurrency = *concurrency; cmdline->concurrency = *concurrency;
} }
@ -296,7 +296,7 @@ bool ParseCommandLine(const CommandLine& cmdline, Params* params) {
if (!cmdline.concurrency.empty()) { if (!cmdline.concurrency.empty()) {
if (!base::StringToInt(cmdline.concurrency, &params->concurrency) || if (!base::StringToInt(cmdline.concurrency, &params->concurrency) ||
params->concurrency < 1 || params->concurrency > 4) { params->concurrency < 1) {
std::cerr << "Invalid concurrency" << std::endl; std::cerr << "Invalid concurrency" << std::endl;
return false; return false;
} }