Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 445f8bd

Browse files
committed
simplify instructions
1 parent 687e34a commit 445f8bd

File tree

1 file changed

+10
-29
lines changed

1 file changed

+10
-29
lines changed

README.md

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,52 +37,33 @@ Setup HTTP proxy:
3737
ProxyServer.BeforeRequest += OnRequest;
3838
ProxyServer.BeforeResponse += OnResponse;
3939

40-
//Exclude Https addresses you don't want to proxy
41-
//Usefull for clients that use certificate pinning
42-
//for example dropbox.com
4340
var explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000, true){
41+
//Exclude Https addresses you don't want to proxy/cannot be proxied
42+
//for example exclude dropbox client which use certificate pinning
4443
ExcludedHttpsHostNameRegex = new List<string>() { "dropbox.com" }
4544
};
4645

47-
//An explicit endpoint is where the client knows about the existance of a proxy
48-
//So client sends request in a proxy friendly manner
46+
//Add an explicit endpoint where the client is aware of the proxy
47+
//So client would send request in a proxy friendly manner
4948
ProxyServer.AddEndPoint(explicitEndPoint);
5049
ProxyServer.Start();
51-
52-
53-
//Transparent endpoint is usefull for reverse proxying (client is not aware of the existance of proxy)
54-
//A transparent endpoint usually requires a network router port forwarding HTTP(S) packets to this endpoint
55-
//Currently do not support Server Name Indication (It is not currently supported by SslStream class)
56-
//That means that the transparent endpoint will always provide the same Generic Certificate to all HTTPS requests
57-
//In this example only google.com will work for HTTPS requests
58-
//Other sites will receive a certificate mismatch warning on browser
59-
//Please read about it before asking questions!
60-
var transparentEndPoint = new TransparentProxyEndPoint(IPAddress.Any, 8001, true) {
61-
GenericCertificateName = "google.com"
62-
};
63-
ProxyServer.AddEndPoint(transparentEndPoint);
64-
65-
50+
51+
//Only explicit proxies can be set as a system proxy!
52+
ProxyServer.SetAsSystemHttpProxy(explicitEndPoint);
53+
ProxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
54+
6655
foreach (var endPoint in ProxyServer.ProxyEndPoints)
6756
Console.WriteLine("Listening on '{0}' endpoint at Ip {1} and port: {2} ",
6857
endPoint.GetType().Name, endPoint.IpAddress, endPoint.Port);
6958

70-
//You can also add/remove end points after proxy has been started
71-
ProxyServer.RemoveEndPoint(transparentEndPoint);
72-
73-
//Only explicit proxies can be set as system proxy!
74-
ProxyServer.SetAsSystemHttpProxy(explicitEndPoint);
75-
ProxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
76-
7759
//wait here (You can use something else as a wait function, I am using this as a demo)
7860
Console.Read();
7961

8062
//Unsubscribe & Quit
8163
ProxyServer.BeforeRequest -= OnRequest;
82-
ProxyServer.BeforeResponse -= OnResponse;
64+
ProxyServer.BeforeResponse -= OnResponse;
8365
ProxyServer.Stop();
8466

85-
8667
```
8768
Sample request and response event handlers
8869

0 commit comments

Comments
 (0)