Commit c7fed897 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Don't rely on the count of received packets as some may not be dns packets

parent 45a09f0e
Pipeline #5844 passed with stage
in 2 minutes and 3 seconds
......@@ -35,6 +35,7 @@ class ProxyHttpsHandler(
AbstractHttpsDNSHandle(serverConfigurations, connectTimeout) {
override val handlesSpecificRequests: Boolean = ProxyBypassHandler.knownSearchDomains.isNotEmpty()
private val dummyUpstreamAddress = UpstreamAddress(AddressCreator.fromHostAddress("0.0.0.0"), 1)
private var queryCount = 0
override fun name(): String {
return "ProxyHttpsHandler"
......@@ -75,7 +76,7 @@ class ProxyHttpsHandler(
}
override suspend fun remapDestination(destinationAddress: InetAddress, port: Int): UpstreamAddress {
queryCountCallback?.invoke(dnsPacketProxy?.tunnelHandle?.trafficStats?.packetsReceivedFromDevice?.toInt() ?: 0)
queryCountCallback?.invoke(++queryCount)
return dummyUpstreamAddress
}
......
......@@ -47,6 +47,7 @@ class ProxyTlsHandler(
override val handlesSpecificRequests: Boolean =
ProxyBypassHandler.knownSearchDomains.isNotEmpty()
private val hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier()
private var queryCount = 0
override suspend fun forwardDnsQuestion(
deviceWriteToken: DeviceWriteToken,
......@@ -89,7 +90,7 @@ class ProxyTlsHandler(
}
override suspend fun remapDestination(destinationAddress: InetAddress, port: Int): TLSUpstreamAddress {
queryCountCallback?.invoke(dnsPacketProxy?.tunnelHandle?.trafficStats?.packetsReceivedFromDevice?.toInt() ?: 0)
queryCountCallback?.invoke(++queryCount)
return upstreamAddresses[0]
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment