Apply clippy suggestions
All checks were successful
moparisthebest/xmpp-proxy/pipeline/head This commit looks good
All checks were successful
moparisthebest/xmpp-proxy/pipeline/head This commit looks good
This commit is contained in:
parent
b99e6cd923
commit
0322bdf76d
@ -219,7 +219,7 @@ async fn stream_preamble<R: AsyncRead + Unpin>(mut in_rd: StanzaReader<R>, clien
|
||||
#[tokio::main]
|
||||
//#[tokio::main(flavor = "multi_thread", worker_threads = 10)]
|
||||
async fn main() {
|
||||
let main_config = Config::parse(std::env::args_os().skip(1).next().unwrap_or(OsString::from("/etc/xmpp-proxy/xmpp-proxy.toml"))).die("invalid config file");
|
||||
let main_config = Config::parse(std::env::args_os().nth(1).unwrap_or_else(|| OsString::from("/etc/xmpp-proxy/xmpp-proxy.toml"))).die("invalid config file");
|
||||
|
||||
#[cfg(feature = "env_logger")]
|
||||
{
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::upper_case_acronyms)]
|
||||
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use trust_dns_resolver::error::ResolveError;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::upper_case_acronyms)]
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
|
||||
use crate::stanzafilter::StanzaState::*;
|
||||
@ -169,7 +171,7 @@ impl StanzaFilter {
|
||||
self.cnt = 0;
|
||||
self.state = OutsideStanza;
|
||||
//trace!("cnt: {}, tag_cnt: {}, state: {:?}", self.cnt, self.tag_cnt, self.state);
|
||||
return ret;
|
||||
ret
|
||||
}
|
||||
|
||||
fn last_equals(&self, needle: &[u8]) -> Result<bool> {
|
||||
|
10
src/tls.rs
10
src/tls.rs
@ -9,15 +9,13 @@ lazy_static::lazy_static! {
|
||||
let mut config = ClientConfig::new();
|
||||
config.root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
|
||||
config.alpn_protocols.push(ALPN_XMPP_CLIENT[0].to_vec());
|
||||
let config = TlsConnector::from(Arc::new(config));
|
||||
config
|
||||
TlsConnector::from(Arc::new(config))
|
||||
};
|
||||
static ref SERVER_TLS_CONFIG: TlsConnector = {
|
||||
let mut config = ClientConfig::new();
|
||||
config.root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
|
||||
config.alpn_protocols.push(ALPN_XMPP_SERVER[0].to_vec());
|
||||
let config = TlsConnector::from(Arc::new(config));
|
||||
config
|
||||
TlsConnector::from(Arc::new(config))
|
||||
};
|
||||
}
|
||||
|
||||
@ -59,9 +57,7 @@ pub async fn starttls_connect(
|
||||
trace!("starttls reading stream open {}", server_name);
|
||||
while let Ok(Some(buf)) = in_rd.next(&mut in_filter).await {
|
||||
trace!("received pre-tls stanza: {} '{}'", server_name, to_str(&buf));
|
||||
if buf.starts_with(b"<?xml ") {
|
||||
// ignore this
|
||||
} else if buf.starts_with(b"<stream:stream ") {
|
||||
if buf.starts_with(b"<?xml ") || buf.starts_with(b"<stream:stream ") {
|
||||
// ignore this
|
||||
} else if buf.starts_with(b"<stream:features") {
|
||||
// we send starttls regardless, it could have been stripped out, we don't do plaintext
|
||||
|
Loading…
Reference in New Issue
Block a user