roxyutil

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package roxyutil provides miscellaneous utility functions for use by Roxy and by users of mainutil.

As with mainutil, it is undecided how much (if any) of the roxyutil API will remain available outside of the Roxy project once Roxy reaches v1.0.0.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToMatch          = inputError("failed to match expected pattern")
	ErrExpectEmpty            = inputError("expected empty string")
	ErrExpectEmptyOrLocalhost = inputError("expected empty string or \"localhost\"")
	ErrExpectNonEmpty         = inputError("expected non-empty string")
	ErrExpectOneSlash         = inputError("expected one '/', found 2 or more")
	ErrExpectLeadingSlash     = inputError("expected path to start with '/'")
	ErrExpectTrailingSlash    = inputError("expected path to end with '/'")
	ErrExpectNoEndSlash       = inputError("did not expect path to end with '/'")
	ErrExpectNoDoubleSlash    = inputError("did not expect path to contain '//'")
	ErrExpectNoDot            = inputError("did not expect path to contain '/./'")
	ErrExpectNoDotDot         = inputError("did not expect path to contain '/../'")
)

ErrFailedToMatch et al signal that input parsing has failed.

View Source
var ErrNoHealthyBackends = noHealthyBackendsError(0)

ErrNoHealthyBackends signals that a roxyresolver.Resolver was unable to find any healthy servers to talk to.

View Source
var ErrNotExist = notExistError(0)

ErrNotExist signals that something does not exist.

Functions

func ExpandPassword

func ExpandPassword(in string) (string, error)

ExpandPassword expands ${ENV_VAR} references and @file references.

func ExpandPath

func ExpandPath(in string) (string, error)

ExpandPath expands ${ENV_VAR} references, ~ and ~user references, and makes the path absolute.

func ExpandString

func ExpandString(in string) (string, error)

ExpandString expands ${ENV_VAR} references.

func LookupGroupByID added in v0.4.6

func LookupGroupByID(gid uint32) (*user.Group, error)

LookupGroupByID is a wrapper around "os/user".LookupGroupId.

func LookupGroupByName added in v0.4.6

func LookupGroupByName(groupName string) (*user.Group, error)

LookupGroupByName is a wrapper around "os/user".LookupGroup.

func LookupUserByID added in v0.4.6

func LookupUserByID(uid uint32) (*user.User, error)

LookupUserByID is a wrapper around "os/user".LookupId.

func LookupUserByName added in v0.4.6

func LookupUserByName(userName string) (*user.User, error)

LookupUserByName is a wrapper around "os/user".Lookup.

func PathAbs added in v0.4.6

func PathAbs(str string) (string, error)

PathAbs is a wrapper around "path/filepath".Abs.

func ValidateATCLocation

func ValidateATCLocation(str string) error

ValidateATCLocation validates that the given string is a valid Location for the Air Traffic Control service.

func ValidateATCServiceName

func ValidateATCServiceName(str string) error

ValidateATCServiceName validates that the given string is a valid Service Name for the Air Traffic Control service.

func ValidateATCUnique

func ValidateATCUnique(str string) error

ValidateATCUnique validates that the given string is a valid Unique ID for the Air Traffic Control service.

func ValidateEtcdPath

func ValidateEtcdPath(str string) error

ValidateEtcdPath validates that the given string is a valid etcd.io V3 key prefix, which must end with a "/".

func ValidateNamedPort

func ValidateNamedPort(str string) error

ValidateNamedPort validates that the given string is a valid named port for a membership.Roxy or membership.ServerSet address advertisement.

func ValidateZKPath

func ValidateZKPath(str string) error

ValidateZKPath validates that the given string is a valid ZooKeeper node path.

Types

type ATCLocationError added in v0.4.6

type ATCLocationError struct {
	Location string
	Err      error
}

ATCLocationError represents failure to parse an ATC location.

func (ATCLocationError) Error added in v0.4.6

func (err ATCLocationError) Error() string

Error fulfills the error interface.

func (ATCLocationError) Unwrap added in v0.4.6

func (err ATCLocationError) Unwrap() error

Unwrap returns the underlying cause of this error.

type ATCServiceNameError added in v0.4.6

type ATCServiceNameError struct {
	ServiceName string
	Err         error
}

ATCServiceNameError represents failure to parse an ATC service name.

func (ATCServiceNameError) Error added in v0.4.6

func (err ATCServiceNameError) Error() string

Error fulfills the error interface.

func (ATCServiceNameError) Unwrap added in v0.4.6

func (err ATCServiceNameError) Unwrap() error

Unwrap returns the underlying cause of this error.

