mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Revert the country selection to something that functions.
This commit is contained in:
parent
c6f351352b
commit
5d33a7ed6b
@ -91,12 +91,12 @@ fn all_flows_to_transport(boot_time: u64, all_flows_for_asn: Vec<(FlowbeeKey, Fl
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub async fn country_timeline(Path(country_name): Path<String>) -> Json<Vec<FlowTimeline>> {
|
||||
pub async fn country_timeline(Path(iso_code): Path<String>) -> Json<Vec<FlowTimeline>> {
|
||||
let time_since_boot = time_since_boot().unwrap();
|
||||
let since_boot = Duration::from(time_since_boot);
|
||||
let boot_time = unix_now().unwrap() - since_boot.as_secs();
|
||||
|
||||
let all_flows_for_asn = RECENT_FLOWS.all_flows_for_country(&country_name);
|
||||
let all_flows_for_asn = RECENT_FLOWS.all_flows_for_country(&iso_code);
|
||||
|
||||
let flows = all_flows_to_transport(boot_time, all_flows_for_asn);
|
||||
|
||||
|
@ -292,13 +292,13 @@ impl TimeBuffer {
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn all_flows_for_country(&self, country_name: &str) -> Vec<(FlowbeeKey, FlowbeeLocalData, FlowAnalysis)> {
|
||||
pub fn all_flows_for_country(&self, iso_code: &str) -> Vec<(FlowbeeKey, FlowbeeLocalData, FlowAnalysis)> {
|
||||
let buffer = self.buffer.lock().unwrap();
|
||||
buffer
|
||||
.iter()
|
||||
.filter(|flow| {
|
||||
let country = get_asn_name_and_country(flow.data.0.remote_ip.as_ip());
|
||||
country.name == country_name
|
||||
country.flag == iso_code
|
||||
})
|
||||
.map(|flow| flow.data.clone())
|
||||
.collect()
|
||||
|
Loading…
Reference in New Issue
Block a user