Commit f2ba6aec authored by justcoding121's avatar justcoding121

update readme

parent 36a721b4
...@@ -35,12 +35,12 @@ After installing nuget package mark following files to be copied to app director ...@@ -35,12 +35,12 @@ After installing nuget package mark following files to be copied to app director
Setup HTTP proxy: Setup HTTP proxy:
```csharp ```csharp
var ProxyServer = new ProxyServer(); var proxyServer = new ProxyServer();
ProxyServer.BeforeRequest += OnRequest; proxyServer.BeforeRequest += OnRequest;
ProxyServer.BeforeResponse += OnResponse; proxyServer.BeforeResponse += OnResponse;
ProxyServer.ServerCertificateValidationCallback += OnCertificateValidation; proxyServer.ServerCertificateValidationCallback += OnCertificateValidation;
ProxyServer.ClientCertificateSelectionCallback += OnCertificateSelection; proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
//Exclude Https addresses you don't want to proxy //Exclude Https addresses you don't want to proxy
...@@ -53,8 +53,8 @@ Setup HTTP proxy: ...@@ -53,8 +53,8 @@ Setup HTTP proxy:
//An explicit endpoint is where the client knows about the existance of a proxy //An explicit endpoint is where the client knows about the existance of a proxy
//So client sends request in a proxy friendly manner //So client sends request in a proxy friendly manner
ProxyServer.AddEndPoint(explicitEndPoint); proxyServer.AddEndPoint(explicitEndPoint);
ProxyServer.Start(); proxyServer.Start();
//Transparent endpoint is usefull for reverse proxying (client is not aware of the existance of proxy) //Transparent endpoint is usefull for reverse proxying (client is not aware of the existance of proxy)
...@@ -67,26 +67,26 @@ Setup HTTP proxy: ...@@ -67,26 +67,26 @@ Setup HTTP proxy:
{ {
GenericCertificateName = "google.com" GenericCertificateName = "google.com"
}; };
ProxyServer.AddEndPoint(transparentEndPoint); proxyServer.AddEndPoint(transparentEndPoint);
//ProxyServer.UpStreamHttpProxy = new ExternalProxy() { HostName = "localhost", Port = 8888 }; //proxyServer.UpStreamHttpProxy = new ExternalProxy() { HostName = "localhost", Port = 8888 };
//ProxyServer.UpStreamHttpsProxy = new ExternalProxy() { HostName = "localhost", Port = 8888 }; //proxyServer.UpStreamHttpsProxy = new ExternalProxy() { HostName = "localhost", Port = 8888 };
foreach (var endPoint in ProxyServer.ProxyEndPoints) foreach (var endPoint in proxyServer.ProxyEndPoints)
Console.WriteLine("Listening on '{0}' endpoint at Ip {1} and port: {2} ", Console.WriteLine("Listening on '{0}' endpoint at Ip {1} and port: {2} ",
endPoint.GetType().Name, endPoint.IpAddress, endPoint.Port); endPoint.GetType().Name, endPoint.IpAddress, endPoint.Port);
//Only explicit proxies can be set as system proxy! //Only explicit proxies can be set as system proxy!
ProxyServer.SetAsSystemHttpProxy(explicitEndPoint); proxyServer.SetAsSystemHttpProxy(explicitEndPoint);
ProxyServer.SetAsSystemHttpsProxy(explicitEndPoint); proxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
//wait here (You can use something else as a wait function, I am using this as a demo) //wait here (You can use something else as a wait function, I am using this as a demo)
Console.Read(); Console.Read();
//Unsubscribe & Quit //Unsubscribe & Quit
ProxyServer.BeforeRequest -= OnRequest; proxyServer.BeforeRequest -= OnRequest;
ProxyServer.BeforeResponse -= OnResponse; proxyServer.BeforeResponse -= OnResponse;
ProxyServer.Stop(); proxyServer.Stop();
``` ```
Sample request and response event handlers Sample request and response event handlers
......
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