Commit a430d675 authored by Nick Mathewson's avatar Nick Mathewson 🥔
Browse files

Merge branch 'implement-rproxy' into 'main'

Start implementing tor-hsrproxy

See merge request tpo/core/arti!1622
parents be94887f ebdb3511
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4953,12 +4953,21 @@ name = "tor-hsrproxy"
version = "0.1.0"
dependencies = [
 "derive_builder_fork_arti",
 "futures",
 "rangemap",
 "safelog",
 "serde",
 "serde_json",
 "serde_with",
 "thiserror",
 "tor-cell",
 "tor-config",
 "tor-error",
 "tor-hsservice",
 "tor-proto",
 "tor-rtcompat",
 "tracing",
 "void",
]

[[package]]
+1 −1
Original line number Diff line number Diff line
@@ -1366,7 +1366,7 @@ impl<R: Runtime> TorClient<R> {
            self.statemgr.clone(),
        )
        .map_err(ErrorDetail::LaunchOnionService)?;
        service.launch().map_err(ErrorDetail::LaunchOnionService)?;
        let _stream = service.launch().map_err(ErrorDetail::LaunchOnionService)?;
        // TODO HSS: Once OnionService::launch is non-async, make this function non-async.
        // TODO HSS: Once OnionService::launch returns a stream of something
        // reasonable, return that from here as well.
+15 −0
Original line number Diff line number Diff line
@@ -200,6 +200,21 @@ impl Begin {
            flags: flags.into(),
        })
    }

    /// Return the address requested in this message.
    pub fn addr(&self) -> &[u8] {
        &self.addr[..]
    }

    /// Return the port requested by this message.
    pub fn port(&self) -> u16 {
        self.port
    }

    /// Return the set of flags provided in this message.
    pub fn flags(&self) -> BeginFlags {
        self.flags
    }
}

impl Body for Begin {
+10 −0
Original line number Diff line number Diff line
@@ -19,11 +19,21 @@ full = []

[dependencies]
derive_builder = { version = "0.11.2", package = "derive_builder_fork_arti" }
# postage = { version = "0.5.0", default-features = false, features = ["futures-traits"] }
futures = "0.3.14"
rangemap = "1.3"
safelog = { version = "0.3.2", path = "../safelog" }
serde = { version = "1.0.103", features = ["derive"] }
serde_with = "3.0.0"
thiserror = "1"
tor-cell = { version = "0.12.2", path = "../tor-cell" }
tor-config = { version = "0.9.3", path = "../tor-config" }
tor-error = { version = "0.5.4", path = "../tor-error" }
tor-hsservice = { path = "../tor-hsservice", version = "0.2.4" }
tor-proto = { version = "0.12.1", path = "../tor-proto", features = ["experimental-api", "hs-service"] }
tor-rtcompat = { path = "../tor-rtcompat", version = "0.9.4" }
tracing = "0.1.36"
void = "1"

[dev-dependencies]
serde_json = "1.0.50"
+11 −0
Original line number Diff line number Diff line
@@ -57,6 +57,17 @@ define_list_builder_helper! {
   item_build: |value| Ok(value.clone());
}

impl ProxyConfig {
    /// Find the configured action to use when receiving a request for a
    /// connection on a given port.
    pub(crate) fn resolve_port_for_begin(&self, port: u16) -> Option<&ProxyAction> {
        self.proxy_ports
            .iter()
            .find(|rule| rule.source.matches_port(port))
            .map(|rule| &rule.target)
    }
}

/// A single rule in a `ProxyConfig`.
///
/// Rules take the form of, "When this pattern matches, take this action."
Loading