Skip to main content

infer_client_identity_type

Function infer_client_identity_type 

Source
pub fn infer_client_identity_type(identify: &str) -> Option<ClientIdentityType>
Expand description

The client identity type that identify implies, if it implies one.

An IP address can only be ClientIdentityType::Ip: Relay files anything that parses as an IP under IPs. Anything else could be a DoT hostname or a DoH path, so the caller has to say which.

ยงExamples

use dinio_sdk::models::ClientIdentityType;
use dinio_sdk::ops::infer_client_identity_type;

assert_eq!(infer_client_identity_type("203.0.113.10"), Some(ClientIdentityType::Ip));
assert_eq!(infer_client_identity_type("2001:db8::1"), Some(ClientIdentityType::Ip));
assert_eq!(infer_client_identity_type("office.example.com"), None);