Documentation ¶
Index ¶
- func EmptyHostParser(module mb.Module, host string) (mb.HostData, error)
- func NewHostDataFromURL(u *url.URL) mb.HostData
- func ParseURL(rawHost, scheme, user, pass, path, query string) (mb.HostData, error)
- func PassThruHostParser(module mb.Module, host string) (mb.HostData, error)
- func SetURLUser(u *url.URL, defaultUser, defaultPass string)
- type URLHostParserBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptyHostParser ¶
EmptyHostParser simply returns a zero value HostData. It asserts that host value is empty and returns an error if not.
func NewHostDataFromURL ¶
NewHostDataFromURL returns a new HostData based on the contents of the URL. If the URLs scheme is "unix" or end is "unix" (e.g. "http+unix://") then the HostData.Host field is set to the URLs path instead of the URLs host.
func ParseURL ¶
ParseURL returns HostData object from a raw 'host' value and a series of defaults that are added to the URL if not present in the rawHost value. Values from the rawHost take precedence over the defaults.
func PassThruHostParser ¶
PassThruHostParser is a HostParser that sets the HostData URI, SanitizedURI, and Host to the configured 'host' value. This should only be used by MetricSets that do not require host parsing (e.g. host is only addr:port). Do not use this if the host value can contain credentials.
func SetURLUser ¶
SetURLUser set the user credentials in the given URL. If the username or password is not set in the URL then the default is used (if provided).
Types ¶
type URLHostParserBuilder ¶
type URLHostParserBuilder struct { PathConfigKey string DefaultPath string DefaultScheme string QueryParams string }
URLHostParserBuilder builds a tailored HostParser for used with host strings that are URLs.
func (URLHostParserBuilder) Build ¶
func (b URLHostParserBuilder) Build() mb.HostParser
Build returns a new HostParser function whose behavior is influenced by the options set in URLHostParserBuilder.