endpoint

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolHTTPS is the https credential protocol.
	ProtocolHTTPS = "https"
	// ProtocolHTTP is the http credential protocol.
	ProtocolHTTP = "http"
)

Variables

View Source
var (
	// ErrUnsupportedProtocol will return if protocol is unsupported.
	ErrUnsupportedProtocol = errors.New("unsupported protocol")
	// ErrInvalidValue means value is invalid.
	ErrInvalidValue = errors.New("invalid value")
)

Functions

This section is empty.

Types

type Error added in v0.7.1

type Error struct {
	Op  string
	Err error

	Protocol string
	Values   []string
}

Error represents error related to endpoint.

func (*Error) Error added in v0.7.1

func (e *Error) Error() string

func (*Error) Unwrap added in v0.7.1

func (e *Error) Unwrap() error

Unwrap implements xerrors.Wrapper

type Provider

type Provider interface {
	Value() Value
}

Provider will return all info needed to connect a service.

func Parse

func Parse(cfg string) (p Provider, err error)

Parse will parse config string to create a endpoint Provider.

type Static

type Static struct {
	// contains filtered or unexported fields
}

Static is the static endpoint.

func NewHTTP

func NewHTTP(host string, port int) Static

NewHTTP will create a static endpoint from parsed URL.

func NewHTTPS

func NewHTTPS(host string, port int) Static

NewHTTPS will create a static endpoint from parsed URL.

func (Static) Value

func (s Static) Value() Value

Value implements Provider interface.

type Value

type Value struct {
	Protocol string
	Host     string
	Port     int
}

Value is the required info to connect a service.

func (Value) String

func (v Value) String() string

String will compose all info into a valid URL.

Jump to

Keyboard shortcuts

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