pub fn get_hostname_with_config<S: Into<String>>(
    domain: S,
    config: HostnameConfig
) -> Result<String, RustgenpassError>
Expand description

Isolate the domain name of a URL.

Arguments

  • domain - Domain / URL to get base hostname for
  • passthrough - Passthrough domain unmodified to hash function
  • keep_subdomains - Don’t remove subdomains from domain

Examples

use rustgenpass::{get_hostname_with_config, HostnameConfig};
let config = HostnameConfig {
  passthrough: false,
  keep_subdomains: false,
};
let hostname = get_hostname_with_config("https://user:pass@www.example.com:4711/path/file.html", config);
assert_eq!("example.com", hostname.unwrap());