1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
//! [Ref](https://lite.ip2location.com/database/px2-ip-proxytype-country#proxy-type)
use serde_enum_str::Deserialize_enum_str;
//
#[derive(Deserialize_enum_str, Debug, Clone, PartialEq)]
#[serde(rename_all = "UPPERCASE")]
pub enum ProxyType {
VPN,
TOR,
DCH,
PUB,
WEB,
SES,
RES,
#[serde(rename = "-")]
Unknown,
#[serde(other)]
Other(Box<str>),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn from_str() {
assert_eq!("PUB".parse::<ProxyType>().unwrap(), ProxyType::PUB);
}
}