Skip to content

Commit

Permalink
cosign: add https_proxy and no_proxy for ClientConfig
Browse files Browse the repository at this point in the history
The new `https_proxy` and `no_proxy` option gives ability for the users
to set a proxy to pull signature manifest from the registry. This is
useful in some cases where access to the registry depends on a proxy.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
  • Loading branch information
Xynnn007 committed Sep 14, 2024
1 parent 9965440 commit a48a0db
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/registry/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ pub struct ClientConfig {
/// A list of extra root certificate to trust. This can be used to connect
/// to servers using self-signed certificates
pub extra_root_certificates: Vec<Certificate>,

/// Set the `HTTPS PROXY` used by the client.
///
/// This defaults to `None`.
pub https_proxy: Option<String>,

/// Set the `NO PROXY` used by the client.
///
/// This defaults to `None`.
pub no_proxy: Option<String>,
}

impl Default for ClientConfig {
Expand All @@ -167,6 +177,8 @@ impl Default for ClientConfig {
accept_invalid_hostnames: false,
accept_invalid_certificates: false,
extra_root_certificates: Vec::new(),
https_proxy: None,
no_proxy: None,
}
}
}
Expand All @@ -183,6 +195,8 @@ impl From<ClientConfig> for oci_distribution::client::ClientConfig {
.iter()
.map(|c| c.into())
.collect(),
https_proxy: config.https_proxy,
no_proxy: config.no_proxy,
..Default::default()
}
}
Expand Down

0 comments on commit a48a0db

Please sign in to comment.