Table of Contents

Class BaiduIpLocatorProvider

Namespace
BootstrapBlazor.Components
Assembly
BootstrapBlazor.dll

百度搜索引擎 IP 定位器

public class BaiduIpLocatorProvider : DefaultIpLocatorProvider, IIpLocatorProvider
Inheritance
BaiduIpLocatorProvider
Implements
Derived
Inherited Members
Extension Methods

Constructors

BaiduIpLocatorProvider(IHttpClientFactory, IOptions<BootstrapBlazorOptions>, ILogger<BaiduIpLocatorProvider>)

百度搜索引擎 IP 定位器

public BaiduIpLocatorProvider(IHttpClientFactory httpClientFactory, IOptions<BootstrapBlazorOptions> options, ILogger<BaiduIpLocatorProvider> logger)

Parameters

httpClientFactory IHttpClientFactory
options IOptions<BootstrapBlazorOptions>
logger ILogger<BaiduIpLocatorProvider>

Methods

Fetch(string, HttpClient, CancellationToken)

请求获得地理位置接口方法

protected virtual Task<string?> Fetch(string url, HttpClient client, CancellationToken token)

Parameters

url string
client HttpClient
token CancellationToken

Returns

Task<string>

GetHttpClient()

获得 HttpClient 实例方法

protected virtual HttpClient GetHttpClient()

Returns

HttpClient

GetUrl(string)

获得 Url 地址

protected virtual string GetUrl(string ip)

Parameters

ip string

Returns

string

LocateByIp(string)

内部定位方法

protected override Task<string?> LocateByIp(string ip)

Parameters

ip string

Returns

Task<string>