Documentation
¶
Overview ¶
Package net contains helper function for handling urls
Index ¶
- Variables
- func DomainFromFqdn(fqdn string) string
- func HostFromURL(u string) (string, error)
- func IntToIP(i string) net.IP
- func IsDomain(domain string) bool
- func IsFQDN(fqdn string) bool
- func IsIPAddr(ip string) bool
- func IsIPRange(r string) bool
- func IsIPv4(ip net.IP) bool
- func IsIPv6(ip net.IP) bool
- func IsNetwork(network string) bool
- func IsURL(u string) bool
- func NormaliseIPAddr(ip string) string
- func NormaliseURL(u string) (string, error)
- func NormaliseURLSchema(u string) (string, error)
- func ReverseIPAddr(ip string) (string, error)
- func ToPunycode(s string) (string, error)
- func ToUnicode(s string) (string, error)
- func URLToPunycode(u string) (string, error)
- func URLToUnicode(u string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var PublicSuffix = []string{}/* 6856 elements not displayed */
Functions ¶
func DomainFromFqdn ¶
DomainFromFqdn returns domain name or empty string
func HostFromURL ¶
HostFromURL extraxts hostname from given URL
func IntToIP ¶
IntToIP (int) return net.IP from the integer representation of an ip address (use e.g. for IP2Location databases )
func IsDomain ¶
IsDomain (domainname string) returns true if domainname is a valid domain, otherwise false
func IsFQDN ¶
IsFQDN (fqdn) returns true if fqdn is a FQDN (Fully Qualified Domain Name) hostname + domainname + tld, otherwise false
func IsIPAddr ¶
IsIPAddr return true if string ip contains a valid representation of an IPv4 or IPv6 address
func IsIPRange ¶
IsIPRange (range) return true if string r contains a valid representation of an ip network (e.g. 192.168.10.1-192.168.10.199)
func IsIPv4 ¶
IsIPv4 (ipaddr) return true if string ip contains a valid representation of an IPv4 address
func IsIPv6 ¶
IsIPv6 (ipaddr) return true if string ip contains a valid representation of an IPv6 address
func IsNetwork ¶
IsNetwork (network) return true if string network contains a valid representation of an ip network
func NormaliseIPAddr ¶
NormaliseIPAddr return ip adresse without /32 (IPv4 or /128 (IPv6)
func NormaliseURL ¶ added in v1.0.3
NormaliseURL returns a normalised url (e.g. without default ports like :80 for HTTP or :443 for HTTPS, duplicate slashes, etc.)
func NormaliseURLSchema ¶ added in v1.0.3
NormaliseURLSchema returns normalised URL string that includes a schema.
func ReverseIPAddr ¶
ReverseIPAddr (ipaddr) reverses string ip (use e.g. for DNS blacklists)
func ToPunycode ¶ added in v1.2.40
ToPunycode returns string as Punycode
func URLToPunycode ¶ added in v1.0.3
URLToPunycode returns URL string in punycode
func URLToUnicode ¶ added in v1.0.3
URLToUnicode returns normalised URL string.
Types ¶
This section is empty.