-
Notifications
You must be signed in to change notification settings - Fork 1
/
OpenProxyManager.cs
35 lines (30 loc) · 1005 Bytes
/
OpenProxyManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
namespace TorExitNodeManager
{
public class OpenProxyManager
{
private static string[] PROXY_HEADERS = new string[]
{
"VIA", "FORWARDED", "X-FORWARDED-FOR", "PROXY-CONNECTION", "XPROXY_CONNECTION", "X-PROXY_CONNECTION",
"HTTP-PC-REMOTE-ADDR", "HTTP-CLIENT-IP", "USERAGENT-VIA"
};
public static Boolean IsCurrentRequestFromProxy()
{
if (WebOperationContext.Current != null)
{
foreach (String header in PROXY_HEADERS)
{
if (WebOperationContext.Current.IncomingRequest.Headers[header] != null
&& WebOperationContext.Current.IncomingRequest.Headers[header].Length > 0)
return true;
}
}
return false;
}
}
}