diff --git a/pom.xml b/pom.xml index 19e4a98..1725458 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.berndpruenster.netlayer parent - 0.6.5 + 0.6.6 pom Netlayer @@ -17,7 +17,7 @@ UTF-8 3.7.0 - 8.0.8 + 0.4.0.5 diff --git a/tor.external/pom.xml b/tor.external/pom.xml index b484fc9..6307e61 100644 --- a/tor.external/pom.xml +++ b/tor.external/pom.xml @@ -6,7 +6,7 @@ org.berndpruenster.netlayer parent - 0.6.5 + 0.6.6 tor.external diff --git a/tor.native/pom.xml b/tor.native/pom.xml index 872f6a0..9597b2b 100644 --- a/tor.native/pom.xml +++ b/tor.native/pom.xml @@ -6,7 +6,7 @@ org.berndpruenster.netlayer parent - 0.6.5 + 0.6.6 tor.native @@ -34,6 +34,16 @@ tor-binary-linux64 ${tor-binary.version} + + com.github.JesusMcCloud.tor-binary + tor-binary-linux-armhf + ${tor-binary.version} + + + com.github.JesusMcCloud.tor-binary + tor-binary-linux-arm64 + ${tor-binary.version} + com.github.JesusMcCloud.tor-binary tor-binary-windows diff --git a/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/NativeTor.kt b/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/NativeTor.kt index 0db5711..44e7f56 100644 --- a/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/NativeTor.kt +++ b/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/NativeTor.kt @@ -44,6 +44,8 @@ private const val BINARY_TOR_LNX = "tor" private const val PATH_LNX = "linux/" private const val PATH_LNX64 = "${PATH_LNX}x64/" private const val PATH_LNX32 = "${PATH_LNX}x86/" +private const val PATH_LNXARMHF = "${PATH_LNX}armhf/" +private const val PATH_LNXARM64 = "${PATH_LNX}arm64/" private const val PATH_MACOS = "osx/" private const val PATH_MACOS64 = "${PATH_MACOS}x64/" private const val PATH_WIN = "windows/" @@ -53,7 +55,7 @@ private const val PATH_NATIVE = "native/" private const val OS_UNSUPPORTED = "We don't support Tor on this OS" class NativeTor @JvmOverloads @Throws(TorCtlException::class) constructor(workingDirectory: File, bridgeLines: Collection? = null, torrcOverrides: Torrc? = null, automaticShutdown : Boolean = true) : Tor() { - + private val context : NativeContext = NativeContext(workingDirectory, torrcOverrides) private val bridgeConfig: List = bridgeLines?.filter { it.length > 10 } ?: emptyList() @@ -151,6 +153,8 @@ class NativeContext(workingDirectory: File, overrides: Torrc?) : TorContext(work OsType.MACOS -> PATH_NATIVE + PATH_MACOS64 OsType.LNX32 -> PATH_NATIVE + PATH_LNX32 OsType.LNX64 -> PATH_NATIVE + PATH_LNX64 + OsType.LNXARMHF -> PATH_NATIVE + PATH_LNXARMHF + OsType.LNXARM64 -> PATH_NATIVE + PATH_LNXARM64 else -> throw RuntimeException(OS_UNSUPPORTED) } } @@ -159,7 +163,7 @@ class NativeContext(workingDirectory: File, overrides: Torrc?) : TorContext(work when (OsType.current) { OsType.WIN -> PATH_NATIVE + PATH_WIN OsType.MACOS -> PATH_NATIVE + PATH_MACOS - OsType.LNX32, OsType.LNX64 -> PATH_NATIVE + PATH_LNX + OsType.LNX32, OsType.LNX64, OsType.LNXARMHF, OsType.LNXARM64 -> PATH_NATIVE + PATH_LNX else -> throw RuntimeException(OS_UNSUPPORTED) } } @@ -167,7 +171,7 @@ class NativeContext(workingDirectory: File, overrides: Torrc?) : TorContext(work override val torExecutableFileName: String by lazy { when (OsType.current) { - OsType.LNX32, OsType.LNX64 -> BINARY_TOR_LNX + OsType.LNX32, OsType.LNX64, OsType.LNXARMHF, OsType.LNXARM64 -> BINARY_TOR_LNX OsType.WIN -> BINARY_TOR_WIN OsType.MACOS -> BINARY_TOR_MACOS else -> throw RuntimeException(OS_UNSUPPORTED) @@ -182,7 +186,7 @@ class NativeContext(workingDirectory: File, overrides: Torrc?) : TorContext(work override fun installFiles() { super.installFiles() when (OsType.current) { - OsType.WIN, OsType.LNX32, OsType.LNX64, OsType.MACOS -> extractContentFromArchive(workingDirectory, + OsType.WIN, OsType.LNX32, OsType.LNX64, OsType.LNXARMHF, OsType.LNXARM64, OsType.MACOS -> extractContentFromArchive(workingDirectory, getByName( pathToTorExecutable + FILE_ARCHIVE)) else -> throw RuntimeException(OS_UNSUPPORTED) diff --git a/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/TorContext.kt b/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/TorContext.kt index dfd28d6..6a0cb0e 100644 --- a/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/TorContext.kt +++ b/tor.native/src/main/kotlin/org/berndpruenster/netlayer/tor/TorContext.kt @@ -238,7 +238,7 @@ abstract class TorContext @Throws(IOException::class) protected constructor(val val environment = processBuilder.environment() environment.put("HOME", workingDirectory.absolutePath) when (OsType.current) { - OsType.LNX32, OsType.LNX64 -> + OsType.LNX32, OsType.LNX64, OsType.LNXARMHF, OsType.LNXARM64 -> // We have to provide the LD_LIBRARY_PATH because when looking // for dynamic libraries // Linux apparently will not look in the current directory by diff --git a/tor/pom.xml b/tor/pom.xml index e4e3b1c..866d0ed 100644 --- a/tor/pom.xml +++ b/tor/pom.xml @@ -6,7 +6,7 @@ org.berndpruenster.netlayer parent - 0.6.5 + 0.6.6 tor diff --git a/tor/src/main/kotlin/org/berndpruenster/netlayer/tor/OsType.kt b/tor/src/main/kotlin/org/berndpruenster/netlayer/tor/OsType.kt index 92b9c1e..e9d184f 100644 --- a/tor/src/main/kotlin/org/berndpruenster/netlayer/tor/OsType.kt +++ b/tor/src/main/kotlin/org/berndpruenster/netlayer/tor/OsType.kt @@ -40,6 +40,8 @@ import java.util.* enum class OsType { WIN, LNX32, LNX64, + LNXARMHF, + LNXARM64, MACOS, ANDROID; @@ -86,6 +88,12 @@ enum class OsType { WIN, if (unameOutput.compareTo("x86_64") == 0) { return LNX64 } + if (unameOutput.matches(Regex("arm.+"))) { + return LNXARMHF + } + if (unameOutput.compareTo("aarch64") == 0) { + return LNXARM64 + } throw RuntimeException("Could not understand uname output, not sure what bitness") } catch (e: IOException) { throw RuntimeException("Uname failure", e) @@ -99,7 +107,6 @@ enum class OsType { WIN, } fun isUnixoid(): Boolean { - return listOf(LNX32, LNX64, MACOS).contains(this) + return listOf(LNX32, LNX64, LNXARMHF, LNXARM64, MACOS).contains(this) } } -