Documentation
¶
Index ¶
- func AbsoluteURL(protocol string, target string, path string) string
- func GetHost(input string) string
- func GetPath(input string) (string, error)
- func GetProtocol(input string) string
- func GetRootHost(input string) (string, error)
- func GetURLExtension(u *url.URL) string
- func HasProtocol(input string) bool
- func IsEmailURL(input string) (bool, string)
- func RemovePort(input string) string
- func RemoveProtocol(input string) string
- func RetrieveParameters(input string) []string
- func SameDomain(url1 string, url2 string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsoluteURL ¶
AbsoluteURL takes as input a protocol, a domain and a path and returns the absolute URL with protocol + domain + path.
func GetHost ¶
GetHost takes as input a string and tries to parse it as url, if it's a well formatted url this function returns the host (the domain if you prefer).
func GetProtocol ¶
GetProtocol takes as input a string and tries to parse it as url, if it's a well formatted url this function returns the protocol (the scheme if you prefer).
func GetRootHost ¶
GetRootHost takes as input a string and tries to parse it as url, if it's a well formatted url this function returns the second level domain.
func GetURLExtension ¶ added in v1.4.0
GetURLExtension extracts the file extension (without the dot) from a URL. It decodes the URL path first and returns the extension in lowercase. Returns "" if there's no extension.
func HasProtocol ¶
HasProtocol takes as input a string and checks if it has a protocol ( like in a URI/URL).
func IsEmailURL ¶
IsEmailURL checks if the input string is a mail URL.
func RemovePort ¶
RemovePort removes port from the input string. If it's not present it returns the input.
func RemoveProtocol ¶
RemoveProtocol removes the protocol from the input string (something://...). If it's not present it returns the input.
func RetrieveParameters ¶
RetrieveParameters takes as input a string and if it's correctly url-formatted returns a slice of strings that are the parameters of the URL.
func SameDomain ¶
SameDomain checks if two urls have the same domain.
Types ¶
This section is empty.