-
Notifications
You must be signed in to change notification settings - Fork 590
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
chore(deps): Bump rumqttc from 0.22.0 to 0.24.0 #16007
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -687,21 +687,21 @@ impl NatsCommon { | |
|
||
pub(crate) fn load_certs( | ||
certificates: &str, | ||
) -> ConnectorResult<Vec<tokio_rustls::rustls::Certificate>> { | ||
) -> ConnectorResult<Vec<rustls_pki_types::CertificateDer<'static>>> { | ||
let cert_bytes = if let Some(path) = certificates.strip_prefix("fs://") { | ||
std::fs::read_to_string(path).map(|cert| cert.as_bytes().to_owned())? | ||
} else { | ||
certificates.as_bytes().to_owned() | ||
}; | ||
|
||
rustls_pemfile::certs(&mut cert_bytes.as_slice()) | ||
.map(|cert| Ok(tokio_rustls::rustls::Certificate(cert?.to_vec()))) | ||
.map(|cert| Ok(cert?)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. workarounds by #15619 no longer needed |
||
.collect() | ||
} | ||
|
||
pub(crate) fn load_private_key( | ||
certificate: &str, | ||
) -> ConnectorResult<tokio_rustls::rustls::PrivateKey> { | ||
) -> ConnectorResult<rustls_pki_types::PrivateKeyDer<'static>> { | ||
let cert_bytes = if let Some(path) = certificate.strip_prefix("fs://") { | ||
std::fs::read_to_string(path).map(|cert| cert.as_bytes().to_owned())? | ||
} else { | ||
|
@@ -711,7 +711,5 @@ pub(crate) fn load_private_key( | |
let cert = rustls_pemfile::pkcs8_private_keys(&mut cert_bytes.as_slice()) | ||
.next() | ||
.ok_or_else(|| anyhow!("No private key found"))?; | ||
Ok(tokio_rustls::rustls::PrivateKey( | ||
cert?.secret_pkcs8_der().to_vec(), | ||
)) | ||
Ok(cert?.into()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use rumqttc::tokio_rustls::rustls; | ||
use rumqttc::v5::mqttbytes::QoS; | ||
use rumqttc::v5::{AsyncClient, EventLoop, MqttOptions}; | ||
use serde_derive::Deserialize; | ||
|
@@ -141,26 +142,22 @@ impl MqttCommon { | |
.unwrap_or(QoS::AtMostOnce) | ||
} | ||
|
||
fn get_tls_config(&self) -> ConnectorResult<tokio_rustls::rustls::ClientConfig> { | ||
let mut root_cert_store = tokio_rustls::rustls::RootCertStore::empty(); | ||
fn get_tls_config(&self) -> ConnectorResult<rustls::ClientConfig> { | ||
let mut root_cert_store = rustls::RootCertStore::empty(); | ||
if let Some(ca) = &self.ca { | ||
let certificates = load_certs(ca)?; | ||
for cert in certificates { | ||
root_cert_store.add(&cert).unwrap(); | ||
root_cert_store.add(cert).unwrap(); | ||
} | ||
} else { | ||
for cert in | ||
rustls_native_certs::load_native_certs().expect("could not load platform certs") | ||
{ | ||
root_cert_store | ||
.add(&tokio_rustls::rustls::Certificate(cert.to_vec())) | ||
.unwrap(); | ||
root_cert_store.add(cert).unwrap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. workarounds by #15620 no longer needed |
||
} | ||
} | ||
|
||
let builder = tokio_rustls::rustls::ClientConfig::builder() | ||
.with_safe_defaults() | ||
.with_root_certificates(root_cert_store); | ||
let builder = rustls::ClientConfig::builder().with_root_certificates(root_cert_store); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/rustls/rustls/releases/tag/v%2F0.22.0
|
||
|
||
let tls_config = if let (Some(client_cert), Some(client_key)) = | ||
(self.client_cert.as_ref(), self.client_key.as_ref()) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/rustls/rustls/releases/tag/v%2F0.22.0