1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mosiyash\HidemeParser; |
4
|
|
|
|
5
|
|
|
final class Ip |
6
|
|
|
{ |
7
|
|
|
public const TYPE_HTTP = 'HTTP'; |
8
|
|
|
public const TYPE_HTTPS = 'HTTPS'; |
9
|
|
|
public const TYPE_SOCKS4 = 'SOCKS4'; |
10
|
|
|
public const TYPE_SOCKS5 = 'SOCKS5'; |
11
|
|
|
|
12
|
|
|
public const ANONIMITY_HIGH = 'high'; |
13
|
|
|
public const ANONIMITY_MEDIUM = 'medium'; |
14
|
|
|
public const ANONIMITY_LOW = 'low'; |
15
|
|
|
public const ANONIMITY_NO = 'no'; |
16
|
|
|
|
17
|
|
|
public static $anonimityValues = [ |
18
|
|
|
// Russian |
19
|
|
|
'Высокая' => self::ANONIMITY_HIGH, |
20
|
|
|
'Средняя' => self::ANONIMITY_MEDIUM, |
21
|
|
|
'Низкая' => self::ANONIMITY_LOW, |
22
|
|
|
'Нет' => self::ANONIMITY_NO, |
23
|
|
|
|
24
|
|
|
// English |
25
|
|
|
'High' => self::ANONIMITY_HIGH, |
26
|
|
|
'Medium' => self::ANONIMITY_MEDIUM, |
27
|
|
|
'Low' => self::ANONIMITY_LOW, |
28
|
|
|
'No' => self::ANONIMITY_NO, |
29
|
|
|
|
30
|
|
|
// Ukrainian |
31
|
|
|
'Висока' => self::ANONIMITY_HIGH, |
32
|
|
|
'Середня' => self::ANONIMITY_MEDIUM, |
33
|
|
|
'Низька' => self::ANONIMITY_LOW, |
34
|
|
|
'Немає' => self::ANONIMITY_NO, |
35
|
|
|
|
36
|
|
|
// Español |
37
|
|
|
'Alto' => self::ANONIMITY_HIGH, |
38
|
|
|
'Medio' => self::ANONIMITY_MEDIUM, |
39
|
|
|
'Bajo' => self::ANONIMITY_LOW, |
40
|
|
|
]; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
private $address; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var int |
49
|
|
|
*/ |
50
|
|
|
private $port; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
private $country; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var null|string |
59
|
|
|
*/ |
60
|
|
|
private $city; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var int |
64
|
|
|
*/ |
65
|
|
|
private $speed; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var string |
69
|
|
|
*/ |
70
|
|
|
private $type; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var string |
74
|
|
|
*/ |
75
|
|
|
private $anonimity; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Ip constructor. |
79
|
|
|
* |
80
|
|
|
* @param string $address |
81
|
|
|
* @param int $port |
82
|
|
|
* @param string $country |
83
|
|
|
* @param null|string $city |
84
|
|
|
* @param int $speed |
85
|
|
|
* @param string $type |
86
|
|
|
* @param string $anonimity |
87
|
|
|
*/ |
88
|
|
|
public function __construct( |
89
|
|
|
string $address, |
90
|
|
|
int $port, |
91
|
|
|
string $country, |
92
|
|
|
?string $city, |
93
|
|
|
int $speed, |
94
|
|
|
string $type, |
95
|
|
|
string $anonimity |
96
|
|
|
) { |
97
|
|
|
$this->address = $address; |
98
|
|
|
$this->port = $port; |
99
|
|
|
$this->country = $country; |
100
|
|
|
$this->city = $city; |
101
|
|
|
$this->speed = $speed; |
102
|
|
|
$this->type = $type; |
103
|
|
|
$this->anonimity = $anonimity; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
|
|
public function getAddress(): string |
110
|
|
|
{ |
111
|
|
|
return $this->address; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return int |
116
|
|
|
*/ |
117
|
|
|
public function getPort(): int |
118
|
|
|
{ |
119
|
|
|
return $this->port; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return string |
124
|
|
|
*/ |
125
|
|
|
public function getCountry(): string |
126
|
|
|
{ |
127
|
|
|
return $this->country; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return null|string |
132
|
|
|
*/ |
133
|
|
|
public function getCity(): ?string |
134
|
|
|
{ |
135
|
|
|
return $this->city; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return int |
140
|
|
|
*/ |
141
|
|
|
public function getSpeed(): int |
142
|
|
|
{ |
143
|
|
|
return $this->speed; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
public function getType(): string |
150
|
|
|
{ |
151
|
|
|
return $this->type; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return string |
156
|
|
|
*/ |
157
|
|
|
public function getAnonimity(): string |
158
|
|
|
{ |
159
|
|
|
return $this->anonimity; |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|