AddressMapping

class AddressMapping(from: String, to: String)

Holder for address mapping requests.

e.g.

val results = runtime.executeAsync(
    TorCmd.MapAddress(
        "torproject.org".mappingToAnyHost(),
        "torproject.org".mappingToAnyHostIPv4(),
        "torproject.org".mappingToAnyHostIPv6(),
    )
)

val unmappings = results.map { result ->
    println(result)
    result.toUnmapping()
}

// AddressMapping.Result: [
//     from: wsvidzeicnyrlruo.virtual
//     to: torproject.org
//     isUnmapping: false
// ]
// AddressMapping.Result: [
//     from: 127.240.73.168
//     to: torproject.org
//     isUnmapping: false
// ]
// AddressMapping.Result: [
//     from: [fe85:2bcd:7057:b3f9:ffb2:be48:1e7b:884]
//     to: torproject.org
//     isUnmapping: false
// ]

runtime.executeAsync(
    TorCmd.Info.Get("address-mappings/control")
).let { mappings -> println(mappings.values.first()) }

// wsvidzeicnyrlruo.virtual torproject.org NEVER
// 127.240.73.168 torproject.org NEVER
// [fe85:2bcd:7057:b3f9:ffb2:be48:1e7b:884] torproject.org NEVER

runtime.executeAsync(TorCmd.MapAddress(unmappings))

runtime.executeAsync(
    TorCmd.Info.Get("address-mappings/control")
).let { mappings -> println(mappings) }

// {address-mappings/control=}

See also

Constructors

Link copied to clipboard
constructor(from: String, to: IPAddress)
constructor(from: IPAddress, to: String)
constructor(from: IPAddress, to: IPAddress)
constructor(from: IPAddress, to: OnionAddress)
constructor(from: String, to: String)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Result(val from: String, val to: String)

Holder for response from TorCmd.MapAddress

Properties

Link copied to clipboard

The "original", or "old", address that will be mapped to to.

Link copied to clipboard

The "replacement", or "new", address that from will be mapped to.

Functions

Link copied to clipboard
operator fun component1(): String
Link copied to clipboard
operator fun component2(): String
Link copied to clipboard
fun copy(from: String = this.from, to: String = this.to): AddressMapping