@@ -34,23 +34,29 @@ Setup HTTP proxy:
34
34
35
35
``` csharp
36
36
// listen to client request & server response events
37
- ProxyServer .BeforeRequest += OnRequest ;
38
- ProxyServer .BeforeResponse += OnResponse ;
39
-
40
- // Exclude Https addresses you don't want to proxy
41
- // Usefull for clients that use certificate pinning
42
- // for example dropbox.com
43
- var explicitEndPoint = new ExplicitProxyEndPoint (IPAddress .Loopback , 8000 , true ){
44
- ExcludedHostNameRegex = new List <string >() { " dropbox.com" }
45
- };
46
-
47
- var transparentEndPoint = new TransparentProxyEndPoint (IPAddress .Loopback , 8001 , true );
37
+ ProxyServer .BeforeRequest += OnRequest ;
38
+ ProxyServer .BeforeResponse += OnResponse ;
39
+
40
+ // Exclude Https addresses you don't want to proxy
41
+ // Usefull for clients that use certificate pinning
42
+ // for example dropbox.com
43
+ var explicitEndPoint = new ExplicitProxyEndPoint (IPAddress .Loopback , 8000 , true ){
44
+ ExcludedHttpsHostNameRegex = new List <string >() { " dropbox.com" }
45
+ };
46
+
47
+ var transparentEndPoint = new TransparentProxyEndPoint (IPAddress .Loopback , 8001 , true );
48
+
49
+ ProxyServer .AddEndPoint (explicitEndPoint );
50
+ ProxyServer .Start ();
51
+
52
+ // You can also add/remove end points after proxy has been started
53
+ ProxyServer .AddEndPoint (transparentEndPoint );
48
54
49
- ProxyServer .AddEndPoint (explicitEndPoint );
50
- ProxyServer .AddEndPoint (transparentEndPoint );
51
- ProxyServer .Start ();
55
+ foreach (var endPoint in ProxyServer .ProxyEndPoints )
56
+ Console .WriteLine (" Listening on '{0}' endpoint at Ip {1} and port: {2} " , endPoint .GetType ().Name , endPoint .IpAddress , endPoint .Port );
52
57
53
- ProxyServer .SetAsSystemProxy (explicitEndPoint );
58
+ ProxyServer .SetAsSystemHttpProxy (explicitEndPoint );
59
+ ProxyServer .SetAsSystemHttpsProxy (explicitEndPoint );
54
60
55
61
// wait here (You can use something else as a wait function, I am using this as a demo)
56
62
Console .Read ();
0 commit comments