1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
crate::ix!();

pub const ADDRINFO_REQUEST_HANDLER_NETWORKS: &[&'static str] = &[
    "ipv4", 
    "ipv6", 
    "onion", 
    "i2p"
];

impl AddrinfoRequestHandler {
    
    pub fn network_string_to_id(&self, str_: &str) -> i8 {
        
        for i in 0..ADDRINFO_REQUEST_HANDLER_NETWORKS.len() {
            if str_ == ADDRINFO_REQUEST_HANDLER_NETWORKS[i] {
                return i.try_into().unwrap();
            }
        }

        UNKNOWN_NETWORK
    }
}