Commit 1c6a2455 authored by justcoding121's avatar justcoding121

order properties by internal, private, public then by bool, int, string,...

order properties by internal, private, public then by bool, int, string, object, event, action, func
parent 2b176472
......@@ -27,16 +27,6 @@ namespace Titanium.Web.Proxy
internal static readonly string UriSchemeHttp = Uri.UriSchemeHttp;
internal static readonly string UriSchemeHttps = Uri.UriSchemeHttps;
/// <summary>
/// An default exception log func
/// </summary>
private readonly Lazy<Action<Exception>> defaultExceptionFunc = new Lazy<Action<Exception>>(() => (e => { }));
/// <summary>
/// backing exception func for exposed public property
/// </summary>
private Action<Exception> exceptionFunc;
/// <summary>
/// Backing field for corresponding public property
/// </summary>
......@@ -67,46 +57,33 @@ namespace Titanium.Web.Proxy
private readonly FireFoxProxySettingsManager firefoxProxySettingsManager = new FireFoxProxySettingsManager();
/// <summary>
/// Buffer size used throughout this proxy
/// An default exception log func
/// </summary>
public int BufferSize { get; set; } = 8192;
private readonly Lazy<Action<Exception>> defaultExceptionFunc = new Lazy<Action<Exception>>(() => (e => { }));
/// <summary>
/// Manages certificates used by this proxy
/// backing exception func for exposed public property
/// </summary>
public CertificateManager CertificateManager { get; }
private Action<Exception> exceptionFunc;
/// <summary>
/// The root certificate
/// Is the proxy currently running
/// </summary>
public X509Certificate2 RootCertificate
{
get => CertificateManager.RootCertificate;
set => CertificateManager.RootCertificate = value;
}
public bool ProxyRunning { get; private set; }
/// <summary>
/// Name of the root certificate issuer
/// (This is valid only when RootCertificate property is not set)
/// Gets or sets a value indicating whether requests will be chained to upstream gateway.
/// </summary>
public string RootCertificateIssuerName
{
get => CertificateManager.Issuer;
set => CertificateManager.Issuer = value;
}
public bool ForwardToUpstreamGateway { get; set; }
/// <summary>
/// Name of the root certificate
/// (This is valid only when RootCertificate property is not set)
/// If no certificate is provided then a default Root Certificate will be created and used
/// The provided root certificate will be stored in proxy exe directory with the private key
/// Root certificate file will be named as "rootCert.pfx"
/// Enable disable Windows Authentication (NTLM/Kerberos)
/// Note: NTLM/Kerberos will always send local credentials of current user
/// who is running the proxy process. This is because a man
/// in middle attack is not currently supported
/// (which would require windows delegation enabled for this server process)
/// </summary>
public string RootCertificateName
{
get => CertificateManager.RootCertificateName;
set => CertificateManager.RootCertificateName = value;
}
public bool EnableWinAuth { get; set; }
/// <summary>
/// Trust the RootCertificate used by this proxy server
......@@ -146,6 +123,73 @@ namespace Titanium.Web.Proxy
set => CertificateManager.OverwritePfXFile = value;
}
/// <summary>
/// Should we check for certificare revocation during SSL authentication to servers
/// Note: If enabled can reduce performance (Default disabled)
/// </summary>
public bool CheckCertificateRevocation { get; set; }
/// <summary>
/// Does this proxy uses the HTTP protocol 100 continue behaviour strictly?
/// Broken 100 contunue implementations on server/client may cause problems if enabled
/// </summary>
public bool Enable100ContinueBehaviour { get; set; }
/// <summary>
/// Buffer size used throughout this proxy
/// </summary>
public int BufferSize { get; set; } = 8192;
/// <summary>
/// Minutes certificates should be kept in cache when not used
/// </summary>
public int CertificateCacheTimeOutMinutes { get; set; }
/// <summary>
/// Seconds client/server connection are to be kept alive when waiting for read/write to complete
/// </summary>
public int ConnectionTimeOutSeconds { get; set; }
/// <summary>
/// Total number of active client connections
/// </summary>
public int ClientConnectionCount => clientConnectionCount;
/// <summary>
/// Total number of active server connections
/// </summary>
public int ServerConnectionCount => serverConnectionCount;
/// <summary>
/// Name of the root certificate issuer
/// (This is valid only when RootCertificate property is not set)
/// </summary>
public string RootCertificateIssuerName
{
get => CertificateManager.Issuer;
set => CertificateManager.Issuer = value;
}
/// <summary>
/// Name of the root certificate
/// (This is valid only when RootCertificate property is not set)
/// If no certificate is provided then a default Root Certificate will be created and used
/// The provided root certificate will be stored in proxy exe directory with the private key
/// Root certificate file will be named as "rootCert.pfx"
/// </summary>
public string RootCertificateName
{
get => CertificateManager.RootCertificateName;
set => CertificateManager.RootCertificateName = value;
}
/// <summary>
/// Realm used during Proxy Basic Authentication
/// </summary>
public string ProxyRealm { get; set; } = "TitaniumProxy";
/// <summary>
/// Password of the Root certificate file
/// <para>Set a password for the .pfx file</para>
......@@ -166,6 +210,24 @@ namespace Titanium.Web.Proxy
set => CertificateManager.PfxFilePath = value;
}
/// <summary>
/// List of supported Ssl versions
/// </summary>
public SslProtocols SupportedSslProtocols { get; set; } =
#if NET45
SslProtocols.Ssl3 |
#endif
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
/// <summary>
/// The root certificate
/// </summary>
public X509Certificate2 RootCertificate
{
get => CertificateManager.RootCertificate;
set => CertificateManager.RootCertificate = value;
}
public X509KeyStorageFlags StorageFlag
{
get => storageFlag;
......@@ -188,46 +250,30 @@ namespace Titanium.Web.Proxy
}
/// <summary>
/// Should we check for certificare revocation during SSL authentication to servers
/// Note: If enabled can reduce performance (Default disabled)
/// </summary>
public bool CheckCertificateRevocation { get; set; }
/// <summary>
/// Does this proxy uses the HTTP protocol 100 continue behaviour strictly?
/// Broken 100 contunue implementations on server/client may cause problems if enabled
/// </summary>
public bool Enable100ContinueBehaviour { get; set; }
/// <summary>
/// Minutes certificates should be kept in cache when not used
/// </summary>
public int CertificateCacheTimeOutMinutes { get; set; }
/// <summary>
/// Seconds client/server connection are to be kept alive when waiting for read/write to complete
/// Manages certificates used by this proxy
/// </summary>
public int ConnectionTimeOutSeconds { get; set; }
public CertificateManager CertificateManager { get; }
/// <summary>
/// Intercept request to server
/// External proxy for Http
/// </summary>
public event AsyncEventHandler<SessionEventArgs> BeforeRequest;
public ExternalProxy UpStreamHttpProxy { get; set; }
/// <summary>
/// Intercept response from server
/// External proxy for Http
/// </summary>
public event AsyncEventHandler<SessionEventArgs> BeforeResponse;
public ExternalProxy UpStreamHttpsProxy { get; set; }
/// <summary>
/// Intercept tunnel connect reques
/// Local adapter/NIC endpoint (where proxy makes request via)
/// default via any IP addresses of this machine
/// </summary>
public event AsyncEventHandler<TunnelConnectSessionEventArgs> TunnelConnectRequest;
public IPEndPoint UpStreamEndPoint { get; set; } = new IPEndPoint(IPAddress.Any, 0);
/// <summary>
/// Intercept tunnel connect response
/// A list of IpAddress and port this proxy is listening to
/// </summary>
public event AsyncEventHandler<TunnelConnectSessionEventArgs> TunnelConnectResponse;
public List<ProxyEndPoint> ProxyEndPoints { get; set; }
/// <summary>
/// Occurs when client connection count changed.
......@@ -240,49 +286,41 @@ namespace Titanium.Web.Proxy
public event EventHandler ServerConnectionCountChanged;
/// <summary>
/// External proxy for Http
/// Intercept tunnel connect request
/// </summary>
public ExternalProxy UpStreamHttpProxy { get; set; }
public event AsyncEventHandler<TunnelConnectSessionEventArgs> TunnelConnectRequest;
/// <summary>
/// External proxy for Http
/// Intercept tunnel connect response
/// </summary>
public ExternalProxy UpStreamHttpsProxy { get; set; }
public event AsyncEventHandler<TunnelConnectSessionEventArgs> TunnelConnectResponse;
/// <summary>
/// Local adapter/NIC endpoint (where proxy makes request via)
/// default via any IP addresses of this machine
/// Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication
/// </summary>
public IPEndPoint UpStreamEndPoint { get; set; } = new IPEndPoint(IPAddress.Any, 0);
public event AsyncEventHandler<CertificateValidationEventArgs> ServerCertificateValidationCallback;
/// <summary>
/// Is the proxy currently running
/// Callback tooverride client certificate during SSL mutual authentication
/// </summary>
public bool ProxyRunning { get; private set; }
public event AsyncEventHandler<CertificateSelectionEventArgs> ClientCertificateSelectionCallback;
/// <summary>
/// Gets or sets a value indicating whether requests will be chained to upstream gateway.
/// A callback to provide authentication credentials for up stream proxy this proxy is using for HTTP(S) requests
/// return the ExternalProxy object with valid credentials
/// </summary>
public bool ForwardToUpstreamGateway { get; set; }
public Func<SessionEventArgs, Task<ExternalProxy>> GetCustomUpStreamProxyFunc { get; set; }
/// <summary>
/// Enable disable Windows Authentication (NTLM/Kerberos)
/// Note: NTLM/Kerberos will always send local credentials of current user
/// who is running the proxy process. This is because a man
/// in middle attack is not currently supported
/// (which would require windows delegation enabled for this server process)
/// Intercept request to server
/// </summary>
public bool EnableWinAuth { get; set; }
public event AsyncEventHandler<SessionEventArgs> BeforeRequest;
/// <summary>
/// Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication
/// Intercept response from server
/// </summary>
public event AsyncEventHandler<CertificateValidationEventArgs> ServerCertificateValidationCallback;
public event AsyncEventHandler<SessionEventArgs> BeforeResponse;
/// <summary>
/// Callback tooverride client certificate during SSL mutual authentication
/// </summary>
public event AsyncEventHandler<CertificateSelectionEventArgs> ClientCertificateSelectionCallback;
/// <summary>
/// Callback for error events in proxy
......@@ -300,40 +338,6 @@ namespace Titanium.Web.Proxy
/// </summary>
public Func<string, string, Task<bool>> AuthenticateUserFunc { get; set; }
/// <summary>
/// Realm used during Proxy Basic Authentication
/// </summary>
public string ProxyRealm { get; set; } = "TitaniumProxy";
/// <summary>
/// A callback to provide authentication credentials for up stream proxy this proxy is using for HTTP(S) requests
/// return the ExternalProxy object with valid credentials
/// </summary>
public Func<SessionEventArgs, Task<ExternalProxy>> GetCustomUpStreamProxyFunc { get; set; }
/// <summary>
/// A list of IpAddress and port this proxy is listening to
/// </summary>
public List<ProxyEndPoint> ProxyEndPoints { get; set; }
/// <summary>
/// List of supported Ssl versions
/// </summary>
public SslProtocols SupportedSslProtocols { get; set; } =
#if NET45
SslProtocols.Ssl3 |
#endif
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
/// <summary>
/// Total number of active client connections
/// </summary>
public int ClientConnectionCount => clientConnectionCount;
/// <summary>
/// Total number of active server connections
/// </summary>
public int ServerConnectionCount => serverConnectionCount;
/// <summary>
/// Constructor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment