🦇 defangle
Defangle is a Gleam library for defanging URLs. It is useful for making URLs safe to share.
📥 Install defangle
gleam add defangle
⚡ Usage
import defangle
pub fn main() {
// Defang a URL to make it safe to share
"https://www.suspicious-url.com"
|> defangle.url
// "hxxps[://]www[.]suspicious-url[.]com"
// Defang an email address to make it safe to share
"lucy@malicious.gleam"
|> defangle.email
// "lucy[at]suspicious-url[.]com"
// Defang an IP address to make it safe to share
"103.253.144.32"
|> defangle.ip
// "103[.]253[.]144[.]32"
// Defang an IPv6 address to make it safe to share
"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
|> defangle.ip
// "2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7334
}
Further documentation can be found at https://hexdocs.pm/defangle.
Development
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell