format
This commit is contained in:
parent
71267870b0
commit
6cea690e6b
4 changed files with 9 additions and 13 deletions
|
|
@ -57,7 +57,8 @@ pub async fn start_health_server(port: u16) -> Result<()> {
|
||||||
let _ = socket.write_all(response.as_bytes()).await;
|
let _ = socket.write_all(response.as_bytes()).await;
|
||||||
} else {
|
} else {
|
||||||
// 404 for other paths
|
// 404 for other paths
|
||||||
let response = "HTTP/1.1 404 Not Found\r\nContent-Length: 9\r\n\r\nNot found";
|
let response =
|
||||||
|
"HTTP/1.1 404 Not Found\r\nContent-Length: 9\r\n\r\nNot found";
|
||||||
let _ = socket.write_all(response.as_bytes()).await;
|
let _ = socket.write_all(response.as_bytes()).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
src/ping.rs
14
src/ping.rs
|
|
@ -172,9 +172,9 @@ fn parse_icmp_reply(packet: &[u8], expected_identifier: u16, expected_sequence:
|
||||||
|
|
||||||
Err(format!(
|
Err(format!(
|
||||||
"Invalid ICMP reply packet (expected seq={}): {}",
|
"Invalid ICMP reply packet (expected seq={}): {}",
|
||||||
expected_sequence,
|
expected_sequence, packet_preview
|
||||||
packet_preview
|
)
|
||||||
).into())
|
.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_parse_icmp(packet: &[u8], _expected_identifier: u16, expected_sequence: u16) -> Result<()> {
|
fn try_parse_icmp(packet: &[u8], _expected_identifier: u16, expected_sequence: u16) -> Result<()> {
|
||||||
|
|
@ -195,11 +195,9 @@ fn try_parse_icmp(packet: &[u8], _expected_identifier: u16, expected_sequence: u
|
||||||
} else {
|
} else {
|
||||||
Err(format!(
|
Err(format!(
|
||||||
"ICMP packet mismatch (type={}, code={}, id={}, seq={})",
|
"ICMP packet mismatch (type={}, code={}, id={}, seq={})",
|
||||||
icmp_type,
|
icmp_type, icmp_code, identifier, sequence
|
||||||
icmp_code,
|
)
|
||||||
identifier,
|
.into())
|
||||||
sequence
|
|
||||||
).into())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,5 @@ mod tests {
|
||||||
// Just verify it's a non-empty string
|
// Just verify it's a non-empty string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Note: check_for_updates() just logs the version, no testing needed
|
// Note: check_for_updates() just logs the version, no testing needed
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,9 +324,7 @@ impl AgentClient {
|
||||||
|
|
||||||
/// Execute an SNMP job and collect results.
|
/// Execute an SNMP job and collect results.
|
||||||
async fn execute_job(job: AgentJob, result_tx: mpsc::UnboundedSender<SnmpResult>) -> Result<()> {
|
async fn execute_job(job: AgentJob, result_tx: mpsc::UnboundedSender<SnmpResult>) -> Result<()> {
|
||||||
let snmp_device = job
|
let snmp_device = job.snmp_device.ok_or("Job missing SNMP device info")?;
|
||||||
.snmp_device
|
|
||||||
.ok_or("Job missing SNMP device info")?;
|
|
||||||
let mut oid_values: HashMap<String, String> = HashMap::new();
|
let mut oid_values: HashMap<String, String> = HashMap::new();
|
||||||
let snmp_client = SnmpClient::new();
|
let snmp_client = SnmpClient::new();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue