sshutil

package module
v0.0.0-...-0f81462 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJumpHost = errors.New("sshutil: jump host")
View Source
var ErrNoKnownHosts = errors.New("no known hosts")
View Source
var ErrReverseProxyListenerClosed = errors.New("reverse proxy listener closed")
View Source
var ErrUntrustedHost = errors.New("untrusted host")

Functions

func ClientConfig

func ClientConfig(kc Keychain, user string) *ssh.ClientConfig

func DialTCPJumpHosts

func DialTCPJumpHosts(ctx context.Context, address string, jhosts ...JumpHost) (net.Conn, error)

Dials to the given address and proceeds to jump. The resulting net.Conn's Close() propagates closing of all intermediate connections. TODO: ctx is respected except for golang.org/x/crypto/ssh calls.

func DirectTCPIP

func DirectTCPIP(ctx context.Context, transport net.Conn, jhost JumpHost) (net.Conn, error)

func DiscardNewChannels

func DiscardNewChannels(nchans <-chan ssh.NewChannel)

func ReadKeychain

func ReadKeychain(privateKeyFile, knownHostsFile string) (*keychain, error)

Types

type JumpHost

type JumpHost struct {
	PrivateKey ssh.Signer
	HostKey    ssh.PublicKey
	User       string

	NextAddress string
	NextPort    int
}

type Keychain

type Keychain interface {
	PrivateKey() ssh.Signer
	TrustsHost(string, ssh.PublicKey) bool
}

A Keychain holds one private key and a relation from hosts to trusted public keys. A Keychain's methods may be called concurrently.

type ReverseProxy

type ReverseProxy struct {
	// contains filtered or unexported fields
}

func NewReverseProxy

func NewReverseProxy(kc Keychain, address string, port int, user string) *ReverseProxy

func (*ReverseProxy) Listen

func (proxy *ReverseProxy) Listen(ctx context.Context, endpoint string) (net.Listener, error)

type ReverseProxyListener

type ReverseProxyListener struct {
	// contains filtered or unexported fields
}

func (*ReverseProxyListener) Accept

func (ln *ReverseProxyListener) Accept() (net.Conn, error)

func (*ReverseProxyListener) Addr

func (ln *ReverseProxyListener) Addr() net.Addr

func (*ReverseProxyListener) Close

func (ln *ReverseProxyListener) Close() error

type ReverseProxyListenerAddr

type ReverseProxyListenerAddr struct {
	// contains filtered or unexported fields
}

func (*ReverseProxyListenerAddr) Network

func (addr *ReverseProxyListenerAddr) Network() string

func (*ReverseProxyListenerAddr) String

func (addr *ReverseProxyListenerAddr) String() string

Jump to

Keyboard shortcuts

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