Skip to content

Commit 1ec4132

Browse files
committed
Fixed async methods
1 parent e4950e4 commit 1ec4132

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

IP2ProxyComponent/IP2ProxyComponent/IP2Proxy.vb

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ Public Class Component
174174
End Function
175175

176176
'Description: Returns an integer to state if is proxy (async)
177-
Public Function IsProxyAsync(IP As String) As Integer
177+
Public Async Function IsProxyAsync(IP As String) As Task(Of ProxyResult)
178178
' -1 is error
179179
' 0 is not a proxy
180180
' 1 is proxy except DCH and SES
181181
' 2 is proxy and (DCH or SES)
182-
Return ProxyQueryAsync(IP, Modes.IS_PROXY).Result.Is_Proxy
182+
Return Await ProxyQueryAsync(IP, Modes.IS_PROXY)
183183
End Function
184184

185185
'Description: Returns a string for the country code
@@ -188,8 +188,8 @@ Public Class Component
188188
End Function
189189

190190
'Description: Returns a string for the country code (async)
191-
Public Function GetCountryShortAsync(IP As String) As String
192-
Return ProxyQueryAsync(IP, Modes.COUNTRY_SHORT).Result.Country_Short
191+
Public Async Function GetCountryShortAsync(IP As String) As Task(Of ProxyResult)
192+
Return Await ProxyQueryAsync(IP, Modes.COUNTRY_SHORT)
193193
End Function
194194

195195
'Description: Returns a string for the country name
@@ -198,8 +198,8 @@ Public Class Component
198198
End Function
199199

200200
'Description: Returns a string for the country name (async)
201-
Public Function GetCountryLongAsync(IP As String) As String
202-
Return ProxyQueryAsync(IP, Modes.COUNTRY_LONG).Result.Country_Long
201+
Public Async Function GetCountryLongAsync(IP As String) As Task(Of ProxyResult)
202+
Return Await ProxyQueryAsync(IP, Modes.COUNTRY_LONG)
203203
End Function
204204

205205
'Description: Returns a string for the region name
@@ -208,8 +208,8 @@ Public Class Component
208208
End Function
209209

210210
'Description: Returns a string for the region name (async)
211-
Public Function GetRegionAsync(IP As String) As String
212-
Return ProxyQueryAsync(IP, Modes.REGION).Result.Region
211+
Public Async Function GetRegionAsync(IP As String) As Task(Of ProxyResult)
212+
Return Await ProxyQueryAsync(IP, Modes.REGION)
213213
End Function
214214

215215
'Description: Returns a string for the city name
@@ -218,8 +218,8 @@ Public Class Component
218218
End Function
219219

220220
'Description: Returns a string for the city name (async)
221-
Public Function GetCityAsync(IP As String) As String
222-
Return ProxyQueryAsync(IP, Modes.CITY).Result.City
221+
Public Async Function GetCityAsync(IP As String) As Task(Of ProxyResult)
222+
Return Await ProxyQueryAsync(IP, Modes.CITY)
223223
End Function
224224

225225
'Description: Returns a string for the ISP name
@@ -228,8 +228,8 @@ Public Class Component
228228
End Function
229229

230230
'Description: Returns a string for the ISP name (async)
231-
Public Function GetISPAsync(IP As String) As String
232-
Return ProxyQueryAsync(IP, Modes.ISP).Result.ISP
231+
Public Async Function GetISPAsync(IP As String) As Task(Of ProxyResult)
232+
Return Await ProxyQueryAsync(IP, Modes.ISP)
233233
End Function
234234

235235
'Description: Returns a string for the proxy type
@@ -238,8 +238,8 @@ Public Class Component
238238
End Function
239239

240240
'Description: Returns a string for the proxy type (async)
241-
Public Function GetProxyTypeAsync(IP As String) As String
242-
Return ProxyQueryAsync(IP, Modes.PROXY_TYPE).Result.Proxy_Type
241+
Public Async Function GetProxyTypeAsync(IP As String) As Task(Of ProxyResult)
242+
Return Await ProxyQueryAsync(IP, Modes.PROXY_TYPE)
243243
End Function
244244

245245
'Description: Returns a string for the domain
@@ -248,8 +248,8 @@ Public Class Component
248248
End Function
249249

250250
'Description: Returns a string for the domain (async)
251-
Public Function GetDomainAsync(IP As String) As String
252-
Return ProxyQueryAsync(IP, Modes.DOMAIN).Result.Domain
251+
Public Async Function GetDomainAsync(IP As String) As Task(Of ProxyResult)
252+
Return Await ProxyQueryAsync(IP, Modes.DOMAIN)
253253
End Function
254254

255255
'Description: Returns a string for the usage type
@@ -258,8 +258,8 @@ Public Class Component
258258
End Function
259259