type ATCUniqueError added in v0.4.6

type ATCUniqueError struct {
	Unique string
	Err    error
}

ATCUniqueError represents failure to parse an ATC unique client ID or unique server ID.

func (ATCUniqueError) Error added in v0.4.6

func (err ATCUniqueError) Error() string

Error fulfills the error interface.

func (ATCUniqueError) Unwrap added in v0.4.6

func (err ATCUniqueError) Unwrap() error

Unwrap returns the underlying cause of this error.

type AuthorityError added in v0.4.6

type AuthorityError struct {
	Authority string
	Err       error
}

AuthorityError represents failure to parse a URL authority section or a Target authority section.

func (AuthorityError) Error added in v0.4.6

func (err AuthorityError) Error() string

Error fulfills the error interface.

func (AuthorityError) Unwrap added in v0.4.6

func (err AuthorityError) Unwrap() error

Unwrap returns the underlying cause of this error.

type BoolError added in v0.4.6

type BoolError struct {
	Input string
	Err   error
}

BoolError represents failure to parse the string representation of a boolean value.

func (BoolError) Error added in v0.4.6

func (err BoolError) Error() string

Error fulfills the error interface.

func (BoolError) Unwrap added in v0.4.6

func (err BoolError) Unwrap() error

Unwrap returns the underlying cause of this error.

type EndpointError added in v0.4.6

type EndpointError struct {
	Endpoint string
	Err      error
}

EndpointError represents failure to parse a Target endpoint section.

func (EndpointError) Error added in v0.4.6

func (err EndpointError) Error() string

Error fulfills the error interface.

func (EndpointError) Unwrap added in v0.4.6

func (err EndpointError) Unwrap() error

Unwrap returns the underlying cause of this error.

type EnvVarLookupError added in v0.4.6

type EnvVarLookupError struct {
	Var string
	Err error
}

EnvVarLookupError represents failure to look up an environment variable.

func (EnvVarLookupError) Error added in v0.4.6

func (err EnvVarLookupError) Error() string

Error fulfills the error interface.

func (EnvVarLookupError) Unwrap added in v0.4.6

func (err EnvVarLookupError) Unwrap() error

Unwrap returns the underlying cause of this error.

type GRPCStatusError added in v0.4.6

type GRPCStatusError struct {
	Code codes.Code
	Err  error
}

GRPCStatusError represents an error with an associated GRPC status code.

func MakeGRPCStatusError added in v0.4.6

func MakeGRPCStatusError(err error) GRPCStatusError

MakeGRPCStatusError attempts to autodetect the correct status code.

func (GRPCStatusError) Error added in v0.4.6

func (err GRPCStatusError) Error() string

Error fulfills the error interface.

func (GRPCStatusError) GRPCStatus added in v0.4.6

func (err GRPCStatusError) GRPCStatus() *status.Status

GRPCStatus returns this error's representation as a gRPC Status.

func (GRPCStatusError) Unwrap added in v0.4.6

func (err GRPCStatusError) Unwrap() error

Unwrap returns the underlying cause of this error.

type HostError added in v0.4.6

type HostError struct {
	Host string
	Err  error
}

HostError represents failure to parse a hostname string.

func (HostError) Error added in v0.4.6

func (err HostError) Error() string

Error fulfills the error interface.

func (HostError) Unwrap added in v0.4.6

func (err HostError) Unwrap() error

Unwrap returns the underlying cause of this error.

type HostPortError added in v0.4.6

type HostPortError struct {
	HostPort string
	Err      error
}

HostPortError represents failure to parse a "host:port"-shaped string.

func (HostPortError) Error added in v0.4.6

func (err HostPortError) Error() string

Error fulfills the error interface.

func (HostPortError) Unwrap added in v0.4.6

func (err HostPortError) Unwrap() error

Unwrap returns the underlying cause of this error.

type IPError added in v0.4.6

type IPError struct {
	IP  string
	Err error
}

IPError represents failure to parse an IP address string.

func (IPError) Error added in v0.4.6

func (err IPError) Error() string

Error fulfills the error interface.

func (IPError) Unwrap added in v0.4.6

func (err IPError) Unwrap() error

Unwrap returns the underlying cause of this error.

type LookupGroupByIDError added in v0.4.6

type LookupGroupByIDError struct {
	ID  uint32
	Err error
}

LookupGroupByIDError represents failure to look up an OS group by GID.

func (LookupGroupByIDError) Error added in v0.4.6

func (err LookupGroupByIDError) Error() string

Error fulfills the error interface.

func (LookupGroupByIDError) Unwrap added in v0.4.6

func (err LookupGroupByIDError) Unwrap() error

