Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Aug 6, 2021
1 parent c8cce28 commit 656efa0
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 112 deletions.
56 changes: 28 additions & 28 deletions relay/sources/relayd/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion relay/sources/relayd/src/api/remote_run.rs
Expand Up @@ -279,14 +279,15 @@ impl RemoteRun {
}

let client = match job_config.downstream_clients.get(&id) {
Some(c) => c.clone(),
Some(c) => c.read().await.clone(),
None => {
error!("unknown sub-relay '{}'", id);
return Box::new(futures::stream::empty());
}
};

let response = client
.client()
.post(&format!(
"https://{}:{}/rudder/relay-api/remote-run/{}",
hostname,
Expand Down
11 changes: 5 additions & 6 deletions relay/sources/relayd/src/api/shared_files.rs
Expand Up @@ -160,9 +160,8 @@ async fn put_forward(
job_config: Arc<JobConfig>,
body: Bytes,
) -> Result<StatusCode, Error> {
job_config
.upstream_client
.clone()
let client = job_config.upstream_client.read().await.client().clone();
client
.put(&format!(
"{}/{}/{}",
job_config.cfg.upstream_url(),
Expand Down Expand Up @@ -299,9 +298,9 @@ async fn head_forward(
params: SharedFilesHeadParams,
job_config: Arc<JobConfig>,
) -> Result<StatusCode, Error> {
job_config
.upstream_client
.clone()
let client = job_config.upstream_client.read().await.client().clone();

client
.head(&format!(
"{}/{}/{}",
job_config.cfg.upstream_url(),
Expand Down
12 changes: 11 additions & 1 deletion relay/sources/relayd/src/configuration/main.rs
Expand Up @@ -121,6 +121,16 @@ impl Configuration {
})
}

pub fn peer_authentication(&self) -> PeerAuthentication {
// compute actual model
if !self.output.upstream.verify_certificates {
warn!("output.upstream.verify_certificates parameter is deprecated, use general.peer_authentication instead");
PeerAuthentication::DangerousNone
} else {
self.general.peer_authentication
}
}

/// Gives current url of the upstream relay API
/// Can be removed once upstream.url is removed
pub fn upstream_url(&self) -> String {
Expand Down Expand Up @@ -175,7 +185,7 @@ pub struct GeneralConfig {
pub https_port: u16,
/// Which certificate validation model to use
#[serde(default = "GeneralConfig::default_peer_authentication")]
pub peer_authentication: PeerAuthentication,
peer_authentication: PeerAuthentication,
}

impl GeneralConfig {
Expand Down

0 comments on commit 656efa0

Please sign in to comment.