mirror of https://github.com/lizongying/my-tv.git
parent
61f62121f2
commit
f0f43e0fda
@ -1,17 +0,0 @@ |
||||
package com.lizongying.mytv.api |
||||
|
||||
|
||||
import retrofit2.Retrofit |
||||
import retrofit2.converter.gson.GsonConverterFactory |
||||
|
||||
|
||||
class BtraceClient { |
||||
private val yspUrl = "https://btrace.yangshipin.cn/" |
||||
|
||||
val yspBtraceService: YSPBtraceService by lazy { |
||||
Retrofit.Builder() |
||||
.baseUrl(yspUrl) |
||||
.addConverterFactory(GsonConverterFactory.create()) |
||||
.build().create(YSPBtraceService::class.java) |
||||
} |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
package com.lizongying.mytv.api |
||||
|
||||
import okhttp3.Dns |
||||
import java.net.InetAddress |
||||
import java.util.concurrent.ConcurrentHashMap |
||||
|
||||
class DnsCache : Dns { |
||||
private val dnsCache: MutableMap<String, List<InetAddress>> = ConcurrentHashMap() |
||||
|
||||
override fun lookup(hostname: String): List<InetAddress> { |
||||
dnsCache[hostname]?.let { |
||||
return it |
||||
} |
||||
|
||||
val addresses = InetAddress.getAllByName(hostname).toList() |
||||
|
||||
if (addresses.isNotEmpty()) { |
||||
dnsCache[hostname] = addresses |
||||
} |
||||
|
||||
return addresses |
||||
} |
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package com.lizongying.mytv.api |
||||
|
||||
import retrofit2.Retrofit |
||||
import retrofit2.converter.protobuf.ProtoConverterFactory |
||||
|
||||
|
||||
class ProtoClient { |
||||
private val protoUrl = "https://capi.yangshipin.cn/" |
||||
|
||||
val yspProtoService: YSPProtoService by lazy { |
||||
Retrofit.Builder() |
||||
.baseUrl(protoUrl) |
||||
.addConverterFactory(ProtoConverterFactory.create()) |
||||
.build().create(YSPProtoService::class.java) |
||||
} |
||||
} |
||||
Loading…
Reference in new issue