config

package
v0.5.34 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidConfig when missing or wrong config values
	ErrInvalidConfig = errors.New("config is invalid")
)

Functions

func Version

func Version() string

Version returns version of wormhole

Types

type ClientConfig

type ClientConfig struct {
	Config

	// <HOST>:<PORT> of the user's server (e.g. Rails server)
	LocalEndpoint string

	// <HOST>:<PORT> of the wormhole server
	RemoteEndpoint string

	// Authentication token when connecting to wormhole server
	Token string

	// when set this will override the default VCS ID (i.e. git commit SHA1)
	// defaults to FLY_RELASE_ID (but can be overriden with FLY_RELEASE_ID_VAR to point ot a different ENV)
	ReleaseID string

	// when set this will override the default VCS message (i.e. git commit message)
	// defaults to FLY_RELASE_DESC (but can be overriden with FLY_RELEASE_DESC_VAR to point ot a different ENV)
	ReleaseDesc string

	// when set this will override the default VCS branch
	// defaults to FLY_RELASE_BRANCH (but can be overriden with FLY_RELEASE_BRANCH_VAR to point ot a different ENV)
	ReleaseBranch string
}

ClientConfig stores wormhole client parameters

func NewClientConfig

func NewClientConfig() (*ClientConfig, error)

NewClientConfig parses config values collected from Viper and validates them it returns a ClientConfig struct or an error if config values are invalid

type Config

type Config struct {
	// Protocol specifies transportation layer used by wormhole
	// e.g. SSH tunneling, TLS conn pool, etc.
	Protocol TunnelProto

	// for server this means its listening port
	// for client this means listening port of the local server
	Port string

	// wormhole's version
	Version string

	// for server this means hostname or IP address of the host/container running
	// a particular server instance
	// for client this means the hostname or IP address of the local server
	Localhost string

	// TLS cert is used when TLS conn pool is used as transporation layer
	// Server also needs TLSPrivateKey
	// Client should only need a cert if the cert is not verifiable using system Root CAs
	TLSCert []byte

	// Logging level
	LogLevel string

	// Logger instance
	Logger *logrus.Logger
}

Config stores wormole shared parameters

type ServerConfig

type ServerConfig struct {
	Config

	// cluster identifier of wormhole servers
	// used as metadata for session storage
	ClusterURL string

	// URL of Redis instance
	// Redis powers the session storage
	RedisURL string

	// ID of the wormhole server
	// used as metadata for session storage
	NodeID string

	// SSH private key is used by the server when SSH tunneling is used
	// as transportation layer
	SSHPrivateKey []byte

	// TLS Private key is used by the server when TLS conn pool is used
	// as transporation layer
	TLSPrivateKey []byte

	// API token for error reporting to Bugsnag
	BugsnagAPIKey string

	// Port used by HTTP server to serve metrics
	// Used by Prometheus to scrape wormhole server endpoint
	MetricsAPIPort string
}

ServerConfig stores wormhole server parameters

func NewServerConfig

func NewServerConfig() (*ServerConfig, error)

NewServerConfig parses config values collected from Viper and validates them it returns a ServerConfig struct or an error if config values are invalid

type TunnelProto

type TunnelProto int

TunnelProto specifies the type of transport protocol used by wormhole instance

const (
	// SSH tunnel with remote port forwarding
	SSH TunnelProto = iota
	// TCP connection pool
	TCP
	// TLS connection pool
	TLS

	// UNSUPPORTED is a catch all for unsupported protocol types
	UNSUPPORTED
)

func ParseTunnelProto

func ParseTunnelProto(proto string) TunnelProto

ParseTunnelProto converts protocol string name to TunnelProto

Jump to

Keyboard shortcuts

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