-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseProxyInformation.cs
More file actions
101 lines (85 loc) · 2.46 KB
/
ResponseProxyInformation.cs
File metadata and controls
101 lines (85 loc) · 2.46 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GimmeProxy;
/// <summary>
/// Shared proxy information provided in responses packets.
/// </summary>
[DataContract]
public class ResponseProxyInformation
{
/// <summary>
/// Supports GET requests.
/// </summary>
[DataMember(Name = "get")]
public bool SupportsGet { get; init; }
/// <summary>
/// Supports POST requests.
/// </summary>
[DataMember(Name = "post")]
public bool SupportsPost { get; init; }
/// <summary>
/// Supports cookies.
/// </summary>
[DataMember(Name = "cookies")]
public bool SupportsCookies { get; init; }
/// <summary>
/// Supports the 'referer' header.
/// </summary>
[DataMember(Name = "referer")]
public bool SupportsReferer { get; init; }
/// <summary>
/// Supports the 'user-agent' header.
/// </summary>
[DataMember(Name = "user-agent")]
public bool SupportsUserAgent { get; init; }
/// <summary>
/// Supports HTTPS.
/// </summary>
[DataMember(Name = "supportsHttps")]
public bool SupportsHttps { get; init; }
/// <summary>
/// Anonymity level.
/// 1 - Anonymous
/// 0 - Not Anonymous
/// <see cref="IsAnonymous"/>
/// </summary>
[DataMember(Name = "anonymityLevel")]
public int AnonymityLevel { get; init; }
/// <summary>
/// Indicates whether this proxy is anonymous.
/// </summary>
public bool IsAnonymous => AnonymityLevel == 1;
/// <summary>
/// Supported proxy protocol.
/// </summary>
[DataMember(Name = "protocol")]
public Protocols Protocol { get; init; }
/// <summary>
/// The proxy IP address.
/// </summary>
[DataMember(Name = "ip")]
public string? IpAddress { get; init; }
/// <summary>
/// The proxy port number.
/// </summary>
[DataMember(Name = "port")]
public int Port { get; init; }
/// <summary>
/// List of websites that work (and don't work) through this proxy.
/// </summary>
[DataMember(Name = "websites")]
public Dictionary<string, bool> Websites { get; init; } = [];
/// <summary>
/// Country this proxy is coming from.
/// </summary>
[DataMember(Name = "country")]
public string? Country { get; init; }
/// <summary>
/// Combination of the <see cref="IpAddress"/> and the <see cref="Port"/>.
/// </summary>
public string IpAddressAndPort => $"{IpAddress}:{Port}";
/// <summary>
/// Ready to use CURLOPT_PROXY value.
/// </summary>
public string Curl => $"{(SupportsHttps ? "https" : "http")}://{IpAddressAndPort}";
}