public class MogoHttpDnsClient implements IMogoHttpDns
public static MogoHttpDnsClient INSTANCE
public void init(@NotNull
MogoHttpDnsConfig config)
@Nullable
public java.lang.String getHttpDnsAddressUseCacheIfNecessary(int type,
@NotNull
java.lang.String _host)
先从本地缓存中根据type和host获取ip:port,如果本地缓存中没有,再通过网络获取
@Nullable
public java.lang.String getHttpDnsAddress(int type,
@NotNull
java.lang.String _host)
根据类型和host获取IP,直接通过网络请求获取全部路由表 同时多线程多次请求会忽略部分网络请求,一定程度减少接口请求次数
type - HTTP_DNS_TYPE_HTTP用于请求http接口 HTTP_DNS_TYPE_WS用于webSocket长连接 若增加新类型,可自行设置@Nullable
public java.lang.String getHttpDnsCachedAddress(int type,
@NotNull
java.lang.String _host)
根据类型和host获取本地cache的路由表
type - HTTP_DNS_TYPE_HTTP用于请求http接口 HTTP_DNS_TYPE_WS用于webSocket长连接 若增加新类型,可自行设置@Nullable public java.util.Map<java.lang.String,java.lang.String> getAllAddress()
获取全部路由表
public void release()