260260
'Description: Returns a string for the usage type (async)
261-
Public Function GetUsageTypeAsync(IP As String) As String
262-
Return ProxyQueryAsync(IP, Modes.USAGE_TYPE).Result.Usage_Type
261+
Public Async Function GetUsageTypeAsync(IP As String) As Task(Of ProxyResult)
262+
Return Await ProxyQueryAsync(IP, Modes.USAGE_TYPE)
263263
End Function
264264

265265
'Description: Returns a string for the ASN
@@ -268,8 +268,8 @@ Public Class Component
268268
End Function
269269

270270
'Description: Returns a string for the ASN (async)
271-
Public Function GetASNAsync(IP As String) As String
272-
Return ProxyQueryAsync(IP, Modes.ASN).Result.ASN
271+
Public Async Function GetASNAsync(IP As String) As Task(Of ProxyResult)
272+
Return Await ProxyQueryAsync(IP, Modes.ASN)
273273
End Function
274274

275275
'Description: Returns a string for the AS
@@ -278,8 +278,8 @@ Public Class Component
278278
End Function
279279

280280
'Description: Returns a string for the AS (async)
281-
Public Function GetASAsync(IP As String) As String
282-
Return ProxyQueryAsync(IP, Modes.AS).Result.AS
281+
Public Async Function GetASAsync(IP As String) As Task(Of ProxyResult)
282+
Return Await ProxyQueryAsync(IP, Modes.AS)
283283
End Function
284284

285285
'Description: Returns a string for the last seen
@@ -288,8 +288,8 @@ Public Class Component
288288
End Function
289289

290290
'Description: Returns a string for the last seen (async)
291-
Public Function GetLastSeenAsync(IP As String) As String
292-
Return ProxyQueryAsync(IP, Modes.LAST_SEEN).Result.Last_Seen
291+
Public Async Function GetLastSeenAsync(IP As String) As Task(Of ProxyResult)
292+
Return Await ProxyQueryAsync(IP, Modes.LAST_SEEN)
293293
End Function
294294

295295
'Description: Returns a string for the threat
@@ -298,8 +298,8 @@ Public Class Component
298298
End Function
299299

300300
'Description: Returns a string for the threat (async)
301-
Public Function GetThreatAsync(IP As String) As String
302-
Return ProxyQueryAsync(IP, Modes.THREAT).Result.Threat
301+
Public Async Function GetThreatAsync(IP As String) As Task(Of ProxyResult)
302+
Return Await ProxyQueryAsync(IP, Modes.THREAT)
303303
End Function
304304

305305
'Description: Returns a string for the provider
@@ -308,8 +308,8 @@ Public Class Component
308308
End Function
309309

310310
'Description: Returns a string for the provider (async)
311-
Public Function GetProviderAsync(IP As String) As String
312-
Return ProxyQueryAsync(IP, Modes.PROVIDER).Result.Provider
311+
Public Async Function GetProviderAsync(IP As String) As Task(Of ProxyResult)
312+
Return Await ProxyQueryAsync(IP, Modes.PROVIDER)
313313
End Function
314314

315315
'Description: Returns all results
@@ -318,8 +318,8 @@ Public Class Component
318318
End Function
319319

320320
'Description: Returns all results (async)
321-
Public Function GetAllAsync(IP As String) As ProxyResult
322-
Return ProxyQueryAsync(IP).Result
321+
Public Async Function GetAllAsync(IP As String) As Task(Of ProxyResult)
322+
Return Await ProxyQueryAsync(IP)
323323
End Function
324324

325325
' Description: Create memory mapped file

IP2ProxyComponent/IP2ProxyComponent/IP2ProxyComponent.vbproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<RootNamespace>IP2Proxy</RootNamespace>
55
<TargetFrameworks>netstandard2.0;net472;net48;net481;net5.0;net6.0;net7.0</TargetFrameworks>
66
<AssemblyName>IP2Proxy</AssemblyName>
7-
<Version>4.0.0</Version>
7+
<Version>4.0.1</Version>
88
<Authors>IP2Proxy.com</Authors>
99
<Company>IP2Proxy.com</Company>
1010
<Product>IP2Proxy .NET Component</Product>
@@ -15,7 +15,7 @@
1515
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1616
<PackageProjectUrl>https://www.ip2location.com/development-libraries/ip2proxy/dot-net</PackageProjectUrl>
1717
<PackageIcon>ip2proxy-logo-square-128.png</PackageIcon>
18-
<PackageReleaseNotes>Added support for reading from stream and added async IP query</PackageReleaseNotes>
18+
<PackageReleaseNotes>Fixed async methods</PackageReleaseNotes>
1919
<RepositoryUrl>https://github.com/ip2location/ip2proxy-dotnet.git</RepositoryUrl>
2020
<PackageTags>ip2proxy proxy detection</PackageTags>
2121
<RepositoryType>git</RepositoryType>

0 commit comments

Comments
 (0)