Documentation
¶
Overview ¶
Package forward runs port forwards over SSH: local (ssh -L), remote (ssh -R) and dynamic (ssh -D, a local HTTP/SOCKS proxy whose targets are dialed, and their names resolved, on the server). A forward rides a session without a shell, so it shares the host's pooled connection with the host's terminals and reconnects with the session's backoff.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPortInUse = errors.New("forward: port already in use")
ErrPortInUse is a local port another program listens on.
Functions ¶
This section is empty.
Types ¶
type Forward ¶
type Forward struct {
// Conns are the connections relayed now.
Conns *netproxy.Registry
// contains filtered or unexported fields
}
Forward is one running rule. It is safe for concurrent use.
func New ¶
New returns a forward of r that connects as cfg says; Start runs it. opts.NoShell is set, and reconnecting is endless.
func (*Forward) SetOnChange ¶
func (f *Forward) SetOnChange(fn func())
SetOnChange sets fn to be called, from any goroutine, when the status or the connections change.
type RemoteRefusedError ¶
RemoteRefusedError is a server that would not listen for a remote forward.
func (*RemoteRefusedError) Error ¶
func (e *RemoteRefusedError) Error() string
func (*RemoteRefusedError) Unwrap ¶
func (e *RemoteRefusedError) Unwrap() error
type Rule ¶
type Rule struct {
Kind Kind
// Listen is host:port: on this computer for Local and Dynamic, on the
// server for Remote.
Listen string
// Target is host:port: seen from the server for Local, from this
// computer for Remote; unused for Dynamic.
Target string
// Protocol limits a dynamic forward's proxy; netproxy.Auto takes all.
Protocol netproxy.Protocol
// User and Password, when User is set, are asked of a dynamic
// forward's HTTP and SOCKS5 clients.
User, Password string
}
Rule is what a forward does.