package com.ccnet.acc

class AccVpnService {
    companion object {
        private val INSTANCE = AccVpnService()

        val instance: AccVpnService
            get() {
                return INSTANCE
            }
    }

    init {
        System.loadLibrary("ccnetacc")
    }

    external fun runAcc(
        configPath: String,
        protectPath: String,
        networkClass: String,
        callback: String
    )

    external fun testLatency(
        proxyHost: String,
        proxyPort: Int,
        testHost: String,
        intervalSec: Int,
        timeoutMillis: Int,
        callback: TestLatencyCallback
    ): Int

    external fun stopAcc()
}

interface TestLatencyCallback {
    fun onLatency(latency: Int): Boolean
}