url

package
v8.24.7 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserInfoExists is returned when a join address already contains
	// a username and a password.
	ErrUserInfoExists = errors.New("userinfo exists")
)

Functions

func AddBasicAuth

func AddBasicAuth(joinAddr, username, password string) (string, error)

AddBasicAuth adds username and password to the join address. If username is empty joinAddr is returned unchanged. If joinAddr already contains a username, ErrUserInfoExists is returned.

func CheckHTTPS

func CheckHTTPS(addr string) bool

CheckHTTPS returns true if the given URL uses HTTPS.

func EnsureHTTPS

func EnsureHTTPS(addr string) string

EnsureHTTPS modifies the given URL, ensuring it is using the HTTPS protocol.

func NormalizeAddr

func NormalizeAddr(addr string) string

NormalizeAddr ensures that the given URL has a HTTP protocol prefix. If none is supplied, it prefixes the URL with "http://".

func RemoveBasicAuth

func RemoveBasicAuth(u string) string

RemoveBasicAuth returns a copy of the given URL, with any basic auth password redacted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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