Commit 69621f88 authored by Elena's avatar Elena 🤷‍♀️ Committed by brizental
Browse files

fixup! TB 44806: Implement the tor integration in Rust.

TB 44924: Create a control port client in Rust.

Created a basic Tor Service in Rust.
parent cad62719
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2982,6 +2982,7 @@ dependencies = [
 "ssl_tokens_cache",
 "static_prefs",
 "storage",
 "tor_service",
 "trust-anchors",
 "unic-langid",
 "unic-langid-ffi",
@@ -8116,6 +8117,15 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c"

[[package]]
name = "tor_service"
version = "0.1.0"
dependencies = [
 "nserror",
 "nsstring",
 "xpcom",
]

[[package]]
name = "tower-service"
version = "0.3.2"
+3 −0
Original line number Diff line number Diff line
@@ -159,6 +159,9 @@ if CONFIG["MOZ_UNIFFI_FIXTURES"]:

# Exclude aboutinference (about:inference). tor-browser#44045.

if CONFIG["TOR_RUST_INTEGRATION"]:
    DIRS += ["tor-integration"]

UNIFIED_SOURCES += [
    "/toolkit/components/antitracking/ContentBlockingAllowList.cpp",
]
+9 −0
Original line number Diff line number Diff line
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

[scriptable, uuid(2537313c-e120-408c-a2f6-86e6e1bdf899)]
interface ITorService : nsISupports {
};
+29 −0
Original line number Diff line number Diff line
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_
#define TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_

#include "nsCOMPtr.h"

#include "ITorService.h"

// Inspired by
// toolkit/components/extensions/storage/ExtensionStorageComponents.h.

// Implemented in Rust
extern "C" nsresult NewTorServiceImpl(ITorService** aResult);

namespace torproject {
already_AddRefed<ITorService> NewTorService() {
  nsCOMPtr<ITorService> service;
  nsresult rv = NewTorServiceImpl(getter_AddRefs(service));
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return nullptr;
  }
  return service.forget();
}
}  // namespace torproject

#endif  // TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_
+14 −0
Original line number Diff line number Diff line
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

Classes = [
    {
        'cid': '{2537313c-e120-408c-a2f6-86e6e1bdf899}',
        'contract_ids': ['@torproject.org/tor-service;1'],
        'interfaces': ['ITorService'],
        'constructor': 'torproject::NewTorService',
        'headers': ['torproject/TorService.h'],
        'js_name': 'tor',
    },
]
Loading