url

package
v1.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsoluteURL

func AbsoluteURL(protocol string, target string, path string) string

AbsoluteURL takes as input a protocol, a domain and a path and returns the absolute URL with protocol + domain + path.

func GetHost

func GetHost(input string) string

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 GetPath

func GetPath(input string) (string, error)

GetPath returns the path of the input string (if correctly URL-formatted).

func GetProtocol

func GetProtocol(input string) string

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

func GetRootHost(input string) (string, error)

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 HasProtocol

func HasProtocol(input string) bool

HasProtocol takes as input a string and checks if it has a protocol ( like in a URI/URL).

func IsEmailURL

func IsEmailURL(input string) (bool, string)

IsEmailURL checks if the input string is a mail URL.

func RemovePort

func RemovePort(input string) string

RemovePort removes port from the input string. If it's not present it returns the input.

func RemoveProtocol

func RemoveProtocol(input string) string

RemoveProtocol removes the protocol from the input string (something://...). If it's not present it returns the input.

func RetrieveParameters

func RetrieveParameters(input string) []string

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

func SameDomain(url1 string, url2 string) bool

SameDomain checks if two urls have the same domain.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL