From fa21ad5fc45c4453a80b33059c2aadaaabeaea74 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 15 May 2021 14:57:47 -0500 Subject: add proxy options --- src/slskd/Options.cs | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index 6074d650..59cc8a11 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -264,6 +264,12 @@ namespace slskd [Validate] public BufferOptions Buffer { get; private set; } = new BufferOptions(); + /// + /// Gets connection proxy options. + /// + [Validate] + public ProxyOptions Proxy { get; private set; } = new ProxyOptions(); + /// /// Connection buffer options. /// @@ -300,7 +306,7 @@ namespace slskd [EnvironmentVariable("SLSK_CONNECTION_TIMEOUT")] [Description("connection timeout, in milliseconds")] [Range(1000, int.MaxValue)] - public int Connect { get; private set; } = 5000; + public int Connect { get; private set; } = 10000; /// /// Gets the connection inactivity timeout, in milliseconds. @@ -311,6 +317,48 @@ namespace slskd [Range(1000, int.MaxValue)] public int Inactivity { get; private set; } = 15000; } + + /// + /// Connection proxy options. + /// + public class ProxyOptions + { + /// + /// Gets the proxy address. + /// + [Argument(default, "slsk-proxy-address")] + [EnvironmentVariable("SLSK_PROXY_ADDRESS")] + [Description("connection proxy address")] + [StringLength(255, MinimumLength = 1)] + public string Address { get; private set; } + + /// + /// Gets the proxy port. + /// + [Argument(default, "slsk-proxy-port")] + [EnvironmentVariable("SLSK_PROXY_PORT")] + [Description("connection proxy port")] + [Range(1, 65535)] + public int Port { get; private set; } + + /// + /// Gets the proxy username, if applicable. + /// + [Argument(default, "slsk-proxy-username")] + [EnvironmentVariable("SLSK_PROXY_USERNAME")] + [Description("connection proxy username")] + [StringLength(255, MinimumLength = 1)] + public string Username { get; private set; } + + /// + /// Gets the proxy password, if applicable. + /// + [Argument(default, "slsk-proxy-password")] + [EnvironmentVariable("SLSK_PROXY_PASSWORD")] + [Description("connection proxy password")] + [StringLength(255, MinimumLength = 1)] + public string Password { get; private set; } + } } /// -- cgit v1.2.3