endpoint

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 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 (
	// ErrInvalidConfig will return if config string invalid.
	ErrInvalidConfig = errors.New("invalid config")
	// ErrUnsupportedProtocol will return if protocol is unsupported.
	ErrUnsupportedProtocol = errors.New("unsupported protocol")
)

Functions

This section is empty.

Types

type Provider

type Provider interface {
	Value() Value
}

Provider will return all info needed to connect a service.

func Parse

func Parse(cfg string) (Provider, 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