upstream

package
v0.0.0-...-64130a5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() []string

All return all registered upstream providers

func Register

func Register(name string, driver Provider)

Register adds an upstream provider with given name to registry

func SplitHostPortForSSH

func SplitHostPortForSSH(addr string) (host string, port int, err error)

SplitHostPortForSSH is the modified version of net.SplitHostPort but return port 22 is no port is specified

Types

type CreatePipeOption

type CreatePipeOption struct {
	Username         string
	UpstreamUsername string
	Host             string
	Port             int
}

CreatePipeOption contains options for creating a pipe to upstream

type Handler

type Handler func(conn ssh.ConnMetadata, challengeContext ssh.AdditionalChallengeContext) (net.Conn, *ssh.AuthPipe, error)

Handler will be installed into sshpiper and help to establish the connection to upstream the returned auth pipe is to map/convert downstream auth method to another auth for connecting to upstream. e.g. map downstream public key to another upstream private key

type Pipe

type Pipe struct {
	Username         string
	UpstreamUsername string
	Host             string
	Port             int
}

Pipe is a connection which linked downstream and upstream SSHPiper searches pipe base on username

type PipeManager

type PipeManager interface {

	// Return All pipes inside upstream
	ListPipe() ([]Pipe, error)

	// Create a pipe inside upstream
	CreatePipe(opt CreatePipeOption) error

	// Remove a pipe from upstream
	RemovePipe(name string) error
}

PipeManager manages pipe inside upstream

type Provider

type Provider interface {
	registry.Plugin
	PipeManager

	GetHandler() Handler
}

Provider is a factory for Upstream Provider

func Get

func Get(name string) Provider

Get returns an upstream provider by name, return nil if not found

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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