Documentation
¶
Overview ¶
Package ext provides optional integrations for gosip.
Index ¶
Constants ¶
const DefaultMaxChannelsPerConnection = 32
DefaultMaxChannelsPerConnection is the number of concurrently open S/IP channels one SSH connection may hold unless WithMaxChannelsPerConnection says otherwise.
Variables ¶
var ErrInvalidSIPMuxInstall = errors.New("invalid S/IP mux installation")
Functions ¶
func AttachSIPSource ¶
func AttachSIPSource( ctx context.Context, server *gliderssh.Server, sourceFactory SIPSourceFactory, connOptions []sip.ConnOption, attachOptions ...AttachOption, ) error
AttachSIPSource adds S/IP handling to a caller-owned gliderlabs SSH server. Each authorized direct-tcpip channel gets a source from sourceFactory and a per-channel sip.Serve loop. connOptions are passed to each Serve call. The supplied context and the SSH connection context control that call's lifetime.
Configure SSH authentication directly on server. Authentication is not required by this attachment: gliderlabs allows unauthenticated clients when no authentication handlers are configured. Do not treat TargetRequest.Username as an authenticated identity in that case. A pre-existing LocalPortForwardingCallback remains an additional filter. Other handlers are preserved; a pre-existing direct-tcpip handler is rejected. Call AttachSIPSource before server.Serve.
The number of open channels per SSH connection is limited, see WithMaxChannelsPerConnection.
Types ¶
type AttachOption ¶ added in v0.0.4
type AttachOption func(*attachConfig) error
AttachOption configures AttachSIPSource.
func WithMaxChannelsPerConnection ¶ added in v0.0.4
func WithMaxChannelsPerConnection(n int) AttachOption
WithMaxChannelsPerConnection limits how many direct-tcpip channels one SSH connection may have open at the same time. Every channel runs its own sip.Serve loop (with its own connection limit) and bridge, which costs five goroutines, so without this limit a single SSH connection can open an unbounded number of them. Channels beyond the limit are rejected with ResourceShortage and the limit is released when a channel closes. n must be greater than 0. The default is DefaultMaxChannelsPerConnection.
type SIPSourceFactory ¶
type SIPSourceFactory func(ctx context.Context, target TargetRequest) (sip.SyncClient, error)
SIPSourceFactory selects the SyncClient used for one SSH forwarding target. Return an error to reject the target. The returned client may be a source or a mux such as sip.NewMux(source). The factory may be called concurrently. ctx is a standard context.Context derived from the SSH connection context.
type TargetRequest ¶
TargetRequest identifies an SSH client's requested direct-tcpip destination.