Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use the uds-gateway feature only to control the http uds endpoint #252

Merged
merged 1 commit into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions iroh-one/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ iroh-rpc-types = {path = "../iroh-rpc-types", default-features = false}
iroh-store = {path = "../iroh-store", default-features = false, features = ["rpc-mem"]}
iroh-util = {path = "../iroh-util"}
serde = {version = "1.0", features = ["derive"]}
tempdir = "0.3.7"
tokio = {version = "1", features = ["macros", "rt-multi-thread", "process"]}
tracing = "0.1.33"
tempdir = "0.3.7"

[dev-dependencies]
axum-macros = "0.2.0" # use #[axum_macros::debug_handler] for better error messages on handlers
Expand All @@ -39,4 +39,6 @@ http = "0.2"
default = ["rpc-mem", "rpc-grpc"]
rpc-grpc = ["iroh-rpc-types/grpc", "iroh-rpc-client/grpc", "iroh-metrics/rpc-grpc"]
rpc-mem = ["iroh-rpc-types/mem", "iroh-rpc-client/mem"]
uds-gateway = []
# uds-gateway controls whether http over uds is enabled. This is independent of the
# rpc-grpc control endpoint.
uds-gateway = []
2 changes: 1 addition & 1 deletion iroh-one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Single binary of iroh services (gateway, p2p, store) communicating via mem chann

### Features

- `uds-gateway` - enables the usage and binding of the gateway over UDS.
- `uds-gateway` - enables the usage and binding of the http gateway over UDS.

### Reference

Expand Down
12 changes: 2 additions & 10 deletions iroh-one/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,14 @@ async fn main() -> Result<()> {
(store_rpc, p2p_rpc)
};

#[cfg(not(feature = "uds-gateway"))]
let (rpc_addr, gw_sender) = Addr::new_mem();
#[cfg(not(feature = "uds-gateway"))]
{
config.rpc_client.gateway_addr = Some(gw_sender);
}

config.synchronize_subconfigs();

config.metrics = metrics::metrics_config_with_compile_time_info(config.metrics);
println!("{:#?}", config);

let metrics_config = config.metrics.clone();

#[cfg(feature = "uds-gateway")]
let rpc_addr = config
let gateway_rpc_addr = config
.gateway
.server_rpc_addr()?
.ok_or_else(|| anyhow!("missing gateway rpc addr"))?;
Expand All @@ -91,7 +83,7 @@ async fn main() -> Result<()> {
)
.await?;

let handler = Core::new_with_state(rpc_addr, Arc::clone(&shared_state)).await?;
let handler = Core::new_with_state(gateway_rpc_addr, Arc::clone(&shared_state)).await?;

let metrics_handle = iroh_metrics::MetricsHandle::new(metrics_config)
.await
Expand Down
2 changes: 1 addition & 1 deletion iroh-p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lazy_static = "1.4"
iroh-bitswap = { path = "../iroh-bitswap" }
iroh-rpc-types = { path = "../iroh-rpc-types", default-features = false }
iroh-rpc-client = { path = "../iroh-rpc-client", default-features = false }
tokio = { version = "1", features = ["time", "sync", "macros"] }
tokio = { version = "1", features = ["fs", "time", "sync", "macros"] }
ahash = "0.7.6"
tracing = "0.1.34"
clap = { version = "3.1.14", features = ["derive"] }
Expand Down