[−][src]Function openalias::alias_to_fqdn
pub fn alias_to_fqdn(alias: &str) -> Option<String>
Convert an OpenAlias to an FQDN.
Paraphrasing OpenAlias:
-
If the alias contains an
@
character, replace it with a.
(period) character to allow for email-style addressing. -
Check that the alias contains a
.
(period) character, if not then it is an address and not an FQDN. -
Append, if one doesn't exist, a dot to the end of the alias, to ensure it's an FQDN.
Examples
assert_eq!(alias_to_fqdn("donate.getmonero.org"), Some("donate.getmonero.org.".to_string())); assert_eq!(alias_to_fqdn("donate@nabijaczleweli.xyz"), Some("donate.nabijaczleweli.xyz.".to_string())); assert_eq!(alias_to_fqdn("nabijaczleweli.xyz."), Some("nabijaczleweli.xyz.".to_string())); assert_eq!(alias_to_fqdn("nabijaczleweli"), None);