Skip to content

Commit

Permalink
avoid sending sentinal packet to OS
Browse files Browse the repository at this point in the history
  • Loading branch information
compscidr committed Dec 6, 2024
1 parent 07ac465 commit dcdedf1
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.jasonernst.kanonproxy.KAnonProxy
import com.jasonernst.kanonproxy.VpnProtector
import com.jasonernst.knet.Packet
import com.jasonernst.knet.Packet.Companion.parseStream
import com.jasonernst.knet.SentinelPacket
import com.jasonernst.knet.network.ip.IpType
import com.jasonernst.knet.transport.TransportHeader
import com.jasonernst.knet.transport.tcp.TcpHeader
Expand Down Expand Up @@ -161,6 +162,12 @@ class PacketDumperVpnService: VpnService(), VpnProtector, VpnUiService, Connecte
private fun readFromInternetWriteToOS(outputStream: AutoCloseOutputStream) {
while (running.get()) {
val packet = kAnonProxy.takeResponse(clientAddress)

if (packet is SentinelPacket) {
logger.warn("GOT SENTINAL")
continue
}

logger.debug("Got packet from proxy: {}", packet.nextHeaders)
if (packet.ipHeader == null || packet.nextHeaders == null || packet.payload == null) {
logger.warn("Packet is missing headers or payload, skipping")
Expand Down

0 comments on commit dcdedf1

Please sign in to comment.