Documentation
¶
Overview ¶
Package url define URL utilites
Index ¶
- Constants
- func Base(URL string, defaultSchema string) (string, string)
- func Dir(URL string) string
- func Equals(URL1, URL2 string) bool
- func Host(URL string) string
- func IsRelative(location string) bool
- func IsSchemeEquals(URL1, URL2 string) bool
- func Join(baseURL string, elements ...string) string
- func JoinUNC(baseURL string, fragments ...string) string
- func Name(URL string) string
- func Normalize(URL, scheme string) string
- func Path(URL string) string
- func Scheme(URL, defaultSchema string) string
- func SchemeExtensionURL(URL string) string
- func Split(URL, defaultScheme string) (string, string)
- func ToFileURL(p string) string
Constants ¶
View Source
const (
//Localhost default host
Localhost = "localhost"
)
Variables ¶
This section is empty.
Functions ¶
func IsRelative ¶ added in v0.12.2
IsRelative returns true if location is a relative path (no scheme and not absolute). On Windows, treats drive-letter (C:\\...) and UNC (\\\\server\\share) as absolute (returns false).
func IsSchemeEquals ¶ added in v0.4.0
IsSchemeEquals returns true if scheme is equals
func JoinUNC ¶ added in v0.14.0
JoinUNC joins base URL with path elements, it support '.' or '..' elements
func SchemeExtensionURL ¶
SchemeExtensionURL extract scheme extension or empty string
func ToFileURL ¶ added in v1.27.0
ToFileURL converts an OS path into a file:// URL in a cross‑platform way.
- Leaves existing URLs (with a scheme) unchanged
- Converts UNC paths (\\server\share\dir) to file://server/share/dir
- Converts Windows drive paths (C:\foo\bar) to file:///C:/foo/bar
- Converts POSIX absolute paths (/var/tmp) to file:///var/tmp
- Converts other paths to file://<path> with normalized slashes
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.