Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Query ¶
type Query struct { // Key is the key of the query. // Example: "q" in "https://example.com/search?q=hello+world" Key string `json:"key"` // Value is the value of the query. // Example: "hello+world" in "https://example.com/search?q=hello+world" Value string `json:"value"` }
Query is a key-value pair used in a URL query string.
type URL ¶
type URL struct { // FullURL represents the full domain name this struct has been created with. // Example: "https://www.example.com:443/search?q=hello+world#test" FullURL string `json:"full_url"` // Protocol represents the protocol used to access the domain. // Example: "https" in "https://www.example.com:443/search?q=hello+world#test" Protocol string `json:"protocol"` // Subdomain represents the subdomain of the domain. // Example: "www" in "https://www.example.com:443/search?q=hello+world#test" Subdomain string `json:"subdomain"` // Hostname represents the hostname of the domain. // Example: "example.com" in "https://www.example.com:443/search?q=hello+world#test" Hostname string `json:"hostname"` // Domain represents the domain name (or second level domain). // Example: "example" in "https://www.example.com:443/search?q=hello+world#test" Domain string `json:"domain"` // TLD represents the top level domain. // Example: "com" in "https://www.example.com:443/search?q=hello+world#test" TLD string `json:"tld"` // Port represents the port used to access the domain. // Example: 443 in "https://www.example.com:443/search?q=hello+world#test" Port int `json:"port"` // Path represents the path used to access the domain. // Example: "/search" in "https://www.example.com:443/search?q=hello+world#test" Path string `json:"path"` // Query represents the query used to access the domain. // Example: []Query{{"q", "hello+world"}} in "https://www.example.com:443/search?q=hello+world#test" Query []Query `json:"query"` // Fragment represents the fragment used to access the domain. // Example: "test" in "https://www.example.com:443/search?q=hello+world#test" Fragment string `json:"fragment"` // Username represents the username used to access the domain. // Example: "user" in "https://user:pass@example.com:443/search?q=hello+world#test" Username string `json:"username"` // Password represents the password used to access the domain. // Example: "pass" in "https://user:pass@example.com:443/search?q=hello+world#test" Password string `json:"password"` // IPAddress represents the IP address the domain resolves to. // Example: "127.0.0.1" (obviously not a real server IP address) IPAddress string `json:"ip_address"` }
URL is a split of a given domain name.
func FromString ¶
FromString parses a given domain name and returns a URL struct.
Click to show internal directories.
Click to hide internal directories.