config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 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

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

	// LocalEndpointUseTLS allows us to specify whether to connect to local
	// Note: this is for wh-client <-> local-endpoint only
	LocalEndpointUseTLS bool

	// LocalEndpointInsecureSkipVerify disables SSL cert verification for local endpoints
	// Note: this is for wh-client <-> local-endpoint only
	LocalEndpointInsecureSkipVerify bool

	// LocalEndpointCACert is the data for a CACert to verify the local endpoint
	// Note: this is for wh-client <-> local-endpoint only
	LocalEndpointCACert []byte

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

	// Token for auth when connecting to wormhole server
	Token string

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

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

	// ReleaseBranch...
	// when set this will override the default VCS branch
	// defaults to FLY_RELASE_BRANCH (but can be overridden 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

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

	// Version...
	// wormhole's version
	Version string

	// Localhost...
	// 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

	// TLSCert is used when TLS conn pool is used as transportation layer
	// Server also needs TLSPrivateKey
	// Client should only need a cert if the cert is not verifiable using system Root CAs
	// Note: this is only for use with conns between wh-server <-> wh-client
	TLSCert []byte

	// Insecure allows one not to use tls for handlers which support it
	// this is only for use with wh-server <-> wh-client conns
	Insecure bool

	// LogLevel represents which level we should log eg: info, debug ...
	LogLevel string

	// Logger instance
	Logger *logrus.Logger
}

Config stores wormole shared parameters

type ServerConfig

type ServerConfig struct {
	Config

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

	// RedisURL is url of Redis instance
	// Redis powers the session storage
	RedisURL string

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

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

	// TLSPrivateKey is used as the global private key for all listening ports
	// Currently this includes TLS tunnels and receiving conns used for SNI
	// based client forwarding
	TLSPrivateKey []byte

	// UseSharedPortForwarding indicates we should use a shared bound port for forwarding connections
	// And determine the endpoint to forward to via an ID in the SNI eg: <uid>.wormhole.server.com:443
	//
	// NOTE: We still use the old version along side shared port when in use. When not specified we use
	// the legacy 1-port per session only
	UseSharedPortForwarding bool

	// SharedTLSForwardingPort is the port we should bind the shared tls forwarding to
	SharedTLSForwardingPort string

	// SharedPortTLSCert is the tls cert to be used by the shared port listener
	SharedPortTLSCert []byte

	// SharedPortPrivateKey is the tls Private key to be used by the shared port listener
	SharedPortTLSPrivateKey []byte

	// BugsnagAPIKey token for error reporting to Bugsnag
	BugsnagAPIKey string

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

	// Region represents the location of the wormhole server
	Region 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
	// HTTP2 connection pool
	HTTP2

	// 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