File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ use crate::mmdb::types::mmdb_reader::{MmdbReader, MmdbReaders};
4646use crate :: networking:: parse_packets:: BackendTrafficMessage ;
4747use crate :: networking:: parse_packets:: parse_packets;
4848use crate :: networking:: types:: capture_context:: { CaptureContext , CaptureSource , MyPcapImport } ;
49- use crate :: networking:: types:: data_info_host:: DataInfoHost ;
5049use crate :: networking:: types:: filters:: Filters ;
5150use crate :: networking:: types:: host:: { Host , HostMessage } ;
5251use crate :: networking:: types:: host_data_states:: HostDataStates ;
@@ -1100,33 +1099,16 @@ impl Sniffer {
11001099 fn handle_new_host ( & mut self , host_msg : HostMessage ) {
11011100 let HostMessage {
11021101 host,
1103- other_data,
1104- is_loopback,
1105- is_local,
1106- is_bogon,
1107- traffic_type,
1102+ data_info_host,
11081103 address_to_lookup,
11091104 rdns,
11101105 } = host_msg;
11111106
1112- let data_info_host = DataInfoHost {
1113- data_info : other_data,
1114- is_favorite : false ,
1115- is_loopback,
1116- is_local,
1117- is_bogon,
1118- traffic_type,
1119- } ;
1120-
11211107 self . info_traffic
11221108 . hosts
11231109 . entry ( host. clone ( ) )
1124- . and_modify ( |data_info_host| {
1125- data_info_host. data_info . refresh ( other_data) ;
1126- data_info_host. is_loopback = is_loopback;
1127- data_info_host. is_local = is_local;
1128- data_info_host. is_bogon = is_bogon;
1129- data_info_host. traffic_type = traffic_type;
1110+ . and_modify ( |d| {
1111+ d. refresh ( & data_info_host) ;
11301112 } )
11311113 . or_insert ( data_info_host) ;
11321114
Original file line number Diff line number Diff line change @@ -388,13 +388,18 @@ fn reverse_dns_lookup(
388388 . insert ( address_to_lookup, new_host. clone ( ) ) ;
389389 drop ( resolutions_lock) ;
390390
391- let msg_data = HostMessage {
392- host : new_host,
393- other_data,
394- is_loopback,
391+ let data_info_host = DataInfoHost {
392+ data_info : other_data,
393+ is_favorite : false ,
395394 is_local,
396395 is_bogon,
396+ is_loopback,
397397 traffic_type,
398+ } ;
399+
400+ let msg_data = HostMessage {
401+ host : new_host,
402+ data_info_host,
398403 address_to_lookup,
399404 rdns,
400405 } ;
Original file line number Diff line number Diff line change 11use crate :: countries:: types:: country:: Country ;
22use crate :: networking:: types:: asn:: Asn ;
3- use crate :: networking:: types:: data_info:: DataInfo ;
4- use crate :: networking:: types:: traffic_type:: TrafficType ;
3+ use crate :: networking:: types:: data_info_host:: DataInfoHost ;
54use std:: net:: IpAddr ;
65
76/// Struct to represent a network host
@@ -30,11 +29,7 @@ pub struct ThumbnailHost {
3029#[ derive( Clone , Debug ) ]
3130pub struct HostMessage {
3231 pub host : Host ,
33- pub other_data : DataInfo ,
34- pub is_loopback : bool ,
35- pub is_local : bool ,
36- pub is_bogon : Option < & ' static str > ,
37- pub traffic_type : TrafficType ,
32+ pub data_info_host : DataInfoHost ,
3833 pub address_to_lookup : IpAddr ,
3934 pub rdns : String ,
4035}
You can’t perform that action at this time.
0 commit comments