MCPcopy Index your code
hub / github.com/cargo-lambda/cargo-lambda / server_config

Method server_config

crates/cargo-lambda-remote/src/tls.rs:88–113  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

86 }
87
88 pub fn server_config(&self) -> Result<Option<ServerConfig>> {
89 if !self.is_secure() {
90 return Ok(None);
91 }
92
93 CELL.get_or_init(install_default_tls_provider);
94
95 let (mut cert_chain, key) =
96 parse_cert_and_key(self.cert_path().as_ref(), self.key_path().as_ref())?;
97
98 if let Some(path) = self.ca_path() {
99 let certs = parse_certificates(path)?;
100 if !certs.is_empty() {
101 cert_chain.extend(certs);
102 }
103 }
104
105 let mut config = ServerConfig::builder()
106 .with_no_client_auth()
107 .with_single_cert(cert_chain, key)
108 .map_err(TlsError::FailedToParseConfig)?;
109
110 config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
111
112 Ok(Some(config))
113 }
114
115 pub fn client_config(&self) -> Result<ClientConfig> {
116 CELL.get_or_init(install_default_tls_provider);

Callers 4

test_tls_options_defaultFunction · 0.80
start_serverFunction · 0.80

Calls 7

parse_cert_and_keyFunction · 0.85
parse_certificatesFunction · 0.85
is_secureMethod · 0.80
cert_pathMethod · 0.80
key_pathMethod · 0.80
ca_pathMethod · 0.80
is_emptyMethod · 0.45