119 lines
2.5 KiB
Java
119 lines
2.5 KiB
Java
package com.mogo.httpdns;
|
||
|
||
import android.content.Context;
|
||
|
||
import androidx.annotation.Keep;
|
||
import androidx.annotation.Nullable;
|
||
|
||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||
import com.mogo.utils.network.HttpDns;
|
||
|
||
import java.util.Collection;
|
||
import java.util.List;
|
||
|
||
/**
|
||
* @author congtaowang
|
||
* @since 2020/11/18
|
||
*
|
||
* http 请求做http dns转换
|
||
*/
|
||
@Keep
|
||
public interface IMogoHttpDns extends IProvider {
|
||
|
||
/**
|
||
* 获取 dns 代理实例
|
||
*
|
||
* @return
|
||
*/
|
||
@Keep
|
||
@Nullable
|
||
HttpDns dns();
|
||
|
||
// /**
|
||
// * 获取缓存中的 dns ip地址
|
||
// *
|
||
// * @param host
|
||
// * @return
|
||
// */
|
||
// @Nullable
|
||
// String getCachedHttpDnsIps( String host );
|
||
|
||
/**
|
||
* 获取缓存中的dns ip地址
|
||
* @param host domain
|
||
* @param type 类型
|
||
* @return
|
||
*/
|
||
@Keep
|
||
String getCachedHttpDnsIps(String host, int type);
|
||
//
|
||
// /**
|
||
// * dns 解析
|
||
// *
|
||
// * @param host 域名
|
||
// * @param useCache 是否使用缓存,是 - 如果没有缓存,则解析新地址、否 - 解析新地址,并将新地址缓存
|
||
// * @param callback
|
||
// */
|
||
// void getHttpDnsIp( String host, boolean useCache, IHttpDnsCallback callback );
|
||
|
||
/**
|
||
* dns解析
|
||
* @param host
|
||
* @param type
|
||
* @param useCache
|
||
* @param callback
|
||
*/
|
||
@Keep
|
||
void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback);
|
||
|
||
/**
|
||
* 同步进行dns解析,无需回调
|
||
* @param host
|
||
* @param type
|
||
* @param useCache
|
||
*
|
||
* @return ip:port
|
||
*/
|
||
String syncGetHttpDns(String host, int type, boolean useCache);
|
||
|
||
// /**
|
||
// * 监听 ttl 回调
|
||
// *
|
||
// * @param host 域名
|
||
// * @param callback
|
||
// */
|
||
// void addHttpDnsTtlCallback( String host, IHttpDnsTtlCallback callback );
|
||
|
||
/**
|
||
* 监听ttl回调
|
||
* @param host
|
||
* @param type
|
||
* @param callback
|
||
*/
|
||
@Keep
|
||
void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback);
|
||
|
||
// /**
|
||
// * 注销 ttl 回调
|
||
// *
|
||
// * @param host 域名
|
||
// */
|
||
// void removeHttpDnsTtlCallback( String host );
|
||
|
||
/**
|
||
* 注销ttl回调
|
||
* @param host
|
||
* @param type
|
||
*/
|
||
@Keep
|
||
void removeHttpDnsTtlCallback(String host,int type);
|
||
|
||
/**
|
||
* 初始化
|
||
*
|
||
* @param context 上下文
|
||
* @param locationChanged 定位发生变化
|
||
*/
|
||
void init(Context context, IHttpDnsLocationChanged locationChanged);
|
||
}
|