Skip to content

Commit 8f460b1

Browse files
committed
Fixed async methods return types
1 parent 34deffe commit 8f460b1

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

IP2ProxyComponent/IP2ProxyComponent/IP2Proxy.vb

Lines changed: 28 additions & 28 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 Async Function IsProxyAsync(IP As String) As Task(Of ProxyResult)
177+
Public Async Function IsProxyAsync(IP As String) As Task(Of Integer)
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 Await ProxyQueryAsync(IP, Modes.IS_PROXY)
182+
Return (Await ProxyQueryAsync(IP, Modes.IS_PROXY)).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 Async Function GetCountryShortAsync(IP As String) As Task(Of ProxyResult)
192-
Return Await ProxyQueryAsync(IP, Modes.COUNTRY_SHORT)
191+
Public Async Function GetCountryShortAsync(IP As String) As Task(Of String)
192+
Return (Await ProxyQueryAsync(IP, Modes.COUNTRY_SHORT)).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 Async Function GetCountryLongAsync(IP As String) As Task(Of ProxyResult)
202-
Return Await ProxyQueryAsync(IP, Modes.COUNTRY_LONG)
201+
Public Async Function GetCountryLongAsync(IP As String) As Task(Of String)
202+
Return (Await ProxyQueryAsync(IP, Modes.COUNTRY_LONG)).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 Async Function GetRegionAsync(IP As String) As Task(Of ProxyResult)
212-
Return Await ProxyQueryAsync(IP, Modes.REGION)
211+
Public Async Function GetRegionAsync(IP As String) As Task(Of String)
212+
Return (Await ProxyQueryAsync(IP, Modes.REGION)).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 Async Function GetCityAsync(IP As String) As Task(Of ProxyResult)
222-
Return Await ProxyQueryAsync(IP, Modes.CITY)
221+
Public Async Function GetCityAsync(IP As String) As Task(Of String)
222+
Return (Await ProxyQueryAsync(IP, Modes.CITY)).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 Async Function GetISPAsync(IP As String) As Task(Of ProxyResult)
232-
Return Await ProxyQueryAsync(IP, Modes.ISP)
231+
Public Async Function GetISPAsync(IP As String) As Task(Of String)
232+
Return (Await ProxyQueryAsync(IP, Modes.ISP)).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 Async Function GetProxyTypeAsync(IP As String) As Task(Of ProxyResult)
242-
Return Await ProxyQueryAsync(IP, Modes.PROXY_TYPE)
241+
Public Async Function GetProxyTypeAsync(IP As String) As Task(Of String)
242+
Return (Await ProxyQueryAsync(IP, Modes.PROXY_TYPE)).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 Async Function GetDomainAsync(IP As String) As Task(Of ProxyResult)
252-
Return Await ProxyQueryAsync(IP, Modes.DOMAIN)
251+
Public Async Function GetDomainAsync(IP As String) As Task(Of String)
252+
Return (Await ProxyQueryAsync(IP, Modes.DOMAIN)).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 Async Function GetUsageTypeAsync(IP As String) As Task(Of ProxyResult)
262-
Return Await ProxyQueryAsync(IP, Modes.USAGE_TYPE)
261+
Public Async Function GetUsageTypeAsync(IP As String) As Task(Of String)
262+
Return (Await ProxyQueryAsync(IP, Modes.USAGE_TYPE)).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 Async Function GetASNAsync(IP As String) As Task(Of ProxyResult)
272-
Return Await ProxyQueryAsync(IP, Modes.ASN)
271+
Public Async Function GetASNAsync(IP As String) As Task(Of String)
272+
Return (Await ProxyQueryAsync(IP, Modes.ASN)).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 Async Function GetASAsync(IP As String) As Task(Of ProxyResult)
282-
Return Await ProxyQueryAsync(IP, Modes.AS)
281+
Public Async Function GetASAsync(IP As String) As Task(Of String)
282+
Return (Await ProxyQueryAsync(IP, Modes.AS)).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 Async Function GetLastSeenAsync(IP As String) As Task(Of ProxyResult)
292-
Return Await ProxyQueryAsync(IP, Modes.LAST_SEEN)
291+
Public Async Function GetLastSeenAsync(IP As String) As Task(Of String)
292+
Return (Await ProxyQueryAsync(IP, Modes.LAST_SEEN)).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 Async Function GetThreatAsync(IP As String) As Task(Of ProxyResult)
302-
Return Await ProxyQueryAsync(IP, Modes.THREAT)
301+
Public Async Function GetThreatAsync(IP As String) As Task(Of String)
302+
Return (Await ProxyQueryAsync(IP, Modes.THREAT)).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 Async Function GetProviderAsync(IP As String) As Task(Of ProxyResult)
312-
Return Await ProxyQueryAsync(IP, Modes.PROVIDER)
311+
Public Async Function GetProviderAsync(IP As String) As Task(Of String)
312+
Return (Await ProxyQueryAsync(IP, Modes.PROVIDER)).Provider
313313
End Function
314314

315315
'Description: Returns all results

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.1</Version>
7+
<Version>4.0.2</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>Fixed async methods</PackageReleaseNotes>
18+
<PackageReleaseNotes>Fixed async methods return types</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)