Add concurrency parameter

This commit is contained in:
9seconds
2021-03-12 16:21:52 +03:00
parent e167b85d3b
commit 02643fb6bb
2 changed files with 20 additions and 14 deletions
+2
View File
@@ -16,6 +16,7 @@ type Config struct {
TCPBuffer TypeBytes `json:"tcp-buffer"` TCPBuffer TypeBytes `json:"tcp-buffer"`
PreferIP TypePreferIP `json:"prefer-ip"` PreferIP TypePreferIP `json:"prefer-ip"`
CloakPort TypePort `json:"cloak-port"` CloakPort TypePort `json:"cloak-port"`
Concurrency uint `json:"concurrency"`
Defense struct { Defense struct {
Time struct { Time struct {
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
@@ -86,6 +87,7 @@ type configRaw struct {
TCPBuffer string `toml:"tcp-buffer" json:"tcp-buffer,omitempty"` TCPBuffer string `toml:"tcp-buffer" json:"tcp-buffer,omitempty"`
PreferIP string `toml:"prefer-ip" json:"prefer-ip,omitempty"` PreferIP string `toml:"prefer-ip" json:"prefer-ip,omitempty"`
CloakPort uint `toml:"cloak-port" json:"cloak-port,omitempty"` CloakPort uint `toml:"cloak-port" json:"cloak-port,omitempty"`
Concurrency uint `toml:"concurrency" json:"concurrency,omitempty"`
Defense struct { Defense struct {
Time struct { Time struct {
Enabled bool `toml:"enabled" json:"enabled,omitempty"` Enabled bool `toml:"enabled" json:"enabled,omitempty"`
+4
View File
@@ -23,6 +23,10 @@ secret = "ee367a189aee18fa31c190054efd4a8e9573746f726167652e676f6f676c6561706973
# Host:port pair to run proxy on. # Host:port pair to run proxy on.
bind-to = "0.0.0.0:3128" bind-to = "0.0.0.0:3128"
# Defines how many concurrent connections are allowed to this proxy.
# All other incoming connections are going to be dropped.
concurrency = 8192
# A size of user-space buffer for TCP to use. Since we do 2 connections, # A size of user-space buffer for TCP to use. Since we do 2 connections,
# then we have tcp-buffer * (4 + 2) per each connection: read/write for # then we have tcp-buffer * (4 + 2) per each connection: read/write for
# each connection + 2 copy buffers to pump the data between sockets. # each connection + 2 copy buffers to pump the data between sockets.