Class ProxyServer
Proxy Server Main class
Implements
Inherited Members
Namespace: Titanium.Web.Proxy
Assembly: Titanium.Web.Proxy.Docs.dll
Syntax
public class ProxyServer : IDisposable
Constructors
ProxyServer(Boolean, Boolean, Boolean)
Constructor
Declaration
public ProxyServer(bool userTrustRootCertificate = true, bool machineTrustRootCertificate = false, bool trustRootCertificateAsAdmin = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | userTrustRootCertificate | |
| Boolean | machineTrustRootCertificate | Note:setting machineTrustRootCertificate to true will force userTrustRootCertificate to true |
| Boolean | trustRootCertificateAsAdmin |
ProxyServer(String, String, Boolean, Boolean, Boolean)
Constructor.
Declaration
public ProxyServer(string rootCertificateName, string rootCertificateIssuerName, bool userTrustRootCertificate = true, bool machineTrustRootCertificate = false, bool trustRootCertificateAsAdmin = false)
Parameters
| Type | Name | Description |
|---|---|---|
| String | rootCertificateName | Name of root certificate. |
| String | rootCertificateIssuerName | Name of root certificate issuer. |
| Boolean | userTrustRootCertificate | |
| Boolean | machineTrustRootCertificate | Note:setting machineTrustRootCertificate to true will force userTrustRootCertificate to true |
| Boolean | trustRootCertificateAsAdmin |
Properties
AuthenticateUserFunc
A callback to authenticate clients Parameters are username, password provided by client return true for successful authentication
Declaration
public Func<string, string, Task<bool>> AuthenticateUserFunc { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<String, String, Task<Boolean>> |
BufferSize
Buffer size used throughout this proxy
Declaration
public int BufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
CertificateManager
Manages certificates used by this proxy
Declaration
public CertificateManager CertificateManager { get; }
Property Value
| Type | Description |
|---|---|
| CertificateManager |
CheckCertificateRevocation
Should we check for certificare revocation during SSL authentication to servers Note: If enabled can reduce performance (Default: NoCheck)
Declaration
public X509RevocationMode CheckCertificateRevocation { get; set; }
Property Value
| Type | Description |
|---|---|
| X509RevocationMode |
ClientConnectionCount
Total number of active client connections
Declaration
public int ClientConnectionCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
ConnectionTimeOutSeconds
Seconds client/server connection are to be kept alive when waiting for read/write to complete
Declaration
public int ConnectionTimeOutSeconds { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Enable100ContinueBehaviour
Does this proxy uses the HTTP protocol 100 continue behaviour strictly? Broken 100 contunue implementations on server/client may cause problems if enabled
Declaration
public bool Enable100ContinueBehaviour { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
EnableWinAuth
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)
Declaration
public bool EnableWinAuth { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
ExceptionFunc
Callback for error events in proxy
Declaration
public ExceptionHandler ExceptionFunc { get; set; }
Property Value
| Type | Description |
|---|---|
| ExceptionHandler |
ForwardToUpstreamGateway
Gets or sets a value indicating whether requests will be chained to upstream gateway.
Declaration
public bool ForwardToUpstreamGateway { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
GetCustomUpStreamProxyFunc
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
Declaration
public Func<SessionEventArgsBase, Task<ExternalProxy>> GetCustomUpStreamProxyFunc { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<SessionEventArgsBase, Task<ExternalProxy>> |
ProxyEndPoints
A list of IpAddress and port this proxy is listening to
Declaration
public List<ProxyEndPoint> ProxyEndPoints { get; set; }
Property Value
| Type | Description |
|---|---|
| List<ProxyEndPoint> |
ProxyRealm
Realm used during Proxy Basic Authentication
Declaration
public string ProxyRealm { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
ProxyRunning
Is the proxy currently running
Declaration
public bool ProxyRunning { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
ServerConnectionCount
Total number of active server connections
Declaration
public int ServerConnectionCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
SupportedSslProtocols
List of supported Ssl versions
Declaration
public SslProtocols SupportedSslProtocols { get; set; }
Property Value
| Type | Description |
|---|---|
| SslProtocols |
UpStreamEndPoint
Local adapter/NIC endpoint (where proxy makes request via) default via any IP addresses of this machine
Declaration
public IPEndPoint UpStreamEndPoint { get; set; }
Property Value
| Type | Description |
|---|---|
| IPEndPoint |
UpStreamHttpProxy
External proxy for Http
Declaration
public ExternalProxy UpStreamHttpProxy { get; set; }
Property Value
| Type | Description |
|---|---|
| ExternalProxy |
UpStreamHttpsProxy
External proxy for Http
Declaration
public ExternalProxy UpStreamHttpsProxy { get; set; }
Property Value
| Type | Description |
|---|---|
| ExternalProxy |
Methods
AddEndPoint(ProxyEndPoint)
Add a proxy end point
Declaration
public void AddEndPoint(ProxyEndPoint endPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| ProxyEndPoint | endPoint |
DisableAllSystemProxies()
Clear all proxy settings for current machine
Declaration
public void DisableAllSystemProxies()
DisableSystemHttpProxy()
Remove any HTTP proxy setting of current machien
Declaration
public void DisableSystemHttpProxy()
DisableSystemHttpsProxy()
Remove any HTTPS proxy setting for current machine
Declaration
public void DisableSystemHttpsProxy()
DisableSystemProxy(ProxyProtocolType)
Remove the specified proxy settings for current machine
Declaration
public void DisableSystemProxy(ProxyProtocolType protocolType)
Parameters
| Type | Name | Description |
|---|---|---|
| ProxyProtocolType | protocolType |
Dispose()
Dispose Proxy.
Declaration
public void Dispose()
RemoveEndPoint(ProxyEndPoint)
Remove a proxy end point Will throw error if the end point does'nt exist
Declaration
public void RemoveEndPoint(ProxyEndPoint endPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| ProxyEndPoint | endPoint |
SetAsSystemHttpProxy(ExplicitProxyEndPoint)
Set the given explicit end point as the default proxy server for current machine
Declaration
public void SetAsSystemHttpProxy(ExplicitProxyEndPoint endPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| ExplicitProxyEndPoint | endPoint |
SetAsSystemHttpsProxy(ExplicitProxyEndPoint)
Set the given explicit end point as the default proxy server for current machine
Declaration
public void SetAsSystemHttpsProxy(ExplicitProxyEndPoint endPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| ExplicitProxyEndPoint | endPoint |
SetAsSystemProxy(ExplicitProxyEndPoint, ProxyProtocolType)
Set the given explicit end point as the default proxy server for current machine
Declaration
public void SetAsSystemProxy(ExplicitProxyEndPoint endPoint, ProxyProtocolType protocolType)
Parameters
| Type | Name | Description |
|---|---|---|
| ExplicitProxyEndPoint | endPoint | |
| ProxyProtocolType | protocolType |
Start()
Start this proxy server
Declaration
public void Start()
Stop()
Stop this proxy server
Declaration
public void Stop()
Events
AfterResponse
Intercept after response from server
Declaration
public event AsyncEventHandler<SessionEventArgs> AfterResponse
Event Type
| Type | Description |
|---|---|
| AsyncEventHandler<SessionEventArgs> |
BeforeRequest
Intercept request to server
Declaration
public event AsyncEventHandler<SessionEventArgs> BeforeRequest
Event Type
| Type | Description |
|---|---|
| AsyncEventHandler<SessionEventArgs> |
BeforeResponse
Intercept response from server
Declaration
public event AsyncEventHandler<SessionEventArgs> BeforeResponse
Event Type
| Type | Description |
|---|---|
| AsyncEventHandler<SessionEventArgs> |
ClientCertificateSelectionCallback
Callback tooverride client certificate during SSL mutual authentication
Declaration
public event AsyncEventHandler<CertificateSelectionEventArgs> ClientCertificateSelectionCallback
Event Type
| Type | Description |
|---|---|
| AsyncEventHandler<CertificateSelectionEventArgs> |
ClientConnectionCountChanged
Occurs when client connection count changed.
Declaration
public event EventHandler ClientConnectionCountChanged
Event Type
| Type | Description |
|---|---|
| EventHandler |
ServerCertificateValidationCallback
Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication
Declaration
public event AsyncEventHandler<CertificateValidationEventArgs> ServerCertificateValidationCallback
Event Type
| Type | Description |
|---|---|
| AsyncEventHandler<CertificateValidationEventArgs> |
ServerConnectionCountChanged
Occurs when server connection count changed.
Declaration
public event EventHandler ServerConnectionCountChanged
Event Type
| Type | Description |
|---|---|
| EventHandler |