Skip to content

topl-core-base / io.matthewnelson.topl_core_base / TorSettings

TorSettings

abstract class TorSettings :BaseConsts (source)

This class is for defining default values for your torrc file. Extend this class and define your own settings.

Keep in mind that Orbot and TorBrowser are the 2 most widely used applications using Tor, and to use settings that won’t conflict (those settings are documented as such, and contain further details).

TorSettings.Companion contains pretty standard default values which’ll get you a Socks5 proxy running, nothing more.

Would highly recommend reading up on what’s what in the manual:

Constructors

Name Summary
<init> This class is for defining default values for your torrc file. Extend this class and define your own settings.TorSettings()

Properties

Name Summary
connectionPadding Adds to the torrc file “ConnectionPadding <0, 1, or auto>“abstract val connectionPadding:String
customTorrc If not null/not empty, will add the string value to the torrc fileabstract val customTorrc:String?
disableNetwork OnionProxyManager will enable this on startup using the TorControlConnection based off of the device’s network state. Setting this to true is highly recommended.abstract val disableNetwork:Boolean
dnsPort TorBrowser and Orbot use “5400” by default. It may be wise to pick something that won’t conflict.abstract val dnsPort:String
dnsPortIsolationFlags Express isolation flags to be added when enabling the dnsPortabstract val dnsPortIsolationFlags:List<String>?
dormantClientTimeout Adds to the torrc file “DormantClientTimeout minutes”abstract val dormantClientTimeout:Int?
entryNodes Set with a comma separated list of Entry Nodes.abstract val entryNodes:String?
excludeNodes Set with a comma separated list of Exit Nodes to be excluded.abstract val excludeNodes:String?
exitNodes Set with a comma separated list of Exit Nodes to use.abstract val exitNodes:String?
hasBridges If true, adds to the torrc file “UseBridges 1” and will proc the adding of bridges.abstract val hasBridges:Boolean
hasCookieAuthentication Highly recommended to be set to true for securing the ControlPortabstract val hasCookieAuthentication:Boolean
hasDebugLogs Adds to the torrc file:abstract val hasDebugLogs:Boolean
hasDormantCanceledByStartup Highly recommended to be set to true for Android applications.abstract val hasDormantCanceledByStartup:Boolean
hasOpenProxyOnAllInterfaces If true, adds to the torrc file “SocksListenAddress 0.0.0.0”abstract val hasOpenProxyOnAllInterfaces:Boolean
hasReachableAddress If true, adds to the torrc file “ReachableAddresses <reachableAddressPorts>“abstract val hasReachableAddress:Boolean
hasReducedConnectionPadding If true, adds to the torrc file “ReducedConnectionPadding 1”abstract val hasReducedConnectionPadding:Boolean
hasSafeSocks If true, adds to the torrc file “SafeSocks 1”abstract val hasSafeSocks:Boolean
hasStrictNodes If true, adds to the torrc file “StrictNodes 1”abstract val hasStrictNodes:Boolean
hasTestSocks If true, adds to the torrc file “TestSocks 1”abstract val hasTestSocks:Boolean
httpTunnelPort Could be “auto” or a specific port, such as “8288”.abstract val httpTunnelPort:String
httpTunnelPortIsolationFlags Express isolation flags to be added when enabling the httpTunnelPortabstract val httpTunnelPortIsolationFlags:List<String>?
isAutoMapHostsOnResolve See DEFAULT__IS_AUTO_MAP_HOSTS_ON_RESOLVEabstract val isAutoMapHostsOnResolve:Boolean
isRelay See DEFAULT__IS_RELAYabstract val isRelay:Boolean
listOfSupportedBridges Must have the transport binaries for obfs4 and/or snowflake, depending on if you wish to include them in your bridges file to use.abstract val listOfSupportedBridges:List<String>
proxyHost See DEFAULT__PROXY_HOSTabstract val proxyHost:String?
proxyPassword See DEFAULT__PROXY_PASSWORDabstract val proxyPassword:String?
proxyPort Default = java.nullabstract val proxyPort:Int?
proxySocks5Host Adds to the torrc file “Socks5Proxy proxySocks5Host:proxySocks5ServerPortabstract val proxySocks5Host:String?
proxySocks5ServerPort Adds to the torrc file “Socks5Proxy proxySocks5Host:proxySocks5ServerPortabstract val proxySocks5ServerPort:Int?
proxyType Depending on the BaseConsts.ProxyType, will add authenticated Socks5 or HTTPS proxy, if other settings are configured properly.abstract val proxyType:String
proxyUser See DEFAULT__PROXY_USERabstract val proxyUser:String?
reachableAddressPorts Adds to the torrc file “ReachableAddresses <reachableAddressPorts>“abstract val reachableAddressPorts:String
relayNickname See DEFAULT__RELAY_NICKNAMEabstract val relayNickname:String?
relayPort TorBrowser and Orbot use 9001 by default. It may be wise to pick something that won’t conflict.abstract val relayPort:String
runAsDaemon If true, adds to the torrc file “RunAsDaemon 1” See DEFAULT__RUN_AS_DAEMONabstract val runAsDaemon:Boolean
socksPort Could be “auto” or a specific port, such as “9051”.abstract val socksPort:String
socksPortIsolationFlags Express isolation flags to be added when enabling the socksPortabstract val socksPortIsolationFlags:List<String>?
transPort Can be “auto”, or a specified port such as “9141”abstract val transPort:String
transPortIsolationFlags Express isolation flags to be added when enabling the transPortabstract val transPortIsolationFlags:List<String>?
useSocks5 See DEFAULT__USE_SOCKS5abstract val useSocks5:Boolean
virtualAddressNetwork TorBrowser and Orbot use “10.192.0.1/10”, it may be wise to pick something that won’t conflict if you are using this setting.abstract val virtualAddressNetwork:String?

