urls

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpUrl

type HttpUrl struct {
	/*
		HostnameS contains the domain name or ip address.
	*/
	HostnameS string

	/*
		Port contains the host's port.
	*/
	Port int

	/*
		PathS contains any further information encoded in the url path.
	*/
	PathS string

	/*
		Secure is a flag that defines whether this HttpUrl should be treated as an encrypted connection.
	*/
	Secure bool
}

HttpUrl represents a regular http url.

func HttpUrlFromString

func HttpUrlFromString(s string) (HttpUrl, error)

HttpUrlFromString creates a HttpUrl from a string, returning an error if validation fails.

func (*HttpUrl) Clean

func (u *HttpUrl) Clean()

Clean cleans up struct values.

func (*HttpUrl) Host

func (u *HttpUrl) Host(forcePort bool) string

Host returns the HostnameS and Port in a formatted matter.

func (*HttpUrl) HostPathConcat

func (u *HttpUrl) HostPathConcat() string

HostPathConcat returns the url without the protocol.

func (*HttpUrl) HostPathConcatStrict

func (u *HttpUrl) HostPathConcatStrict() string

HostPathConcatStrict returns the url forcing Port to be concatenated as well.

func (*HttpUrl) Hostname

func (u *HttpUrl) Hostname() string

Hostname returns this Url's hostname.

func (*HttpUrl) IsEmpty

func (u *HttpUrl) IsEmpty() bool

IsEmpty returns whether HostnameS is empty or not. It calls Clean() beforehand.

func (*HttpUrl) MarshalText

func (u *HttpUrl) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (*HttpUrl) Path

func (u *HttpUrl) Path() string

Path returns this Url's path.

func (*HttpUrl) String

func (u *HttpUrl) String() string

String returns this HttpUrl back as a usable url.

func (*HttpUrl) UnmarshalText

func (u *HttpUrl) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*HttpUrl) Validate

func (u *HttpUrl) Validate() error

Validate validates this HttpUrl.

type SshUrl

type SshUrl struct {
	/*
		HostnameS contains the domain name or ip address.
	*/
	HostnameS string

	/*
		User contains the username that want to connect to the host.
	*/
	User string

	/*
		PathS contains anything else specifying the connection.
	*/
	PathS string
}

SshUrl represents a regular ssh url.

func SshUrlFromString

func SshUrlFromString(s string) (SshUrl, error)

SshUrlFromString creates a SshUrl from a string, returning an error if validation fails.

func (*SshUrl) Clean

func (u *SshUrl) Clean()

Clean cleans up struct values.

func (*SshUrl) HostPathConcat

func (u *SshUrl) HostPathConcat() string

HostPathConcat returns the url without the protocol.

func (*SshUrl) HostPathConcatStrict

func (u *SshUrl) HostPathConcatStrict() string

HostPathConcatStrict returns the url forcing Port to be concatenated as well.

func (*SshUrl) Hostname

func (u *SshUrl) Hostname() string

Hostname returns this Url's hostname.

func (*SshUrl) IsEmpty

func (u *SshUrl) IsEmpty() bool

IsEmpty returns whether HostnameS or User is empty or not. It calls Clean() beforehand.

func (*SshUrl) MarshalText

func (u *SshUrl) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (*SshUrl) Path

func (u *SshUrl) Path() string

Path returns this Url's path.

func (*SshUrl) String

func (u *SshUrl) String() string

String returns this SshUrl back as a usable url.

func (*SshUrl) UnmarshalText

func (u *SshUrl) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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