Skip to content
Snippets Groups Projects
Verified Commit c19ca457 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Bug 40933: Add tor-launcher functionality

Fix a couple of problems in TorLauncherUtil and TorParsers.

Also, moved the function to parse bridges in TorParsers.
parent c89a0385
Branches
Tags
1 merge request!734Bug 42030: Rebased 13.0 alpha onto Firefox 115.2.0esr
......@@ -209,14 +209,15 @@ class TorFile {
// and return a file object. The control and SOCKS IPC objects will be
// created by tor.
normalize() {
if (!this.file.exists() && !this.isIPC) {
throw new Error(`${this.fileType} file not found: ${this.file.path}`);
}
if (this.file.exists()) {
try {
this.file.normalize();
} catch (e) {
console.warn("Normalization of the path failed", e);
}
} else if (!this.isIPC) {
throw new Error(`${this.fileType} file not found: ${this.file.path}`);
}
// Ensure that the IPC path length is short enough for use by the
// operating system. If not, create and use a unique directory under
......
......
......@@ -267,4 +267,18 @@ export const TorParsers = Object.freeze({
rv += aStr.substring(lastAdded, aStr.length - 1);
return rv;
},
parseBridgeLine(line) {
const re =
/\s*(?:(?<transport>\S+)\s+)?(?<addr>[0-9a-fA-F\.\[\]\:]+:\d{1,5})(?:\s+(?<id>[0-9a-fA-F]{40}))?(?:\s+(?<args>.+))?/;
const match = re.exec(line);
if (!match) {
throw new Error("Invalid bridge line.");
}
const bridge = match.groups;
if (!bridge.transport) {
bridge.transport = "vanilla";
}
return bridge;
},
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment