[master将DNS拦截器去除改为请求头方式请求eagle-dns接口,由服务端进行分发请求

This commit is contained in:
xuxinchao
2023-01-19 16:12:58 +08:00
parent a5a0144bac
commit 2a6a914c4a
10 changed files with 52 additions and 34 deletions

View File

@@ -0,0 +1,11 @@
package com.mogo.cloud.live.constant;
public class LiveHostConst {
public static final String HOST_EAGLE_QA = "http://eagle-dns-qa.zhidaozhixing.com/";
public static String getEagleHost(){
return HOST_EAGLE_QA;
}
}

View File

@@ -5,6 +5,7 @@ import static com.mogo.cloud.live.constant.LiveConstant.FRONT_CAMERA;
import com.elegant.log.simplelog.Logger;
import com.google.gson.Gson;
import com.mogo.cloud.live.constant.LiveConstant;
import com.mogo.cloud.live.constant.LiveHostConst;
import com.mogo.cloud.live.listener.IRequestLiveListener;
import com.mogo.cloud.live.model.BaseData;
import com.mogo.cloud.live.model.Camera;
@@ -35,7 +36,7 @@ public class RequestLiveManager {
private final LiveApiServer liveApiServer;
private RequestLiveManager() {
liveApiServer = RetrofitFactory.INSTANCE.getInstance(NetConstants.DEVA_HOST) //todo 涉及直播接口 没有对HttpDNS进行配置
liveApiServer = RetrofitFactory.INSTANCE.getInstance(LiveHostConst.getEagleHost())
.create(LiveApiServer.class);
}

View File

@@ -27,7 +27,7 @@ public interface LiveApiServer {
* @return {@link BaseData}
*/
@FormUrlEncoded
@POST("/dataSave/integratedServices/app/push/no/livePushAndSwitch/v1")
@POST("eagle-eye-dns/dataSave/integratedServices/app/push/no/livePushAndSwitch/v1")
Observable<BaseData> getDesignativeVehicleLive(@FieldMap Map<String, String> designativeVehicleHeadLiveMap);
/**
@@ -37,7 +37,7 @@ public interface LiveApiServer {
* @return {@link BaseData}
*/
@FormUrlEncoded
@POST("yycp-geo-fence-carService/front/car")
@POST("eagle-eye-dns/yycp-geo-fence-carService/front/car")
Observable<BaseData<LiveReceive>> getFrontVehicleLive(@FieldMap Map<String, String> frontVehicleHeadLiveMap);
/**
@@ -47,7 +47,7 @@ public interface LiveApiServer {
* @return {@link BaseData}
*/
@FormUrlEncoded
@POST("yycp-geo-fence-carService/front/crossing")
@POST("eagle-eye-dns/yycp-geo-fence-carService/front/crossing")
Observable<BaseData<LiveReceive>> getFrontIntersectionLive(@FieldMap Map<String, String> frontIntersectionLiveMap);
/**
@@ -55,7 +55,7 @@ public interface LiveApiServer {
*
* @return {@link BaseData}
*/
@GET("mec-etl-server/device/unit/camera/live")
@GET("eagle-eye-dns/mec-etl-server/device/unit/camera/live")
Observable<BaseData<LiveCamera>> getDesignativeIntersectionLive(@QueryMap Map<String, Object> parameters);
/**
@@ -63,6 +63,6 @@ public interface LiveApiServer {
*
* @return {@link BaseData}
*/
@POST("alarm/car/video/reportCameraStatus")
@POST("eagle-eye-dns/alarm/car/video/reportCameraStatus")
Observable<BaseData> reportCameraStatus(@Body RequestBody parameters);
}

View File

@@ -25,7 +25,6 @@ class OkHttpFactory private constructor() {
OkHttpClient.Builder()
.addNetworkInterceptor(HttpHeaderInterceptor())
.addNetworkInterceptor(HttpLoggingInterceptor())
.addInterceptor(HttpDnsInterceptor())
.addInterceptor(HttpPassportInterceptor())
.sslSocketFactory(createSSLSocketFactory(), createTrustAllManager())
.hostnameVerifier(SSLSocketFactoryUtils.TrustAllHostnameVerifier())

View File

@@ -1,5 +1,6 @@
package com.mogo.cloud.network.interceptor
import com.mogo.cloud.httpdns.MogoHttpDnsConfig
import com.mogo.cloud.passport.MoGoAiCloudClient
import okhttp3.Interceptor
import okhttp3.Response
@@ -13,8 +14,14 @@ class HttpHeaderInterceptor : Interceptor {
val original = chain.request()
val request = original.newBuilder()
.header("token", MoGoAiCloudClient.getInstance().aiCloudClientConfig.token)
.header("cityCode", MoGoAiCloudClient.getInstance().aiCloudClientConfig.iHttpDnsCurrentLocation.getCurrentLocation()?.cityCode.toString())
.header("lat",MoGoAiCloudClient.getInstance().aiCloudClientConfig.iHttpDnsCurrentLocation.getCurrentLocation()?.lat.toString())
.header("lon",MoGoAiCloudClient.getInstance().aiCloudClientConfig.iHttpDnsCurrentLocation.getCurrentLocation()?.lon.toString())
.header("env",MoGoAiCloudClient.getInstance().aiCloudClientConfig.netMode.toString())
.header("sn",MoGoAiCloudClient.getInstance().aiCloudClientConfig.sn)
.method(original.method(), original.body())
.build()
return chain.proceed(request)
}
}

View File

@@ -95,18 +95,18 @@ public class MoGoAiCloudClient {
mAiCloudClientConfig.setToken(token);
}
// 初始化HttpDNS
if (mHttpDnsConfig == null) {
mHttpDnsConfig =
new MogoHttpDnsConfig()
.setContext(mContext)
.setSn(mAiCloudClientConfig.getSn())
.setEnv(mAiCloudClientConfig.getNetMode())
.setShowDebugLog(mAiCloudClientConfig.isShowDebugLog())
.setCurrentLocation(mAiCloudClientConfig.getIHttpDnsCurrentLocation())
.setLoopCheckDelay(mAiCloudClientConfig.getLoopCheckDelay());
MogoHttpDnsClient.INSTANCE.init(mHttpDnsConfig);
}
// // 初始化HttpDNS
// if (mHttpDnsConfig == null) {
// mHttpDnsConfig =
// new MogoHttpDnsConfig()
// .setContext(mContext)
// .setSn(mAiCloudClientConfig.getSn())
// .setEnv(mAiCloudClientConfig.getNetMode())
// .setShowDebugLog(mAiCloudClientConfig.isShowDebugLog())
// .setCurrentLocation(mAiCloudClientConfig.getIHttpDnsCurrentLocation())
// .setLoopCheckDelay(mAiCloudClientConfig.getLoopCheckDelay());
// MogoHttpDnsClient.INSTANCE.init(mHttpDnsConfig);
// }
// 循环调用将数据传出去
for (IMoGoTokenCallback tokenCallback : mTokenCallbacks) {

View File

@@ -63,7 +63,7 @@ class V2XConfig private constructor(builder: Builder) {
* - 通过[Builder.baseUrl]设置
*/
val baseUrl by lazy {
builder.baseUrl ?: "http://dzt-launcherSnapshot.zhidaozhixing.com"
builder.baseUrl ?: "http://eagle-dns.zhidaozhixing.com/"
}

View File

@@ -9,6 +9,6 @@ import retrofit2.http.POST
internal interface V2XApiService {
@FormUrlEncoded
@POST("/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync")
@POST("eagle-eye-dns/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync")
fun querySnapshotSync(@FieldMap parameters: Map<String, @JvmSuppressWildcards Any>): Maybe<V2XMarkerResponse?>
}