Unwrap returns the underlying cause of this error.

type LookupGroupByNameError added in v0.4.6

type LookupGroupByNameError struct {
	Name string
	Err  error
}

LookupGroupByNameError represents failure to look up an OS group by name.

func (LookupGroupByNameError) Error added in v0.4.6

func (err LookupGroupByNameError) Error() string

Error fulfills the error interface.

func (LookupGroupByNameError) Unwrap added in v0.4.6

func (err LookupGroupByNameError) Unwrap() error

Unwrap returns the underlying cause of this error.

type LookupUserByIDError added in v0.4.6

type LookupUserByIDError struct {
	ID  uint32
	Err error
}

LookupUserByIDError represents failure to look up an OS user by UID.

func (LookupUserByIDError) Error added in v0.4.6

func (err LookupUserByIDError) Error() string

Error fulfills the error interface.

func (LookupUserByIDError) Unwrap added in v0.4.6

func (err LookupUserByIDError) Unwrap() error

Unwrap returns the underlying cause of this error.

type LookupUserByNameError added in v0.4.6

type LookupUserByNameError struct {
	Name string
	Err  error
}

LookupUserByNameError represents failure to look up an OS user by name.

func (LookupUserByNameError) Error added in v0.4.6

func (err LookupUserByNameError) Error() string

Error fulfills the error interface.

func (LookupUserByNameError) Unwrap added in v0.4.6

func (err LookupUserByNameError) Unwrap() error

Unwrap returns the underlying cause of this error.

type PathAbsError added in v0.4.6

type PathAbsError struct {
	Path string
	Err  error
}

PathAbsError represents failure to make a file path absolute.

func (PathAbsError) Error added in v0.4.6

func (err PathAbsError) Error() string

Error fulfills the error interface.

func (PathAbsError) Unwrap added in v0.4.6

func (err PathAbsError) Unwrap() error

Unwrap returns the underlying cause of this error.

type PathError added in v0.4.6

type PathError struct {
	Path string
	Err  error
}

PathError represents failure to parse a path of some sort, such as a URL path or a ZooKeeper path.

func (PathError) Error added in v0.4.6

func (err PathError) Error() string

Error fulfills the error interface.

func (PathError) Unwrap added in v0.4.6

func (err PathError) Unwrap() error

Unwrap returns the underlying cause of this error.

type PortError added in v0.4.6

type PortError struct {
	Port    string
	Err     error
	NamedOK bool
}

PortError represents failure to parse a port number string.

func (PortError) Error added in v0.4.6

func (err PortError) Error() string

Error fulfills the error interface.

func (PortError) Unwrap added in v0.4.6

func (err PortError) Unwrap() error

Unwrap returns the underlying cause of this error.

type QueryParamError added in v0.4.6

type QueryParamError struct {
	Name  string
	Value string
	Err   error
}

QueryParamError represents failure to parse the value of a specific URL query parameter or a specific Target query parameter.

func (QueryParamError) Error added in v0.4.6

func (err QueryParamError) Error() string

Error fulfills the error interface.

func (QueryParamError) Unwrap added in v0.4.6

func (err QueryParamError) Unwrap() error

Unwrap returns the underlying cause of this error.

type QueryStringError added in v0.4.6

type QueryStringError struct {
	QueryString string
	Err         error
}

QueryStringError represents failure to parse a URL query string or a Target query string.

func (QueryStringError) Error added in v0.4.6

func (err QueryStringError) Error() string

Error fulfills the error interface.

func (QueryStringError) Unwrap added in v0.4.6

func (err QueryStringError) Unwrap() error

Unwrap returns the underlying cause of this error.

type RegexpMatchError added in v0.4.6

type RegexpMatchError struct {
	Input   string
	Pattern *regexp.Regexp
}

RegexpMatchError represents failure to match a regular expression.

func (RegexpMatchError) Error added in v0.4.6

func (err RegexpMatchError) Error() string

Error fulfills the error interface.

func (RegexpMatchError) GRPCStatusCode added in v0.4.6

func (err RegexpMatchError) GRPCStatusCode() codes.Code

GRPCStatusCode returns the GRPC status code.

type SchemeError added in v0.4.6

type SchemeError struct {
	Scheme string
	Err    error
}

SchemeError represents failure to identify a URL scheme or a Target scheme.

func (SchemeError) Error added in v0.4.6

func (err SchemeError) Error() string

Error fulfills the error interface.

func (SchemeError) Unwrap added in v0.4.6

func (err SchemeError) Unwrap() error

Unwrap returns the underlying cause of this error.

Jump to

Keyboard shortcuts

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