Verified Commit 69473a20 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! Bug 40933: Add tor-launcher functionality

Bug 42714: Allow to optionally use a TCP listener on Android.
parent 8403e4f4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ export class TorProcessAndroid {
      config = await lazy.EventDispatcher.instance.sendRequestForResult({
        type: TorOutgoingEvents.start,
        handle: this.#processHandle,
        tcpSocks: Services.prefs.getBoolPref(
          "extensions.torlauncher.socks_port_use_tcp",
          false
        ),
      });
      logger.debug("Sent the start event.");
    } catch (e) {
+11 −1
Original line number Diff line number Diff line
@@ -588,14 +588,24 @@ export class TorProvider {
    logger.debug("Trying to start the tor process.");
    const res = await this.#torProcess.start();
    if (TorLauncherUtil.isAndroid) {
      logger.debug("Configuration from TorProcessAndriod", res);
      this.#controlPortSettings = {
        ipcFile: new lazy.FileUtils.File(res.controlPortPath),
        cookieFilePath: res.cookieFilePath,
      };
      this.#socksSettings = {
        transproxy: false,
        ipcFile: new lazy.FileUtils.File(res.socksPath),
      };
      if (res.socksPath) {
        this.#socksSettings.ipcFile = new lazy.FileUtils.File(res.socksPath);
      } else if (res.socksPort !== undefined) {
        this.#socksSettings.host = res.socksHost ?? "127.0.0.1";
        this.#socksSettings.port = res.socksPort;
      } else {
        throw new Error(
          "TorProcessAndroid did not return a valid SOCKS configuration."
        );
      }
    }
    logger.info("Started a tor process");
  }