Builder

@JvmStatic
fun Builder(workDirectory: File, cacheDirectory: File, loader: (resourceDir: File) -> ResourceLoader.Tor): TorRuntime.Environment(source)

Opener for creating an Environment instance.

workDirectory should be specified within your application's home directory (e.g. $HOME/.my_application/torservice). This will be utilized as the tor process' HOME environment variable (if using a ResourceLoader.Tor.Exec).

cacheDirectory should be specified within your application's cache directory (e.g. $HOME/.my_application/cache/torservice).

It is advisable to keep the dirname for workDirectory and cacheDirectory identical (e.g. torservice), especially when creating multiple instances of Environment.

NOTE: If an Environment already exists for the provided workDirectory or cacheDirectory, that instance will be returned.

Parameters

workDirectory

tor's working directory (e.g. $HOME/.my_application/torservice) This will be utilized as the tor process' HOME environment variable (if using ResourceLoader.Tor.Exec).

cacheDirectory

tor's cache directory (e.g. $HOME/.my_application/cache/torservice).

loader

lambda for creating ResourceLoader.Tor using the configured BuilderScope.resourceDir. See kmp-tor-resource

Throws

IllegalArgumentException

when workDirectory and cacheDirectory are the same.

If absoluteFile2 has to reference the filesystem to construct an absolute path and fails due to a filesystem security exception.


@JvmStatic
fun Builder(workDirectory: File, cacheDirectory: File, loader: (resourceDir: File) -> ResourceLoader.Tor, block: ThisBlock<TorRuntime.Environment.BuilderScope>): TorRuntime.Environment(source)

Opener for creating an Environment instance.

workDirectory should be specified within your application's home directory (e.g. $HOME/.my_application/torservice). This will be utilized as the tor process' HOME environment variable (if using a ResourceLoader.Tor.Exec).

cacheDirectory should be specified within your application's cache directory (e.g. $HOME/.my_application/cache/torservice).

It is advisable to keep the dirname for workDirectory and cacheDirectory identical (e.g. torservice), especially when creating multiple instances of Environment.

NOTE: If an Environment already exists for the provided workDirectory or cacheDirectory, that instance will be returned.

Parameters

workDirectory

tor's working directory (e.g. $HOME/.my_application/torservice) This will be utilized as the tor process' HOME environment variable (if using ResourceLoader.Tor.Exec).

cacheDirectory

tor's cache directory (e.g. $HOME/.my_application/cache/torservice).

loader

lambda for creating ResourceLoader.Tor using the configured BuilderScope.resourceDir. See kmp-tor-resource

block

optional lambda for modifying default parameters.

Throws

IllegalArgumentException

when workDirectory and cacheDirectory are the same.

If absoluteFile2 has to reference the filesystem to construct an absolute path and fails due to a filesystem security exception.