Companion Object Properties

Name Summary
DEFAULT__DISABLE_NETWORK const val DEFAULT__DISABLE_NETWORK:Boolean
DEFAULT__DORMANT_CLIENT_TIMEOUT const val DEFAULT__DORMANT_CLIENT_TIMEOUT:Int
DEFAULT__ENTRY_NODES const val DEFAULT__ENTRY_NODES:String
DEFAULT__EXCLUDED_NODES const val DEFAULT__EXCLUDED_NODES:String
DEFAULT__EXIT_NODES const val DEFAULT__EXIT_NODES:String
DEFAULT__HAS_BRIDGES const val DEFAULT__HAS_BRIDGES:Boolean
DEFAULT__HAS_COOKIE_AUTHENTICATION const val DEFAULT__HAS_COOKIE_AUTHENTICATION:Boolean
DEFAULT__HAS_DEBUG_LOGS const val DEFAULT__HAS_DEBUG_LOGS:Boolean
DEFAULT__HAS_DORMANT_CANCELED_BY_STARTUP const val DEFAULT__HAS_DORMANT_CANCELED_BY_STARTUP:Boolean
DEFAULT__HAS_OPEN_PROXY_ON_ALL_INTERFACES const val DEFAULT__HAS_OPEN_PROXY_ON_ALL_INTERFACES:Boolean
DEFAULT__HAS_REACHABLE_ADDRESS const val DEFAULT__HAS_REACHABLE_ADDRESS:Boolean
DEFAULT__HAS_REDUCED_CONNECTION_PADDING const val DEFAULT__HAS_REDUCED_CONNECTION_PADDING:Boolean
DEFAULT__HAS_SAFE_SOCKS const val DEFAULT__HAS_SAFE_SOCKS:Boolean
DEFAULT__HAS_STRICT_NODES const val DEFAULT__HAS_STRICT_NODES:Boolean
DEFAULT__HAS_TEST_SOCKS const val DEFAULT__HAS_TEST_SOCKS:Boolean
DEFAULT__IS_AUTO_MAP_HOSTS_ON_RESOLVE const val DEFAULT__IS_AUTO_MAP_HOSTS_ON_RESOLVE:Boolean
DEFAULT__IS_RELAY const val DEFAULT__IS_RELAY:Boolean
DEFAULT__PROXY_HOST const val DEFAULT__PROXY_HOST:String
DEFAULT__PROXY_PASSWORD const val DEFAULT__PROXY_PASSWORD:String
DEFAULT__PROXY_SOCKS5_HOST const val DEFAULT__PROXY_SOCKS5_HOST:String
DEFAULT__PROXY_USER const val DEFAULT__PROXY_USER:String
DEFAULT__REACHABLE_ADDRESS_PORTS const val DEFAULT__REACHABLE_ADDRESS_PORTS:String
DEFAULT__RELAY_NICKNAME const val DEFAULT__RELAY_NICKNAME:String
DEFAULT__RUN_AS_DAEMON const val DEFAULT__RUN_AS_DAEMON:Boolean
DEFAULT__USE_SOCKS5 const val DEFAULT__USE_SOCKS5:Boolean