@@ -19,21 +19,31 @@ public void StartProxy()
1919 //Exclude Https addresses you don't want to proxy
2020 //Usefull for clients that use certificate pinning
2121 //for example dropbox.com
22- var explicitEndPoint = new ExplicitProxyEndPoint ( IPAddress . Loopback , 8000 , true ) {
22+ var explicitEndPoint = new ExplicitProxyEndPoint ( IPAddress . Any , 8000 , true ) {
2323 ExcludedHttpsHostNameRegex = new List < string > ( ) { "dropbox.com" }
2424 } ;
2525
26- var transparentEndPoint = new TransparentProxyEndPoint ( IPAddress . Loopback , 8001 , true ) ;
27-
26+ //An explicit endpoint is where the client knows about the exististance of a proxy
27+ //So client sends request in a proxy friendly manner
2828 ProxyServer . AddEndPoint ( explicitEndPoint ) ;
2929 ProxyServer . Start ( ) ;
30-
30+
3131 //You can also add/remove end points after proxy has been started
32+ //Transparent endpoint is usefull for reverse proxying (client is not aware of the existance of proxy)
33+ //A transparent endpoint usually requires a network router port forwarding HTTP(S) packets to this endpoint
34+ //Currently do not support Server Name Indication (It is not currently supported by SslStream class)
35+ //That means that the transparent endpoint will always provide the same Generic Certificate to all HTTPS requests
36+ //In this example only google.com will work for HTTPS requests
37+ //Other sites will receive a certificate mismatch warning on browser
38+ //Please read about it before asking questions!
39+ var transparentEndPoint = new TransparentProxyEndPoint ( IPAddress . Any , 8001 , true ) { GenericCertificateName = "google.com" } ;
3240 ProxyServer . AddEndPoint ( transparentEndPoint ) ;
41+ ProxyServer . RemoveEndPoint ( transparentEndPoint ) ;
3342
3443 foreach ( var endPoint in ProxyServer . ProxyEndPoints )
3544 Console . WriteLine ( "Listening on '{0}' endpoint at Ip {1} and port: {2} " , endPoint . GetType ( ) . Name , endPoint . IpAddress , endPoint . Port ) ;
3645
46+ //Only explicit proxies can be set as system proxy!
3747 ProxyServer . SetAsSystemHttpProxy ( explicitEndPoint ) ;
3848 ProxyServer . SetAsSystemHttpsProxy ( explicitEndPoint ) ;
3949 }
0 commit comments