class TorControl::Client

Defined in:

config.cr
events.cr
features.cr
get_info.cr
no_arg_commands.cr
onion.cr
send_signal.cr
tor_control.cr

Constant Summary

Log = ::Log.for("torcontrol.client")
ProtocolLog = ::Log.for("torcontrol.client.protocol")

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(socket : Socket) #

Macro Detail

macro define_no_arg_command(command) #

Instance Method Detail

def add_onion(key_type : OnionKeyType, key_blob : OnionKeyBlob | String, *ports : UInt | NamedTuple(port: UInt, target: Socket::Address | Nil), flags : Array(OnionFlag) = [] of OnionFlag, max_streams : UInt = 0, pow_enabled : Bool | Nil = nil, pow_q_rate : UInt | Nil = nil, pow_q_burst : UInt | Nil = nil, client_auth_v2 = [] of NamedTuple(name: String, blob: String | ::Nil), client_auth_v3 = [] of String) #

TODO check address, blob, & nick_name against regex


def auth_cookie_file : Path | Nil #

def auth_methods : AuthMethod #

def authenticate(authentication : String | Path | Nil = nil, auth_methods : AuthMethod = @auth_methods) #

def authenticated? : Bool #

def del_onion(service_id : String) #

def drop_guards #

Tells the server to drop all guard nodes. Do not invoke this command lightly; it can increase vulnerability to tracking attacks over time. Tor replies with 250 OK on success.


def drop_ownership #

This command instructs Tor to relinquish ownership of its control connection. As such tor will not shut down when this control connection is closed.


def drop_timeouts #

Tells the server to drop all circuit build times. Do not invoke this command lightly; it can increase vulnerability to tracking attacks over time. Tor replies with 250 OK on success. Tor also emits the BUILDTIMEOUT_SET RESET event right after this 250 OK.


def event_subscribers : Array(Tuple(Set(Event), Channel(AsyncReply))) #

def events : Set(Event) #

def get_conf #

def get_info(info : String) #

def get_info(info : String, *infos : String) #

def load_conf #

def on_disconnect(&on_disconnect_proc) #

def onion_client_auth_add(hs_address : String, private_key_blob : PrivateKeyBlob, nick_name : String | Nil = nil, permanent : Bool = false) #

def onion_client_auth_remove(hs_address) #

def onion_client_auth_view(hs_address : String | Nil = nil) #

List all the stored client-side v3 client auth credentials for “HSAddress” if provided else all the stored client-side v3 client auth credentials.


def post_descriptor(purpose : RouterPurpose = RouterPurpose::General, cache : Bool | Nil = nil) #

def protocol_info #

Can only be sent once before authentication, which the constructor already does.


def quit #

def reset_conf #

def resolve(host : String, reverse : Bool = false) #

This command launches a remote hostname lookup request for every specified request (or reverse lookup if reverse is specified). Note that the request is done in the background: to see the answers, your controller will need to listen for ADDRMAP events


def save_conf(force : Bool = false) #

def set_conf(key, value) #

def set_router_purpose(descriptor, nick_name_or_key : String, purpose : RouterPurpose) #

def signal(signal : Signal) #

Sent from the client to the server. The server responds with 250 OK if the signal is recognized (or simply closes the socket if it was asked to close immediately), or 552 Unrecognized signal if the signal is unrecognized.


def socket=(socket : Socket) #

def subscribe_events(events : Set(Event), capacity : Int32 = 0) : Channel(AsyncReply) #

Receive all asyncronous replies for the given event types. Take care to not to let the Channel fill up and ensure to close it, as it could otherwise block the receiver. Increase the capacity if necessary.


def subscribe_events(*events : Event, capacity : Int32 = 0) : Channel(AsyncReply) #

Receive all asyncronous replies for the given event types. Take care to not to let the Channel fill up and ensure to close it, as it could otherwise block the receiver. Increase the capacity if necessary.


def subscribe_events(events : Set(Event), capacity : Int32 = 0, &) #

Yields all asyncronous replies for the given event types. Take care to procces the reply in time as it could otherwise block the receiver. Increase the capacity if necessary


def subscribe_events(*events : Event, capacity : Int32 = 0, &) #

Yields all asyncronous replies for the given event types. Take care to procces the reply in time as it could otherwise block the receiver. Increase the capacity if necessary


def take_ownership #

This command instructs Tor to shut down when this control connection is closed.


def tor_version : String | Nil #

def use_feature(*features : Feature) #