app

package
v0.0.0-...-cd80b12 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HTTPResponseCtr allows the counting of Http Responses and their status codes
	HTTPResponseCtr = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "undergang_http_response_total",
			Help: "Number of http responses",
		},
		[]string{"code"},
	)
	// BackendActive allows the counting of active (registered) backends
	BackendActive = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "undergang_backend_active_total",
			Help: "Number of active backends",
		},
	)
	// BackendsRegistered allows the counting of backends that have been registered
	BackendsRegistered = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "undergang_backend_registered_total",
			Help: "Number of backends that have been registered",
		},
	)
	// BackendsStarted allows the counting of backends that have been started
	BackendsStarted = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "undergang_backend_started_total",
			Help: "Number of backends that have been started",
		},
	)
	// BackendsUnregistered allows the counting of backends that have been unregistered
	BackendsUnregistered = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "undergang_backend_unregistered_total",
			Help: "Number of backends that have been unregistered",
		},
	)
	// BackendFailure allows the counting of backends and the corresponding failure reason
	BackendFailure = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "undergang_backend_failure_total",
			Help: "Number of backends that have failed",
		},
		[]string{"reason"},
	)
	// BackendReconnectSSH allows the counting of backends that have reconnected to the SSH server
	BackendReconnectSSH = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "undergang_backend_reconnect_ssh_total",
			Help: "Number of backends that have reconnected to SSH",
		},
	)
	// BackendProvisioningDuration allows the histogram of provisioning durations
	BackendProvisioningDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "undergang_backend_provisioning_seconds",
			Help:    "Provisioning duration for backends",
			Buckets: []float64{1, 5, 10, 30, 1 * 60, 2 * 60, 3 * 60, 4 * 60, 5 * 60, 10 * 60, 20 * 60},
		},
	)
	// BackendConnectSSHDuration allows the histogram of provisioning durations
	BackendConnectSSHDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "undergang_backend_connect_ssh_seconds",
			Help:    "SSH connection duration for backends",
			Buckets: []float64{1, 5, 10, 30, 1 * 60, 2 * 60, 3 * 60, 4 * 60, 5 * 60},
		},
	)
	// BackendBootstrapDuration allows the histogram of provisioning durations
	BackendBootstrapDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "undergang_backend_bootstrap_seconds",
			Help:    "SSH bootstrap duration for backends",
			Buckets: []float64{1, 5, 10, 30, 1 * 60, 2 * 60, 3 * 60, 4 * 60, 5 * 60, 10 * 60, 20 * 60},
		},
	)
)

Functions

func AddPath

func AddPath(info PathInfo)

AddPath adds a backend to the manager

func Init

func Init(extPathLookupURL, proxyCmd, version string)

Init initializes the application

func UnregisterBackend

func UnregisterBackend(id int)

UnregisterBackend unregisters a backend from the manager

Types

type Backend

type Backend interface {
	ID() int
	Start()
	IsReady() bool
	Connect() net.Conn
	GetInfo() PathInfo
	Subscribe(chan progressCmd)
	GetLogger() *logrus.Entry
}

Backend represents a tunnel to an app reached by a SSH tunnel

func LookupBackend

func LookupBackend(host, path string) Backend

LookupBackend looks up a backend given a host and path

func NewBackend

func NewBackend(id int, info PathInfo) Backend

NewBackend instantiates a new backend

type PathInfo

type PathInfo struct {
	Host         string              `json:"host"`
	Prefix       string              `json:"prefix"`
	Provisioning *configProvisioning `json:"provisioning"`
	SSHTunnel    *configSSHTunnel    `json:"ssh_tunnel"`

	Backend         *configBackend    `json:"backend"`
	StaticOverrides map[string]string `json:"static_overrides"`

	ProgressPage *configProgressPage `json:"progress_page"`

	BasicAuth *configBasicAuth `json:"basic_auth"`

	ServerAuth *configServerAuth `json:"server_auth"`
}

PathInfo represents the configuration of a backend

type Signer

type Signer struct {
	Sep string
	// contains filtered or unexported fields
}

Signer signs a payload

func NewSigner

func NewSigner(h hash.Hash) *Signer

NewSigner creates a new signer

func (*Signer) Sign

func (s *Signer) Sign(msg string) string

Sign signs a payload

func (Signer) Verify

func (s Signer) Verify(b string) (string, error)

Verify verifies that the message has been untampered

type TimestampSigner

type TimestampSigner struct {
	*Signer
}

TimestampSigner signs a message that has to be verified within a duration

func NewTimestampSigner

func NewTimestampSigner(h hash.Hash) *TimestampSigner

NewTimestampSigner creates a new TimestampSigner

func (*TimestampSigner) Sign

func (s *TimestampSigner) Sign(msg string) string

Sign signs a message

func (*TimestampSigner) SignWithTime

func (s *TimestampSigner) SignWithTime(msg string, now int64) string

SignWithTime signs a message with a given timestamp

func (*TimestampSigner) Verify

func (s *TimestampSigner) Verify(b string, dur time.Duration) (string, error)

Verify verifies that the message was signed within the specified duration

func (*TimestampSigner) VerifyWithTime

func (s *TimestampSigner) VerifyWithTime(b string, now int64, dur time.Duration) (string, error)

VerifyWithTime verifies that the message was signed within the specified duration

Jump to

Keyboard shortcuts

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