diff --git a/library/runtime-core/api/runtime-core.api b/library/runtime-core/api/runtime-core.api index 56eeef841..d4227982a 100644 --- a/library/runtime-core/api/runtime-core.api +++ b/library/runtime-core/api/runtime-core.api @@ -2915,9 +2915,10 @@ public final class io/matthewnelson/kmp/tor/runtime/core/TorConfig$__OwningContr public final class io/matthewnelson/kmp/tor/runtime/core/TorConfig$__ReloadTorrcOnSIGHUP : io/matthewnelson/kmp/tor/runtime/core/TorConfig$Setting$Builder { public static final field Companion Lio/matthewnelson/kmp/tor/runtime/core/TorConfig$__ReloadTorrcOnSIGHUP$Companion; + public field reload Z } -public final class io/matthewnelson/kmp/tor/runtime/core/TorConfig$__ReloadTorrcOnSIGHUP$Companion : io/matthewnelson/kmp/tor/runtime/core/TorConfig$Keyword { +public final class io/matthewnelson/kmp/tor/runtime/core/TorConfig$__ReloadTorrcOnSIGHUP$Companion : io/matthewnelson/kmp/tor/runtime/core/TorConfig$Setting$Factory { } public final class io/matthewnelson/kmp/tor/runtime/core/TorConfig$__SbwsExit : io/matthewnelson/kmp/tor/runtime/core/TorConfig$Setting$Builder { @@ -3498,7 +3499,7 @@ public final class io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd$Config$Rese public fun ([Lio/matthewnelson/kmp/tor/runtime/core/TorConfig$Keyword;)V } -public final class io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd$Config$Save : io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd$Unprivileged { +public final class io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd$Config$Save : io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd$Privileged { public final field force Z public fun ()V public fun (Z)V diff --git a/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/TorConfig.kt b/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/TorConfig.kt index d6380a6e7..915cf1229 100644 --- a/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/TorConfig.kt +++ b/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/TorConfig.kt @@ -675,6 +675,28 @@ public class TorConfig private constructor( ) } + /** + * [__ReloadTorrcOnSIGHUP](https://spec.torproject.org/control-spec/implementation-notes.html?highlight=__#special-config-options) + * */ + @KmpTorDsl + public class __ReloadTorrcOnSIGHUP private constructor(): Setting.Builder( + keyword = Companion, + ) { + + @JvmField + public var reload: Boolean = true + + public companion object: Setting.Factory<__ReloadTorrcOnSIGHUP, Setting>( + name = "__ReloadTorrcOnSIGHUP", + default = true.byte.toString(), + attributes = emptySet(), + isCmdLineArg = true, + isUnique = true, + factory = { __ReloadTorrcOnSIGHUP() }, + build = { build(reload.byte.toString())!! }, + ) + } + /** * [CacheDirectory](https://github.com/05nelsonm/kmp-tor-resource/blob/master/docs/tor-man.adoc#CacheDirectory) * */ @@ -1994,21 +2016,7 @@ public class TorConfig private constructor( ) } - /** - * [__ReloadTorrcOnSIGHUP](https://spec.torproject.org/control-spec/implementation-notes.html?highlight=__#special-config-options) - * */ - @KmpTorDsl - public class __ReloadTorrcOnSIGHUP private constructor(): Setting.Builder( - keyword = Companion, - ) { - public companion object: Keyword( - name = "__ReloadTorrcOnSIGHUP", - default = true.byte.toString(), - attributes = emptySet(), - isCmdLineArg = true, - isUnique = true, - ) - } + // (IMPLEMENTED) __ReloadTorrcOnSIGHUP /** * [__SbwsExit](https://spec.torproject.org/control-spec/implementation-notes.html?highlight=__#special-config-options) diff --git a/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd.kt b/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd.kt index 03051aa6c..b8046f54a 100644 --- a/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd.kt +++ b/library/runtime-core/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd.kt @@ -173,7 +173,7 @@ public sealed class TorCmd private constructor( public class Save( @JvmField public val force: Boolean, - ): Unprivileged("SAVECONF") { + ): Privileged("SAVECONF") { /** Default of [force] = `false` */ public constructor(): this(force = false) @@ -439,7 +439,6 @@ public sealed class TorCmd private constructor( * */ public data object Signal { - public data object Reload: Unprivileged("SIGNAL") public data object Dump: Unprivileged("SIGNAL") public data object Debug: Unprivileged("SIGNAL") @@ -453,6 +452,7 @@ public sealed class TorCmd private constructor( public data object Active: Unprivileged("SIGNAL") public data object Dormant: Unprivileged("SIGNAL") + public data object Reload: Unprivileged("SIGNAL") public data object Shutdown: Privileged("SIGNAL") public data object Halt: Privileged("SIGNAL") } diff --git a/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmd.kt b/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmd.kt index 1ba4ce58d..fa834c460 100644 --- a/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmd.kt +++ b/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmd.kt @@ -29,7 +29,6 @@ internal fun TorCmd<*>.encodeToByteArray(LOG: Debugger?): ByteArray = when (this is TorCmd.Ownership.Take -> encode(LOG) is TorCmd.Resolve -> encode(LOG) is TorCmd.SetEvents -> encode(LOG) - is TorCmd.Signal.Reload -> encodeSignal(LOG) is TorCmd.Signal.Dump -> encodeSignal(LOG) is TorCmd.Signal.Debug -> encodeSignal(LOG) is TorCmd.Signal.NewNym -> encodeSignal(LOG) @@ -37,12 +36,12 @@ internal fun TorCmd<*>.encodeToByteArray(LOG: Debugger?): ByteArray = when (this is TorCmd.Signal.Heartbeat -> encodeSignal(LOG) is TorCmd.Signal.Active -> encodeSignal(LOG) is TorCmd.Signal.Dormant -> encodeSignal(LOG) + is TorCmd.Signal.Reload -> encodeSignal(LOG) is TorCmd.Signal.Shutdown -> encodeSignal(LOG) is TorCmd.Signal.Halt -> encodeSignal(LOG) } internal fun TorCmd<*>.signalNameOrNull(): String? = when (this) { - is TorCmd.Signal.Reload -> "RELOAD" is TorCmd.Signal.Dump -> "DUMP" is TorCmd.Signal.Debug -> "DEBUG" is TorCmd.Signal.NewNym -> "NEWNYM" @@ -50,6 +49,7 @@ internal fun TorCmd<*>.signalNameOrNull(): String? = when (this) { is TorCmd.Signal.Heartbeat -> "HEARTBEAT" is TorCmd.Signal.Active -> "ACTIVE" is TorCmd.Signal.Dormant -> "DORMANT" + is TorCmd.Signal.Reload -> "RELOAD" is TorCmd.Signal.Shutdown -> "SHUTDOWN" is TorCmd.Signal.Halt -> "HALT" else -> { diff --git a/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmdJob.kt b/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmdJob.kt index 1e58fc889..5147ee1ee 100644 --- a/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmdJob.kt +++ b/library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-TorCmdJob.kt @@ -74,7 +74,6 @@ internal fun TorCmdJob<*>.respond(replies: ArrayList) { is TorCmd.Ownership.Take -> completeOK() is TorCmd.Resolve -> completeOK() is TorCmd.SetEvents -> completeOK() - is TorCmd.Signal.Reload -> completeOK() is TorCmd.Signal.Dump -> completeOK() is TorCmd.Signal.Debug -> completeOK() is TorCmd.Signal.NewNym -> completeOK() @@ -82,6 +81,7 @@ internal fun TorCmdJob<*>.respond(replies: ArrayList) { is TorCmd.Signal.Heartbeat -> completeOK() is TorCmd.Signal.Active -> completeOK() is TorCmd.Signal.Dormant -> completeOK() + is TorCmd.Signal.Reload -> completeOK() is TorCmd.Signal.Shutdown -> completeOK() is TorCmd.Signal.Halt -> completeOK() } diff --git a/library/runtime/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ConfigBuilderCallback.kt b/library/runtime/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ConfigBuilderCallback.kt index 4428460dd..9d01befab 100644 --- a/library/runtime/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ConfigBuilderCallback.kt +++ b/library/runtime/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ConfigBuilderCallback.kt @@ -142,7 +142,7 @@ public fun interface ConfigBuilderCallback: ThisBlock.WithIt @@ -100,6 +98,7 @@ class TorConfigGeneratorUnitTest { assertContains(TorConfig.DisableNetwork) assertContains(TorConfig.RunAsDaemon) assertContains(TorConfig.__OwningControllerProcess) + assertContains(TorConfig.__ReloadTorrcOnSIGHUP) } }