httpshell

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

Jump to

Keyboard shortcuts

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