Closed 05nelsonm closed 9 months ago
Adding the blocked
label until #137 is completed which will add the exceptions needed to binary-core
This should also contain an Installer
interface and the aliases for tor
, geoip
and geoip6
so that kmp-tor
only needs to depend on binary-api
and binary-core
. Library consumer can then update binary
w/o the need to update kmp-tor
as well as using their own tor resources if they wish.
public abstract class Installer<P: Paths>(public val installationDir: String) {
@Throws(IOException::class)
public abstract fun install(): P
public abstract class Paths private constructor() {
public class Tor(
@JvmField
public val tor: String,
@JvmField
public val geoip: String,
@JvmField
public val geoip6: String,
): Paths()
}
}
For kmp-tor
can then do something like
public class KmpTorDirs(
@JvmField
public val workDir: File,
@JvmField
public val cacheDir: File,
private val installerProvider: (installationDirPath: String) -> Installer<Installer.Paths.Tor>
) {
@JvmField
public val installationDir: File = workDir.resolve(".kmptor")
@get:JvmName("installer")
public val installer: Installer<Installer.Paths.Tor> by lazy {
installerProvider(installationDir.path)
}
}
Need to expose some things w/o exposing
binary-core
's API such as File system exceptions.