Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
compscidr committed Dec 19, 2024
1 parent fb4bd81 commit 7d77fb3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ object DummyTrafficAccount : TrafficAccounting {
override fun recordFromInternet(bytes: Long) {
// do nothing
}
}
}
4 changes: 2 additions & 2 deletions core/src/main/kotlin/com/jasonernst/kanonproxy/KAnonProxy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import java.util.concurrent.atomic.AtomicBoolean
class KAnonProxy(
val icmp: Icmp,
val protector: VpnProtector = DummyProtector,
val trafficAccounting: TrafficAccounting = DummyTrafficAccount
val trafficAccounting: TrafficAccounting = DummyTrafficAccount,
) : SessionManager {
private val logger = LoggerFactory.getLogger(javaClass)

Expand Down Expand Up @@ -213,7 +213,7 @@ class KAnonProxy(
protector,
this,
clientAddress,
trafficAccounting
trafficAccounting,
)
}
if (isNewSession) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package com.jasonernst.kanonproxy

interface TrafficAccounting {
fun recordToInternet(bytes: Long)

fun recordFromInternet(bytes: Long)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.jasonernst.kanonproxy.tcp

import com.jasonernst.kanonproxy.ChangeRequest
import com.jasonernst.kanonproxy.DummyTrafficAccount
import com.jasonernst.kanonproxy.SessionManager
import com.jasonernst.kanonproxy.TrafficAccounting
import com.jasonernst.kanonproxy.VpnProtector
Expand All @@ -27,7 +26,7 @@ class AnonymousTcpSession(
protector: VpnProtector,
sessionManager: SessionManager,
clientAddress: InetSocketAddress,
trafficAccounting: TrafficAccounting
trafficAccounting: TrafficAccounting,
) : TcpSession(
initialIpHeader = initialIpHeader,
initialTransportHeader = initialTransportHeader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UdpSession(
protector: VpnProtector,
sessionManager: SessionManager,
clientAddress: InetSocketAddress,
trafficAccounting: TrafficAccounting
trafficAccounting: TrafficAccounting,
) : Session(
initialIpHeader = initialIpHeader,
initialTransportHeader = initialTransportHeader,
Expand All @@ -40,7 +40,7 @@ class UdpSession(
protector = protector,
sessionManager = sessionManager,
clientAddress = clientAddress,
trafficAccounting = trafficAccounting
trafficAccounting = trafficAccounting,
) {
private val logger = LoggerFactory.getLogger(javaClass)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ class AnonymousTcpSessionTest {
val sessionManager = mockk<SessionManager>()
every { sessionManager.isRunning() } returns true

val session = AnonymousTcpSession(ipHeader, tcpHeader, ByteArray(0), returnQueue, DummyProtector, sessionManager, clientAddress, DummyTrafficAccount)
val session =
AnonymousTcpSession(
ipHeader,
tcpHeader,
ByteArray(0),
returnQueue,
DummyProtector,
sessionManager,
clientAddress,
DummyTrafficAccount,
)

// wait until its connecting
while (session.isConnecting.get().not()) {
Expand All @@ -54,7 +64,17 @@ class AnonymousTcpSessionTest {
)
val tcpHeader2 = TcpHeader(syn = true, destinationPort = 80u)
val returnQueue2 = LinkedBlockingDeque<Packet>()
val session2 = AnonymousTcpSession(ipHeader2, tcpHeader2, ByteArray(0), returnQueue2, DummyProtector, sessionManager, clientAddress, DummyTrafficAccount)
val session2 =
AnonymousTcpSession(
ipHeader2,
tcpHeader2,
ByteArray(0),
returnQueue2,
DummyProtector,
sessionManager,
clientAddress,
DummyTrafficAccount,
)

// wait until its connecting
while (session2.isConnecting.get().not()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TcpClient(
mockk(relaxed = true),
mockk(relaxed = true),
clientAddress,
DummyTrafficAccount
DummyTrafficAccount,
) {
private val clientId = UUID.randomUUID()
private val logger = LoggerFactory.getLogger(javaClass)
Expand Down

0 comments on commit 7d77fb3

Please sign in to comment.