mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Moved Proxy types around and refactored/renamed a few things.
This commit is contained in:
55
src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs
Normal file
55
src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
namespace NzbDrone.Common.Http.Proxy
|
||||
{
|
||||
public class HttpProxySettings
|
||||
{
|
||||
public HttpProxySettings(ProxyType type, string host, int port, string bypassFilter, bool bypassLocalAddress, string username = null, string password = null)
|
||||
{
|
||||
Type = type;
|
||||
Host = host.IsNullOrWhiteSpace() ? "127.0.0.1" : host;
|
||||
Port = port;
|
||||
Username = username ?? string.Empty;
|
||||
Password = password ?? string.Empty;
|
||||
BypassFilter = bypassFilter ?? string.Empty;
|
||||
BypassLocalAddress = bypassLocalAddress;
|
||||
}
|
||||
|
||||
public ProxyType Type { get; private set; }
|
||||
public string Host { get; private set; }
|
||||
public int Port { get; private set; }
|
||||
public string Username { get; private set; }
|
||||
public string Password { get; private set; }
|
||||
public string BypassFilter { get; private set; }
|
||||
public bool BypassLocalAddress { get; private set; }
|
||||
|
||||
public string[] SubnetFilterAsArray
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(BypassFilter))
|
||||
{
|
||||
return BypassFilter.Split(';');
|
||||
}
|
||||
return new string[] { };
|
||||
}
|
||||
}
|
||||
|
||||
public string Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Join("_",
|
||||
Type,
|
||||
Host,
|
||||
Port,
|
||||
Username,
|
||||
Password,
|
||||
BypassFilter,
|
||||
BypassLocalAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user