parse

package
v6.0.0-alpha1+incompat... Latest Latest
Warning

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

Go to latest
Published: May 5, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyHostParser

func EmptyHostParser(module mb.Module, host string) (mb.HostData, error)

EmptyHostParser simply returns a zero value HostData. It asserts that host value is empty and returns an error if not.

func NewHostDataFromURL

func NewHostDataFromURL(u *url.URL) mb.HostData

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

func ParseURL(rawHost, scheme, user, pass, path, query string) (mb.HostData, error)

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

func PassThruHostParser(module mb.Module, host string) (mb.HostData, error)

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

func SetURLUser(u *url.URL, defaultUser, defaultPass string)

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

Build returns a new HostParser function whose behavior is influenced by the options set in URLHostParserBuilder.

Jump to

Keyboard shortcuts

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