From 05684e63de17e197b8b71acd15391f1a735872d1 Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Tue, 22 Oct 2024 21:19:48 +0800 Subject: [PATCH] fix typo challenge --- README.md | 2 +- README.osc.md | 2 +- README.zh-hans.md | 2 +- README.zh-hant.md | 2 +- crates/core/src/conn/acme/config.rs | 6 +++--- crates/core/src/conn/acme/listener.rs | 8 ++++---- crates/core/src/conn/acme/mod.rs | 2 +- examples/acme-http01-quinn/src/main.rs | 2 +- examples/acme-http01/src/main.rs | 2 +- examples/webtransport-acme-http01/src/main.rs | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 46a6bb4c2..320d5bdc7 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ async fn main() { let listener = TcpListener::new("0.0.0.0:443") .acme() .add_domain("test.salvo.rs") // Replace this domain name with your own. - .http01_challege(&mut router).quinn("0.0.0.0:443"); + .http01_challenge(&mut router).quinn("0.0.0.0:443"); let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; Server::new(acceptor).serve(router).await; } diff --git a/README.osc.md b/README.osc.md index 13f779338..e94790614 100644 --- a/README.osc.md +++ b/README.osc.md @@ -71,7 +71,7 @@ async fn main() { let listener = TcpListener::new("0.0.0.0:443") .acme() .add_domain("test.salvo.rs") // 用你自己的域名替换此域名. - .http01_challege(&mut router).quinn("0.0.0.0:443"); + .http01_challenge(&mut router).quinn("0.0.0.0:443"); let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; Server::new(acceptor).serve(router).await; } diff --git a/README.zh-hans.md b/README.zh-hans.md index 54dd1e781..bc26b8665 100644 --- a/README.zh-hans.md +++ b/README.zh-hans.md @@ -71,7 +71,7 @@ async fn main() { let listener = TcpListener::new("0.0.0.0:443") .acme() .add_domain("test.salvo.rs") // 用你自己的域名替换此域名. - .http01_challege(&mut router).quinn("0.0.0.0:443"); + .http01_challenge(&mut router).quinn("0.0.0.0:443"); let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; Server::new(acceptor).serve(router).await; } diff --git a/README.zh-hant.md b/README.zh-hant.md index 0f78f8f97..74338cea8 100644 --- a/README.zh-hant.md +++ b/README.zh-hant.md @@ -71,7 +71,7 @@ async fn main() { let listener = TcpListener::new("0.0.0.0:443") .acme() .add_domain("test.salvo.rs") // 用你自己的域名替换此域名. - .http01_challege(&mut router).quinn("0.0.0.0:443"); + .http01_challenge(&mut router).quinn("0.0.0.0:443"); let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; Server::new(acceptor).serve(router).await; } diff --git a/crates/core/src/conn/acme/config.rs b/crates/core/src/conn/acme/config.rs index 3d0e01e63..79545d4f3 100644 --- a/crates/core/src/conn/acme/config.rs +++ b/crates/core/src/conn/acme/config.rs @@ -111,7 +111,7 @@ impl AcmeConfigBuilder { /// Sets the challenge type Http01 #[inline] - pub fn http01_challege(self) -> Self { + pub fn http01_challenge(self) -> Self { Self { challenge_type: ChallengeType::Http01, keys_for_http01: Some(Default::default()), @@ -120,7 +120,7 @@ impl AcmeConfigBuilder { } /// Sets the challenge type TlsAlpn01 #[inline] - pub fn tls_alpn01_challege(self) -> Self { + pub fn tls_alpn01_challenge(self) -> Self { Self { challenge_type: ChallengeType::TlsAlpn01, keys_for_http01: None, @@ -193,7 +193,7 @@ mod tests { .directory("test_directory", "https://test-directory-url.com") .domains(domains.clone()) .contacts(contacts.clone()) - .http01_challege() + .http01_challenge() .cache_path("test_cache_path") .before_expired(Duration::from_secs(24 * 60 * 60)) .build() diff --git a/crates/core/src/conn/acme/listener.rs b/crates/core/src/conn/acme/listener.rs index d83d2e15c..9fa9114ee 100644 --- a/crates/core/src/conn/acme/listener.rs +++ b/crates/core/src/conn/acme/listener.rs @@ -94,8 +94,8 @@ impl AcmeListener { } /// Create an handler for HTTP-01 challenge - pub fn http01_challege(self, router: &mut Router) -> Self { - let config_builder = self.config_builder.http01_challege(); + pub fn http01_challenge(self, router: &mut Router) -> Self { + let config_builder = self.config_builder.http01_challenge(); if let Some(keys_for_http01) = &config_builder.keys_for_http01 { let handler = Http01Handler { keys: keys_for_http01.clone(), @@ -111,9 +111,9 @@ impl AcmeListener { } /// Create an handler for HTTP-01 challenge #[inline] - pub fn tls_alpn01_challege(self) -> Self { + pub fn tls_alpn01_challenge(self) -> Self { Self { - config_builder: self.config_builder.tls_alpn01_challege(), + config_builder: self.config_builder.tls_alpn01_challenge(), ..self } } diff --git a/crates/core/src/conn/acme/mod.rs b/crates/core/src/conn/acme/mod.rs index 06d5007c1..f5f8a879e 100644 --- a/crates/core/src/conn/acme/mod.rs +++ b/crates/core/src/conn/acme/mod.rs @@ -23,7 +23,7 @@ //! // .directory("letsencrypt", salvo::conn::acme::LETS_ENCRYPT_STAGING) //! .cache_path("acme/letsencrypt") //! .add_domain("acme-http01.salvo.rs") -//! .http01_challege(&mut router); +//! .http01_challenge(&mut router); //! let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; //! Server::new(acceptor).serve(router).await; //! } diff --git a/examples/acme-http01-quinn/src/main.rs b/examples/acme-http01-quinn/src/main.rs index 95b91e8b2..2a88371ac 100644 --- a/examples/acme-http01-quinn/src/main.rs +++ b/examples/acme-http01-quinn/src/main.rs @@ -14,7 +14,7 @@ async fn main() { .acme() .cache_path("temp/letsencrypt") .add_domain("test.salvo.rs") // Replace this domain name with your own. - .http01_challege(&mut router) + .http01_challenge(&mut router) .quinn("0.0.0.0:443"); let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; Server::new(acceptor).serve(router).await; diff --git a/examples/acme-http01/src/main.rs b/examples/acme-http01/src/main.rs index e2a10735a..bc9b217b1 100644 --- a/examples/acme-http01/src/main.rs +++ b/examples/acme-http01/src/main.rs @@ -15,7 +15,7 @@ async fn main() { // .directory("letsencrypt", salvo::conn::acme::LETS_ENCRYPT_STAGING) .cache_path("/temp/letsencrypt") .add_domain("test.salvo.rs") // Replace this domain name with your own. - .http01_challege(&mut router); + .http01_challenge(&mut router); let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; Server::new(acceptor).serve(router).await; } diff --git a/examples/webtransport-acme-http01/src/main.rs b/examples/webtransport-acme-http01/src/main.rs index cfd9bed26..8e5661fbd 100644 --- a/examples/webtransport-acme-http01/src/main.rs +++ b/examples/webtransport-acme-http01/src/main.rs @@ -127,7 +127,7 @@ async fn main() { .acme() .cache_path("temp/letsencrypt") .add_domain("test.salvo.rs") - .http01_challege(&mut router) + .http01_challenge(&mut router) .quinn("0.0.0.0:443"); let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await; Server::new(acceptor).serve(router).await;