inputparser

package
v3.17.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package inputparser contains code to parse experiments input.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyDefaultScheme = errors.New("inputparser: empty default scheme")

ErrEmptyDefaultScheme indicates that the default scheme is empty.

View Source
var ErrEmptyHostname = errors.New("inputparser: empty URL.Hostname()")

ErrEmptyHostname indicates that the URL.Hostname() is empty.

View Source
var ErrIDNAToASCII = errors.New("inputparser: cannot convert IDNA to ASCII")

ErrIDNAToASCII indicates that we cannot convert IDNA to ASCII.

View Source
var ErrInvalidEndpoint = errors.New("inputparser: invalid endpoint")

ErrInvalidEndpoint indicates that we are not parsing a valid endpoint.

View Source
var ErrURLParse = errors.New("inputparser: cannot parse URL")

ErrURLParse indicates that we could not parse the URL.

View Source
var ErrUnsupportedScheme = errors.New("inputparser: unsupported URL.Scheme")

ErrUnsupportedScheme indicates that we do not support the given URL.Scheme.

Functions

func Parse

func Parse(config *Config, input model.MeasurementTarget) (*url.URL, error)

Parse parses the experiment input using the given config and returns to the caller either the resulting URL or an error.

Types

type Config

type Config struct {
	// AcceptedSchemes is the list of accepted URL schemes. This field is
	// MANDATORY except when parsing endpoints where we do not need to
	// validate the scheme since we use DefaultScheme.
	AcceptedSchemes []string

	// AllowEndpoints OPTIONALLY tells the input parser to also
	// accept endpoints as experiment inputs.
	AllowEndpoints bool

	// DefaultScheme is the scheme to use when accepting endpoints,
	// which is MANDATORY iff AllowEndpoints is true.
	DefaultScheme string
}

Config contains config for parsing experiments input. You MUST set the fields marked as MANDATORY otherwise Parse will fail.

Jump to

Keyboard shortcuts

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