Back to godoc.org

Package httpshell

v1.0.0
Latest Go to latest

The highest tagged major version is .

Published: Jun 18, 2019 | License: Apache-2.0 | Module: github.com/scylladb/go-sshtools

Index

type Dialer

type Dialer struct {

	// OnDial is a listener that may be set to track openning SSH connection to
	// the remote host. It is called for both successful and failed trials.
	OnDial func(host string, err error)
	// OnConnClose is a listener that may be set to track closing of SSH
	// connection.
	OnConnClose func(host string)
	// contains filtered or unexported fields
}

Dialer allows for proxying connections over SSH. It can be used with HTTP client to allow communication with a HTTP shell using Listener and serving HTTP request over stdin and stdout.

func NewDialer

func NewDialer(config sshtools.Config, dial sshtools.DialContextFunc, logger sshtools.Logger) *Dialer

func (*Dialer) DialContext

func (p *Dialer) DialContext(ctx context.Context, network, addr string) (conn net.Conn, err error)

DialContext to addr HOST:PORT establishes an SSH connection to HOST and then sends request to the SSH shell.

type Listener

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

Listener is a net.Listener that accepts only a single connection that uses the given reader and writer. It's intended to be used with http.Server, it can then expose http.Handlers over all sorts of transports.

After accepting the first connection any calls to Accept will block until the connection is closed, then they will end immediately with io.EOF error. This is needed to block http.Server main loop and avoid termination of the golden connection.

func NewListener

func NewListener(w io.Writer, r io.ReadCloser) *Listener

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier