Go clippy!
This commit is contained in:
parent
4598fb33e4
commit
c8ca69923e
3 changed files with 37 additions and 44 deletions
|
@ -4,5 +4,5 @@ use std::io::{self, Write};
|
||||||
pub fn return_data_line(entry: &FilterEntry, data_line: &[u8]) {
|
pub fn return_data_line(entry: &FilterEntry, data_line: &[u8]) {
|
||||||
print!("filter-dataline|{}|{}|", entry.session_id, entry.token);
|
print!("filter-dataline|{}|{}|", entry.session_id, entry.token);
|
||||||
io::stdout().write_all(data_line).unwrap();
|
io::stdout().write_all(data_line).unwrap();
|
||||||
println!("");
|
println!();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_auth(&self) -> bool {
|
fn has_filter_auth(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_commit(&mut self, _entry: &FilterEntry) -> FilterResponse {
|
fn on_filter_commit(&mut self, _entry: &FilterEntry) -> FilterResponse {
|
||||||
|
@ -17,7 +17,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_commit(&self) -> bool {
|
fn has_filter_commit(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_connect(
|
fn on_filter_connect(
|
||||||
|
@ -32,7 +32,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_connect(&self) -> bool {
|
fn has_filter_connect(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_data(&mut self, _entry: &FilterEntry) -> FilterResponse {
|
fn on_filter_data(&mut self, _entry: &FilterEntry) -> FilterResponse {
|
||||||
|
@ -40,13 +40,13 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_data(&self) -> bool {
|
fn has_filter_data(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_data_line(&mut self, _entry: &FilterEntry, _data_line: &[u8]) {}
|
fn on_filter_data_line(&mut self, _entry: &FilterEntry, _data_line: &[u8]) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_data_line(&self) -> bool {
|
fn has_filter_data_line(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_ehlo(&mut self, _entry: &FilterEntry, _identity: &str) -> FilterResponse {
|
fn on_filter_ehlo(&mut self, _entry: &FilterEntry, _identity: &str) -> FilterResponse {
|
||||||
|
@ -54,7 +54,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_ehlo(&self) -> bool {
|
fn has_filter_ehlo(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_helo(&mut self, _entry: &FilterEntry, _identity: &str) -> FilterResponse {
|
fn on_filter_helo(&mut self, _entry: &FilterEntry, _identity: &str) -> FilterResponse {
|
||||||
|
@ -62,7 +62,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_helo(&self) -> bool {
|
fn has_filter_helo(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_mail_from(&mut self, _entry: &FilterEntry, _address: &str) -> FilterResponse {
|
fn on_filter_mail_from(&mut self, _entry: &FilterEntry, _address: &str) -> FilterResponse {
|
||||||
|
@ -70,7 +70,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_mail_from(&self) -> bool {
|
fn has_filter_mail_from(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_rcpt_to(&mut self, _entry: &FilterEntry, _address: &str) -> FilterResponse {
|
fn on_filter_rcpt_to(&mut self, _entry: &FilterEntry, _address: &str) -> FilterResponse {
|
||||||
|
@ -78,7 +78,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_rcpt_to(&self) -> bool {
|
fn has_filter_rcpt_to(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_filter_starttls(&mut self, _entry: &FilterEntry, _tls_string: &str) -> FilterResponse {
|
fn on_filter_starttls(&mut self, _entry: &FilterEntry, _tls_string: &str) -> FilterResponse {
|
||||||
|
@ -86,13 +86,13 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_filter_starttls(&self) -> bool {
|
fn has_filter_starttls(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_link_auth(&mut self, _entry: &ReportEntry, _username: &str, _result: AuthResult) {}
|
fn on_report_link_auth(&mut self, _entry: &ReportEntry, _username: &str, _result: AuthResult) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_link_auth(&self) -> bool {
|
fn has_report_link_auth(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_link_connect(
|
fn on_report_link_connect(
|
||||||
|
@ -106,37 +106,37 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_link_connect(&self) -> bool {
|
fn has_report_link_connect(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_link_disconnect(&mut self, _entry: &ReportEntry) {}
|
fn on_report_link_disconnect(&mut self, _entry: &ReportEntry) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_link_disconnect(&self) -> bool {
|
fn has_report_link_disconnect(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_link_greeting(&mut self, _entry: &ReportEntry, _hostname: &str) {}
|
fn on_report_link_greeting(&mut self, _entry: &ReportEntry, _hostname: &str) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_link_greeting(&self) -> bool {
|
fn has_report_link_greeting(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_link_identify(&mut self, _entry: &ReportEntry, _method: Method, _identity: &str) {}
|
fn on_report_link_identify(&mut self, _entry: &ReportEntry, _method: Method, _identity: &str) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_link_identify(&self) -> bool {
|
fn has_report_link_identify(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_link_tls(&mut self, _entry: &ReportEntry, _tls_string: &str) {}
|
fn on_report_link_tls(&mut self, _entry: &ReportEntry, _tls_string: &str) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_link_tls(&self) -> bool {
|
fn has_report_link_tls(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_begin(&mut self, _entry: &ReportEntry, _message_id: &str) {}
|
fn on_report_tx_begin(&mut self, _entry: &ReportEntry, _message_id: &str) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_begin(&self) -> bool {
|
fn has_report_tx_begin(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_mail(
|
fn on_report_tx_mail(
|
||||||
|
@ -149,13 +149,13 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_mail(&self) -> bool {
|
fn has_report_tx_mail(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_reset(&mut self, _entry: &ReportEntry, _message_id: &Option<String>) {}
|
fn on_report_tx_reset(&mut self, _entry: &ReportEntry, _message_id: &Option<String>) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_reset(&self) -> bool {
|
fn has_report_tx_reset(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_rcpt(
|
fn on_report_tx_rcpt(
|
||||||
|
@ -168,7 +168,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_rcpt(&self) -> bool {
|
fn has_report_tx_rcpt(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_envelope(
|
fn on_report_tx_envelope(
|
||||||
|
@ -180,13 +180,13 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_envelope(&self) -> bool {
|
fn has_report_tx_envelope(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_data(&mut self, _entry: &ReportEntry, _message_id: &str, _result: MailResult) {}
|
fn on_report_tx_data(&mut self, _entry: &ReportEntry, _message_id: &str, _result: MailResult) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_data(&self) -> bool {
|
fn has_report_tx_data(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_commit(
|
fn on_report_tx_commit(
|
||||||
|
@ -198,25 +198,25 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_commit(&self) -> bool {
|
fn has_report_tx_commit(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_tx_rollback(&mut self, _entry: &ReportEntry, _message_id: &str) {}
|
fn on_report_tx_rollback(&mut self, _entry: &ReportEntry, _message_id: &str) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_tx_rollback(&self) -> bool {
|
fn has_report_tx_rollback(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_protocol_client(&mut self, _entry: &ReportEntry, _command: &str) {}
|
fn on_report_protocol_client(&mut self, _entry: &ReportEntry, _command: &str) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_protocol_client(&self) -> bool {
|
fn has_report_protocol_client(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_protocol_server(&mut self, _entry: &ReportEntry, _response: &str) {}
|
fn on_report_protocol_server(&mut self, _entry: &ReportEntry, _response: &str) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_protocol_server(&self) -> bool {
|
fn has_report_protocol_server(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_filter_response(
|
fn on_report_filter_response(
|
||||||
|
@ -229,7 +229,7 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_filter_response(&self) -> bool {
|
fn has_report_filter_response(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_filter_report(
|
fn on_report_filter_report(
|
||||||
|
@ -242,12 +242,12 @@ pub trait Filter {
|
||||||
}
|
}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_filter_report(&self) -> bool {
|
fn has_report_filter_report(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_report_timeout(&mut self, _entry: &ReportEntry) {}
|
fn on_report_timeout(&mut self, _entry: &ReportEntry) {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn has_report_timeout(&self) -> bool {
|
fn has_report_timeout(&self) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,20 +29,13 @@ fn do_read_stdin(tx: &Sender<Vec<u8>>) -> Result<(), String> {
|
||||||
return Err(String::from("unable to read on stdin"));
|
return Err(String::from("unable to read on stdin"));
|
||||||
}
|
}
|
||||||
line_buffer.extend_from_slice(&read_buffer[..len]);
|
line_buffer.extend_from_slice(&read_buffer[..len]);
|
||||||
loop {
|
while let Some(id) = line_buffer.iter().position(|i| *i == b'\n') {
|
||||||
match line_buffer.iter().position(|i| *i == b'\n') {
|
let pos = id + 1;
|
||||||
Some(id) => {
|
let mut line = Vec::with_capacity(pos);
|
||||||
let pos = id + 1;
|
line.extend_from_slice(&line_buffer[..pos]);
|
||||||
let mut line = Vec::with_capacity(pos);
|
log::trace!("new line:{}", get_pretty_hex(&line));
|
||||||
line.extend_from_slice(&line_buffer[..pos]);
|
tx.send(line).unwrap();
|
||||||
log::trace!("new line:{}", get_pretty_hex(&line));
|
line_buffer.drain(..pos);
|
||||||
tx.send(line).unwrap();
|
|
||||||
line_buffer.drain(..pos);
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue