Commit 2f9fed1c authored by Honfika's avatar Honfika

readme update

parent 7fe7ab6c
...@@ -15,6 +15,7 @@ Kindly report only issues/bugs here. For programming help or questions use [Stac ...@@ -15,6 +15,7 @@ Kindly report only issues/bugs here. For programming help or questions use [Stac
* View/modify/redirect/block requests and responses * View/modify/redirect/block requests and responses
* Supports mutual SSL authentication, proxy authentication & automatic upstream proxy detection * Supports mutual SSL authentication, proxy authentication & automatic upstream proxy detection
* Kerberos/NTLM authentication over HTTP protocols for windows domain * Kerberos/NTLM authentication over HTTP protocols for windows domain
* SOCKS4/5 Proxy support
### Installation ### Installation
Install by [nuget](https://www.nuget.org/packages/Titanium.Web.Proxy) Install by [nuget](https://www.nuget.org/packages/Titanium.Web.Proxy)
...@@ -29,21 +30,21 @@ For stable releases on [stable branch](https://github.com/justcoding121/Titanium ...@@ -29,21 +30,21 @@ For stable releases on [stable branch](https://github.com/justcoding121/Titanium
Supports Supports
* .Net Standard 2.0 or above * .NET Standard 2.0 or above
* .Net Framework 4.6.1 or above * .NET Framework 4.5 or above
### Development environment ### Development environment
#### Windows #### Windows
* Visual Studio Code as IDE for .NET core * Visual Studio Code as IDE for .NET Core
* Visual Studio 2017/2019 as IDE for .NET framework/.NET core * Visual Studio 2019 as IDE for .NET Framework/.NET Core
#### Mac OS #### Mac OS
* Visual Studio Code as IDE for .NET core * Visual Studio Code as IDE for .NET Core
* Visual Studio 2017 as IDE for Mono * Visual Studio 2019 as IDE for Mono
#### Linux #### Linux
* Visual Studio Code as IDE for .NET core * Visual Studio Code as IDE for .NET Core
* Mono develop as IDE for Mono * Mono develop as IDE for Mono
### Usage ### Usage
...@@ -191,7 +192,7 @@ public async Task OnResponse(object sender, SessionEventArgs e) ...@@ -191,7 +192,7 @@ public async Task OnResponse(object sender, SessionEventArgs e)
{ {
if (e.HttpClient.Response.ResponseStatusCode == "200") if (e.HttpClient.Response.ResponseStatusCode == "200")
{ {
if (e.HttpClient.Response.ContentType!=null && e.HttpClient.Response.ContentType.Trim().ToLower().Contains("text/html")) if (e.HttpClient.Response.ContentType != null && e.HttpClient.Response.ContentType.Trim().ToLower().Contains("text/html"))
{ {
byte[] bodyBytes = await e.GetResponseBody(); byte[] bodyBytes = await e.GetResponseBody();
await e.SetResponseBody(bodyBytes); await e.SetResponseBody(bodyBytes);
...@@ -202,7 +203,7 @@ public async Task OnResponse(object sender, SessionEventArgs e) ...@@ -202,7 +203,7 @@ public async Task OnResponse(object sender, SessionEventArgs e)
} }
} }
if (e.UserData!=null) if (e.UserData != null)
{ {
// access request from UserData property where we stored it in RequestHandler // access request from UserData property where we stored it in RequestHandler
var request = (Request)e.UserData; var request = (Request)e.UserData;
...@@ -216,14 +217,14 @@ public Task OnCertificateValidation(object sender, CertificateValidationEventArg ...@@ -216,14 +217,14 @@ public Task OnCertificateValidation(object sender, CertificateValidationEventArg
if (e.SslPolicyErrors == System.Net.Security.SslPolicyErrors.None) if (e.SslPolicyErrors == System.Net.Security.SslPolicyErrors.None)
e.IsValid = true; e.IsValid = true;
return Task.FromResult(0); return Task.CompletedTask;
} }
// Allows overriding default client certificate selection logic during mutual authentication // Allows overriding default client certificate selection logic during mutual authentication
public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs e) public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs e)
{ {
// set e.clientCertificate to override // set e.clientCertificate to override
return Task.FromResult(0); return Task.CompletedTask;
} }
``` ```
### Note to contributors ### Note to contributors
......
...@@ -44,6 +44,10 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -44,6 +44,10 @@ namespace Titanium.Web.Proxy.Examples.Basic
}; };
proxyServer.ForwardToUpstreamGateway = true; proxyServer.ForwardToUpstreamGateway = true;
proxyServer.CertificateManager.SaveFakeCertificates = true; proxyServer.CertificateManager.SaveFakeCertificates = true;
//proxyServer.ProxyBasicAuthenticateFunc = async (args, userName, password) =>
//{
// return true;
//};
// this is just to show the functionality, provided implementations use junk value // this is just to show the functionality, provided implementations use junk value
//proxyServer.GetCustomUpStreamProxyFunc = onGetCustomUpStreamProxyFunc; //proxyServer.GetCustomUpStreamProxyFunc = onGetCustomUpStreamProxyFunc;
...@@ -94,8 +98,11 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -94,8 +98,11 @@ namespace Titanium.Web.Proxy.Examples.Basic
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("localhost", 8888); //proxyServer.UpStreamHttpsProxy = new ExternalProxy("localhost", 8888);
// SOCKS proxy // SOCKS proxy
//proxyServer.UpStreamHttpProxy = new ExternalProxy("46.63.0.17", 4145) { ProxyType = ExternalProxyType.Socks4 }; //proxyServer.UpStreamHttpProxy = new ExternalProxy("127.0.0.1", 1080)
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("46.63.0.17", 4145) { ProxyType = ExternalProxyType.Socks4 }; // { ProxyType = ExternalProxyType.Socks5, UserName = "User1", Password = "Pass" };
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("127.0.0.1", 1080)
// { ProxyType = ExternalProxyType.Socks5, UserName = "User1", Password = "Pass" };
//var socksEndPoint = new SocksProxyEndPoint(IPAddress.Any, 1080, true) //var socksEndPoint = new SocksProxyEndPoint(IPAddress.Any, 1080, true)
//{ //{
...@@ -167,6 +174,12 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -167,6 +174,12 @@ namespace Titanium.Web.Proxy.Examples.Basic
e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectRequest) + ":" + hostname); e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectRequest) + ":" + hostname);
await writeToConsole("Tunnel to: " + hostname); await writeToConsole("Tunnel to: " + hostname);
var clientLocalIp = e.ClientLocalEndPoint.Address;
if (!clientLocalIp.Equals(IPAddress.Loopback) && !clientLocalIp.Equals(IPAddress.IPv6Loopback))
{
e.HttpClient.UpStreamEndPoint = new IPEndPoint(clientLocalIp, 0);
}
if (hostname.Contains("dropbox.com")) if (hostname.Contains("dropbox.com"))
{ {
// Exclude Https addresses you don't want to proxy // Exclude Https addresses you don't want to proxy
...@@ -212,7 +225,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -212,7 +225,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
{ {
e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectResponse) + ":" + e.HttpClient.Request.RequestUri); e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectResponse) + ":" + e.HttpClient.Request.RequestUri);
return Task.FromResult(false); return Task.CompletedTask;
} }
// intercept & cancel redirect or update requests // intercept & cancel redirect or update requests
...@@ -356,7 +369,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -356,7 +369,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
e.IsValid = true; e.IsValid = true;
} }
return Task.FromResult(0); return Task.CompletedTask;
} }
/// <summary> /// <summary>
...@@ -370,7 +383,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -370,7 +383,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
// set e.clientCertificate to override // set e.clientCertificate to override
return Task.FromResult(0); return Task.CompletedTask;
} }
private async Task writeToConsole(string message, ConsoleColor? consoleColor = null) private async Task writeToConsole(string message, ConsoleColor? consoleColor = null)
......
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