TorRuntime

Base interface for implementations that manage interaction with a single tor daemon (backed by a stand-alone process instance).

See also

Inheritors

Types

Link copied to clipboard
Link copied to clipboard
object Companion
Link copied to clipboard

The environment for which TorRuntime operates.

Link copied to clipboard
@ExperimentalKmpTorApi
abstract class ServiceFactory(initializer: TorRuntime.ServiceFactory.Initializer) : TorRuntime

An instance of TorRuntime that produces Lifecycle.DestroyableTorRuntime under the hood which are intended to be run within a service object.

Properties

Link copied to clipboard
abstract val fid: String

An ID string which is based off of a file path.

Link copied to clipboard
@get:JvmStatic
@get:JvmName(name = "fidEllipses")
val FileID.fidEllipses: String

Returns the first and last 4 characters of the fid concatenated together with an ellipses between.

Functions

Link copied to clipboard
abstract fun clearObservers()
Link copied to clipboard
expect abstract fun enqueue(action: Action, onFailure: OnFailure, onSuccess: OnSuccess<Unit>): EnqueuedJob

Enqueues the Action for execution.

abstract fun <Success : Any> enqueue(cmd: TorCmd.Unprivileged<Success>, onFailure: OnFailure, onSuccess: OnSuccess<Success>): EnqueuedJob
Link copied to clipboard

Returns the current Environment for this TorRuntime instance.

Link copied to clipboard
abstract fun isReady(): Boolean

Checks if the tor process backing TorRuntime (if it is running) has completed starting up.

Link copied to clipboard
abstract fun listeners(): TorListeners

Returns the current TorListeners of this TorRuntime instance.

Link copied to clipboard
@JvmStatic
fun RuntimeEvent.Processor.observeSignalNewNym(tag: String?, executor: OnEvent.Executor?, onEvent: OnEvent<String?>): Disposable.Once

Subscribes with provided TorRuntime a CMD observer which will intercept execution of all TorCmd.Signal.NewNym jobs in order to transform tor's generic server response of Reply.Success.OK.

Link copied to clipboard
abstract fun state(): TorState

Returns the current TorState of this TorRuntime instance.

Link copied to clipboard
abstract fun subscribe(observer: RuntimeEvent.Observer<*>)

Add a single Observer.

abstract fun subscribe(vararg observers: RuntimeEvent.Observer<*>)

Add multiple Observer.

abstract fun subscribe(observer: TorEvent.Observer)
abstract fun subscribe(vararg observers: TorEvent.Observer)
Link copied to clipboard
@JvmStatic
@JvmOverloads
@JvmName(name = "fidString")
fun FileID.toFIDString(defaultClassName: String = "Unknown", includeHashCode: Boolean = true): String

Helper for overriding a class's toString function.

Link copied to clipboard
abstract fun unsubscribe(observer: RuntimeEvent.Observer<*>)

Remove a single Observer.

abstract fun unsubscribe(vararg observers: RuntimeEvent.Observer<*>)

Remove multiple Observer.

abstract fun unsubscribe(observer: TorEvent.Observer)
abstract fun unsubscribe(vararg observers: TorEvent.Observer)
Link copied to clipboard
abstract fun unsubscribeAll(event: RuntimeEvent<*>)

Remove all Observer of a single RuntimeEvent.

abstract fun unsubscribeAll(vararg events: RuntimeEvent<*>)

Remove all Observer of multiple RuntimeEvent.

abstract fun unsubscribeAll(event: TorEvent)
abstract fun unsubscribeAll(vararg events: TorEvent)
abstract fun unsubscribeAll(tag: String)