defangle
Defangle contains functions for defanging IP addresses, URLs, and email addresses. Defanging is the process of replacing certain characters in links to make them safe to share in contexts where they might otherwise be clicked.
Functions
pub fn defang(url: String) -> String
Replace the .
in the URL with [.]
,
and the http
with hxxp
,
and the ://
with [://]
pub fn defang_email(user: String, domain: String) -> String
Replace the @
in the email with [at]
,
and the .
with [.]
pub fn defang_url(domain: String) -> String
Replace the .
in the URL with [.]
,
and the http
with hxxp
,
and the ://
with [://]