### Start the SSH server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Listens on the configured address and starts the server loop. ```go func (srv *Server) ListenAndServe() error ``` -------------------------------- ### Start SSH Server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Accepts incoming SSH connections on the provided listener and processes them using the specified handler. ```go func Serve(l net.Listener, handler Handler, options ...Option) error ``` -------------------------------- ### Start an SSH server with a host key file Source: https://pkg.go.dev/github.com/gliderlabs/ssh Configures the server to use a specific host key file to avoid generating a new key on every startup. ```go log.Fatal(ssh.ListenAndServe(":2222", nil, ssh.HostKeyFile("/Users/progrium/.ssh/id_rsa"))) ``` -------------------------------- ### Start an SSH server with a default handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Initializes an SSH server on a specified port using the default handler to process sessions. ```go ssh.Handle(func(s ssh.Session) { io.WriteString(s, "Hello world\n") }) log.Fatal(ssh.ListenAndServe(":2222", nil)) ``` -------------------------------- ### func ListenAndServe Source: https://pkg.go.dev/github.com/gliderlabs/ssh Starts an SSH server with a given address, handler, and optional configuration options. ```APIDOC ## func ListenAndServe(addr string, handler Handler, options ...Option) error ### Description Starts an SSH server with a given address, handler, and options. The handler is usually nil, which means to use DefaultHandler. ### Parameters - **addr** (string) - Required - The address to listen on. - **handler** (Handler) - Optional - The handler to process sessions. - **options** (...Option) - Optional - Functional options to configure the server. ``` -------------------------------- ### func (*Server) ListenAndServe Source: https://pkg.go.dev/github.com/gliderlabs/ssh Starts the SSH server by listening on the configured TCP address and serving incoming connections. ```APIDOC ## func (*Server) ListenAndServe() error ### Description Listens on the TCP network address srv.Addr and then calls Serve to handle incoming connections. If srv.Addr is blank, ":22" is used. Always returns a non-nil error. ``` -------------------------------- ### Create a basic SSH server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Initializes a simple SSH server that responds with 'Hello world' to any session, listening on port 2222. ```go package main import ( "github.com/gliderlabs/ssh" "io" "log" ) func main() { ssh.Handle(func(s ssh.Session) { io.WriteString(s, "Hello world\n") }) log.Fatal(ssh.ListenAndServe(":2222", nil)) } ``` -------------------------------- ### Initialize Agent Listener Source: https://pkg.go.dev/github.com/gliderlabs/ssh Sets up a temporary Unix socket for forwarding connections. ```go func NewAgentListener() (net.Listener, error) ``` -------------------------------- ### Serve incoming connections Source: https://pkg.go.dev/github.com/gliderlabs/ssh Accepts connections on a listener and spawns goroutines for each session. ```go func (srv *Server) Serve(l net.Listener) error ``` -------------------------------- ### Define a server configuration callback Source: https://pkg.go.dev/github.com/gliderlabs/ssh A hook for generating custom default server configurations. ```go type ServerConfigCallback func(ctx Context) *gossh.ServerConfig ``` -------------------------------- ### Server Configuration Source: https://pkg.go.dev/github.com/gliderlabs/ssh Main structure for configuring the SSH server instance. ```go type Server struct { Addr string // TCP address to listen on, ":22" if empty Handler Handler // handler to invoke, ssh.DefaultHandler if nil HostSigners []Signer // private keys for the host key, must have at least one Version string // server version to be sent before the initial handshake Banner string // server banner BannerHandler BannerHandler // server banner handler, overrides Banner KeyboardInteractiveHandler KeyboardInteractiveHandler // keyboard-interactive authentication handler PasswordHandler PasswordHandler // password authentication handler PublicKeyHandler PublicKeyHandler // public key authentication handler PtyCallback PtyCallback // callback for allowing PTY sessions, allows all if nil ConnCallback ConnCallback // optional callback for wrapping net.Conn before handling LocalPortForwardingCallback LocalPortForwardingCallback // callback for allowing local port forwarding, denies all if nil ReversePortForwardingCallback ReversePortForwardingCallback // callback for allowing reverse port forwarding, denies all if nil ServerConfigCallback ServerConfigCallback // callback for configuring detailed SSH options SessionRequestCallback SessionRequestCallback // callback for allowing or denying SSH sessions ConnectionFailedCallback ConnectionFailedCallback // callback to report connection failures IdleTimeout time.Duration // connection timeout when no activity, none if empty MaxTimeout time.Duration // absolute connection timeout, none if empty // ChannelHandlers allow overriding the built-in session handlers or provide // extensions to the protocol, such as tcpip forwarding. By default only the // "session" handler is enabled. ChannelHandlers map[string]ChannelHandler // RequestHandlers allow overriding the server-level request handlers or // provide extensions to the protocol, such as tcpip forwarding. By default // no handlers are enabled. RequestHandlers map[string]RequestHandler } ``` -------------------------------- ### Configure a custom SSH server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Manually initializes a Server struct to define custom handlers and add host keys. ```go s := &ssh.Server{ Addr: ":2222", Handler: sessionHandler, PublicKeyHandler: authHandler, } s.AddHostKey(hostKeySigner) log.Fatal(s.ListenAndServe()) ``` -------------------------------- ### Set server options Source: https://pkg.go.dev/github.com/gliderlabs/ssh Applies a functional option to the server configuration. ```go func (srv *Server) SetOption(option Option) error ``` -------------------------------- ### Define Server Options Source: https://pkg.go.dev/github.com/gliderlabs/ssh Functional options for configuring the SSH server. ```go type Option func(*Server) error ``` ```go func HostKeyFile(filepath string) Option ``` ```go func HostKeyPEM(bytes []byte) Option ``` ```go func KeyboardInteractiveAuth(fn KeyboardInteractiveHandler) Option ``` ```go func NoPty() Option ``` -------------------------------- ### Handle a raw connection Source: https://pkg.go.dev/github.com/gliderlabs/ssh Manually processes a net.Conn as an SSH connection. ```go func (srv *Server) HandleConn(newConn net.Conn) ``` -------------------------------- ### func Serve Source: https://pkg.go.dev/github.com/gliderlabs/ssh Accepts incoming SSH connections on the listener and handles them using the provided handler. ```APIDOC ## func Serve(l net.Listener, handler Handler, options ...Option) ### Description Serve accepts incoming SSH connections on the listener l, creating a new connection goroutine for each. The connection goroutines read requests and then calls handler to handle sessions. ### Signature `func Serve(l net.Listener, handler Handler, options ...Option) error` ``` -------------------------------- ### Define package context keys Source: https://pkg.go.dev/github.com/gliderlabs/ssh Variables used for accessing specific values within the package's context. ```go var ( // ContextKeyUser is a context key for use with Contexts in this package. // The associated value will be of type string. ContextKeyUser = &contextKey{"user"} // ContextKeySessionID is a context key for use with Contexts in this package. // The associated value will be of type string. ContextKeySessionID = &contextKey{"session-id"} // ContextKeyPermissions is a context key for use with Contexts in this package. // The associated value will be of type *Permissions. ContextKeyPermissions = &contextKey{"permissions"} ) ``` -------------------------------- ### Wrap Connection Source: https://pkg.go.dev/github.com/gliderlabs/ssh Sets a connection callback to wrap the net.Conn before handling. ```go func WrapConn(fn ConnCallback) Option ``` -------------------------------- ### func HostKeyFile Source: https://pkg.go.dev/github.com/gliderlabs/ssh Returns a functional option that adds HostSigners to the server from a PEM file at the specified filepath. ```APIDOC ## func HostKeyFile(filepath string) ### Description HostKeyFile returns a functional option that adds HostSigners to the server from a PEM file at filepath. ### Signature `func HostKeyFile(filepath string) Option` ``` -------------------------------- ### func NewAgentListener Source: https://pkg.go.dev/github.com/gliderlabs/ssh Sets up a temporary Unix socket that can be communicated to the session environment and used for forwarding connections. ```APIDOC ## func NewAgentListener() ### Description NewAgentListener sets up a temporary Unix socket that can be communicated to the session environment and used for forwarding connections. ### Signature `func NewAgentListener() (net.Listener, error)` ``` -------------------------------- ### SSH Utility Functions Source: https://pkg.go.dev/github.com/gliderlabs/ssh Functions for handling sessions, agent forwarding, and key comparisons. ```go func AgentRequested(sess Session) bool ``` ```go func DefaultSessionHandler(srv *Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx Context) ``` ```go func DirectTCPIPHandler(srv *Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx Context) ``` ```go func ForwardAgentConnections(l net.Listener, s Session) ``` ```go func Handle(handler Handler) ``` ```go func KeysEqual(ak, bk PublicKey) bool ``` ```go func ListenAndServe(addr string, handler Handler, options ...Option) error ``` -------------------------------- ### Configure Public Key Authentication Source: https://pkg.go.dev/github.com/gliderlabs/ssh Sets the public key authentication handler for the SSH server. ```go func PublicKeyAuth(fn PublicKeyHandler) Option ``` -------------------------------- ### Public Key Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Callback signature for performing public key authentication. ```go type PublicKeyHandler func(ctx Context, key PublicKey) bool ``` -------------------------------- ### Define Keyboard Interactive Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Callback for performing keyboard-interactive authentication. ```go type KeyboardInteractiveHandler func(ctx Context, challenger gossh.KeyboardInteractiveChallenge) bool ``` -------------------------------- ### Define Connection Callback Source: https://pkg.go.dev/github.com/gliderlabs/ssh Hook for new connections allowing wrapping for timeouts or limiting. ```go type ConnCallback func(ctx Context, conn net.Conn) net.Conn ``` -------------------------------- ### Default SSH Handlers Source: https://pkg.go.dev/github.com/gliderlabs/ssh Default maps for channel, request, and subsystem handlers. ```go var DefaultChannelHandlers = map[string]ChannelHandler{ "session": DefaultSessionHandler, } ``` ```go var DefaultRequestHandlers = map[string]RequestHandler{} ``` ```go var DefaultSubsystemHandlers = map[string]SubsystemHandler{} ``` -------------------------------- ### Configure Password Authentication Source: https://pkg.go.dev/github.com/gliderlabs/ssh Sets the password authentication handler for the SSH server. ```go func PasswordAuth(fn PasswordHandler) Option ``` -------------------------------- ### Define Signer Interface Source: https://pkg.go.dev/github.com/gliderlabs/ssh Interface for creating signatures that verify against a public key. ```go type Signer interface { gossh.Signer } ``` -------------------------------- ### Define Channel Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Callback for handling new SSH channels. ```go type ChannelHandler func(srv *Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx Context) ``` -------------------------------- ### type Server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Represents a custom SSH server instance with configurable settings. ```APIDOC ## type Server ### Description Allows for more granular control over the SSH server's behavior compared to the ListenAndServe helper. ### Methods - **AddHostKey(key Signer)** - Adds a host key to the server. - **ListenAndServe() error** - Starts the server based on the configured address and handlers. - **Close() error** - Closes the server listener. - **Shutdown(ctx context.Context) error** - Gracefully shuts down the server. ``` -------------------------------- ### Public Key Interface Source: https://pkg.go.dev/github.com/gliderlabs/ssh Abstraction for different types of SSH public keys. ```go type PublicKey interface { gossh.PublicKey } ``` -------------------------------- ### Define SSH Context Keys Source: https://pkg.go.dev/github.com/gliderlabs/ssh Context keys used for storing and retrieving metadata within the package's context. ```go // ContextKeyClientVersion is a context key for use with Contexts in this package. // The associated value will be of type string. ContextKeyClientVersion = &contextKey{"client-version"} // ContextKeyServerVersion is a context key for use with Contexts in this package. // The associated value will be of type string. ContextKeyServerVersion = &contextKey{"server-version"} // ContextKeyLocalAddr is a context key for use with Contexts in this package. // The associated value will be of type net.Addr. ContextKeyLocalAddr = &contextKey{"local-addr"} // ContextKeyRemoteAddr is a context key for use with Contexts in this package. // The associated value will be of type net.Addr. ContextKeyRemoteAddr = &contextKey{"remote-addr"} // ContextKeyServer is a context key for use with Contexts in this package. // The associated value will be of type *Server. ContextKeyServer = &contextKey{"ssh-server"} // ContextKeyConn is a context key for use with Contexts in this package. // The associated value will be of type gossh.ServerConn. ContextKeyConn = &contextKey{"ssh-conn"} // ContextKeyPublicKey is a context key for use with Contexts in this package. // The associated value will be of type PublicKey. ContextKeyPublicKey = &contextKey{"public-key"} ``` -------------------------------- ### Add a host key to the SSH server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Adds a private key as a host key. Overwrites existing keys with the same algorithm. ```go func (srv *Server) AddHostKey(key Signer) ``` -------------------------------- ### Gracefully shut down the server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Closes listeners and waits for active connections to finish. ```go func (srv *Server) Shutdown(ctx context.Context) error ``` -------------------------------- ### Set the server handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Configures the handler function for the SSH server. ```go func (srv *Server) Handle(fn Handler) ``` -------------------------------- ### Define Context Interface Source: https://pkg.go.dev/github.com/gliderlabs/ssh Package-specific context interface exposing connection metadata and synchronization primitives. ```go type Context interface { context.Context sync.Locker // User returns the username used when establishing the SSH connection. User() string // SessionID returns the session hash. SessionID() string // ClientVersion returns the version reported by the client. ClientVersion() string // ServerVersion returns the version reported by the server. ServerVersion() string // RemoteAddr returns the remote address for this connection. RemoteAddr() net.Addr // LocalAddr returns the local address for this connection. LocalAddr() net.Addr // Permissions returns the Permissions object used for this connection. Permissions() *Permissions // SetValue allows you to easily write new values into the underlying context. SetValue(key, value interface{}) } ``` -------------------------------- ### Define Banner Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Callback function used for displaying the server banner. ```go type BannerHandler func(ctx Context) string ``` -------------------------------- ### Password Handler Type Source: https://pkg.go.dev/github.com/gliderlabs/ssh Callback signature for performing password authentication. ```go type PasswordHandler func(ctx Context, password string) bool ``` -------------------------------- ### Request Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Handler for server-level requests. ```go type RequestHandler func(ctx Context, srv *Server, req *gossh.Request) (ok bool, payload []byte) ``` -------------------------------- ### func Handle Source: https://pkg.go.dev/github.com/gliderlabs/ssh Sets the default handler for the SSH server. ```APIDOC ## func Handle(handler Handler) ### Description Sets the DefaultHandler used by the server when no specific handler is provided. ### Parameters - **handler** (Handler) - Required - The handler function to process SSH sessions. ``` -------------------------------- ### Define Session Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Callback for handling established SSH sessions, with a default implementation provided. ```go type Handler func(Session) ``` ```go var DefaultHandler Handler ``` -------------------------------- ### Define Connection Failed Callback Source: https://pkg.go.dev/github.com/gliderlabs/ssh Hook for reporting failed connections; note that the connection is likely closed. ```go type ConnectionFailedCallback func(conn net.Conn, err error) ``` -------------------------------- ### Permissions Structure Source: https://pkg.go.dev/github.com/gliderlabs/ssh Holds fine-grained permissions specific to a user or authentication method. ```go type Permissions struct { *gossh.Permissions } ``` -------------------------------- ### PTY Callback Source: https://pkg.go.dev/github.com/gliderlabs/ssh Hook for allowing or denying PTY sessions. ```go type PtyCallback func(ctx Context, pty Pty) bool ``` -------------------------------- ### Reverse Port Forwarding Callback Source: https://pkg.go.dev/github.com/gliderlabs/ssh Hook for allowing reverse port forwarding. ```go type ReversePortForwardingCallback func(ctx Context, bindHost string, bindPort uint32) bool ``` -------------------------------- ### Configure Agent Request Source: https://pkg.go.dev/github.com/gliderlabs/ssh Modifies the session context to ensure AgentRequested returns true. ```go func SetAgentRequested(ctx Context) ``` -------------------------------- ### Define Local Port Forwarding Callback Source: https://pkg.go.dev/github.com/gliderlabs/ssh Hook for allowing or denying local port forwarding requests. ```go type LocalPortForwardingCallback func(ctx Context, destinationHost string, destinationPort uint32) bool ``` -------------------------------- ### PTY Configuration Source: https://pkg.go.dev/github.com/gliderlabs/ssh Represents a PTY request and its associated terminal configuration. ```go type Pty struct { Term string Window Window } ``` -------------------------------- ### func (*Server) AddHostKey Source: https://pkg.go.dev/github.com/gliderlabs/ssh Adds a private key as a host key to the SSH server. If a host key with the same algorithm already exists, it is overwritten. ```APIDOC ## func (*Server) AddHostKey(key Signer) ### Description Adds a private key as a host key. If an existing host key exists with the same algorithm, it is overwritten. Each server config must have at least one host key. ### Parameters - **key** (Signer) - Required - The private key to add as a host key. ``` -------------------------------- ### Define POSIX Signals Source: https://pkg.go.dev/github.com/gliderlabs/ssh Defines supported POSIX signals as per RFC 4254 Section 6.10. ```go type Signal string ``` ```go const ( SIGABRT Signal = "ABRT" SIGALRM Signal = "ALRM" SIGFPE Signal = "FPE" SIGHUP Signal = "HUP" SIGILL Signal = "ILL" SIGINT Signal = "INT" SIGKILL Signal = "KILL" SIGPIPE Signal = "PIPE" SIGQUIT Signal = "QUIT" SIGSEGV Signal = "SEGV" SIGTERM Signal = "TERM" SIGUSR1 Signal = "USR1" SIGUSR2 Signal = "USR2" ) ``` -------------------------------- ### SSH Session interface Source: https://pkg.go.dev/github.com/gliderlabs/ssh Defines the methods available for interacting with an active SSH session. ```go type Session interface { gossh.Channel // User returns the username used when establishing the SSH connection. User() string // RemoteAddr returns the net.Addr of the client side of the connection. RemoteAddr() net.Addr // LocalAddr returns the net.Addr of the server side of the connection. LocalAddr() net.Addr // Environ returns a copy of strings representing the environment set by the // user for this session, in the form "key=value". Environ() []string // Exit sends an exit status and then closes the session. Exit(code int) error // Command returns a shell parsed slice of arguments that were provided by the // user. Shell parsing splits the command string according to POSIX shell rules, // which considers quoting not just whitespace. Command() []string // RawCommand returns the exact command that was provided by the user. RawCommand() string // Subsystem returns the subsystem requested by the user. Subsystem() string // PublicKey returns the PublicKey used to authenticate. If a public key was not // used it will return nil. PublicKey() PublicKey // Context returns the connection's context. The returned context is always // non-nil and holds the same data as the Context passed into auth // handlers and callbacks. // // The context is canceled when the client's connection closes or I/O // operation fails. Context() Context // Permissions returns a copy of the Permissions object that was available for // setup in the auth handlers via the Context. Permissions() Permissions // Pty returns PTY information, a channel of window size changes, and a boolean // of whether or not a PTY was accepted for this session. Pty() (Pty, <-chan Window, bool) // Signals registers a channel to receive signals sent from the client. The // channel must handle signal sends or it will block the SSH request loop. // Registering nil will unregister the channel from signal sends. During the // time no channel is registered signals are buffered up to a reasonable amount. // If there are buffered signals when a channel is registered, they will be // sent in order on the channel immediately after registering. Signals(c chan<- Signal) } ``` -------------------------------- ### Close the SSH server Source: https://pkg.go.dev/github.com/gliderlabs/ssh Immediately closes all active listeners and connections. ```go func (srv *Server) Close() error ``` -------------------------------- ### Parse Authorized Key Source: https://pkg.go.dev/github.com/gliderlabs/ssh Parses a public key from an OpenSSH authorized_keys file. ```go func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) ``` -------------------------------- ### Define Subsystem Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Defines a function type for handling SSH subsystems. ```go type SubsystemHandler func(s Session) ``` -------------------------------- ### func (*Server) Close Source: https://pkg.go.dev/github.com/gliderlabs/ssh Immediately closes all active listeners and all active connections for the server. ```APIDOC ## func (*Server) Close() error ### Description Immediately closes all active listeners and all active connections. Returns any error returned from closing the underlying Listener(s). ``` -------------------------------- ### func ListenAndServe Source: https://pkg.go.dev/github.com/gliderlabs/ssh ListenAndServe listens on the TCP network address addr and then calls Serve with handler to handle sessions on incoming connections. ```APIDOC ## func ListenAndServe(addr string, handler Handler, options ...Option) error ### Description Listens on the TCP network address addr and then calls Serve with handler to handle sessions on incoming connections. If handler is nil, the DefaultHandler is used. ### Parameters - **addr** (string) - Required - The TCP network address to listen on. - **handler** (Handler) - Optional - The handler to process sessions. - **options** (...Option) - Optional - Configuration options for the server. ``` -------------------------------- ### Server Error Variable Source: https://pkg.go.dev/github.com/gliderlabs/ssh Error returned by server methods after shutdown or close. ```go var ErrServerClosed = errors.New("ssh: Server closed") ``` -------------------------------- ### func KeysEqual Source: https://pkg.go.dev/github.com/gliderlabs/ssh KeysEqual is a constant time compare of the keys to avoid timing attacks. ```APIDOC ## func KeysEqual(ak, bk PublicKey) bool ### Description Performs a constant time comparison of two public keys to prevent timing attacks. ### Parameters - **ak** (PublicKey) - Required - The first public key. - **bk** (PublicKey) - Required - The second public key. ``` -------------------------------- ### Define Session Request Callback Source: https://pkg.go.dev/github.com/gliderlabs/ssh Defines a callback function type for authorizing or denying SSH sessions. ```go type SessionRequestCallback func(sess Session, requestType string) bool ``` -------------------------------- ### func PasswordAuth Source: https://pkg.go.dev/github.com/gliderlabs/ssh Returns a functional option that sets the PasswordHandler on the SSH server. ```APIDOC ## func PasswordAuth(fn PasswordHandler) Option ### Description PasswordAuth returns a functional option that sets PasswordHandler on the server. ### Parameters - **fn** (PasswordHandler) - Required - The callback function for performing password authentication. ``` -------------------------------- ### func PublicKeyAuth Source: https://pkg.go.dev/github.com/gliderlabs/ssh Returns a functional option that sets the PublicKeyHandler on the SSH server. ```APIDOC ## func PublicKeyAuth(fn PublicKeyHandler) Option ### Description PublicKeyAuth returns a functional option that sets PublicKeyHandler on the server. ### Parameters - **fn** (PublicKeyHandler) - Required - The callback function for performing public key authentication. ``` -------------------------------- ### func (*Server) Shutdown Source: https://pkg.go.dev/github.com/gliderlabs/ssh Gracefully shuts down the server without interrupting active connections. ```APIDOC ## func (*Server) Shutdown(ctx context.Context) error ### Description Gracefully shuts down the server without interrupting any active connections. It closes all open listeners and waits indefinitely for connections to close. If the provided context expires, the context's error is returned. ### Parameters - **ctx** (context.Context) - Required - The context to control the shutdown timeout. ``` -------------------------------- ### func Handle Source: https://pkg.go.dev/github.com/gliderlabs/ssh Handle registers the handler as the DefaultHandler. ```APIDOC ## func Handle(handler Handler) ### Description Registers the provided handler as the default handler for the package. ### Parameters - **handler** (Handler) - Required - The handler to register. ``` -------------------------------- ### Register Break Channel Source: https://pkg.go.dev/github.com/gliderlabs/ssh Registers a channel to receive break request notifications from the client. ```go Break(c chan<- bool) } ``` -------------------------------- ### Parse Public Key Source: https://pkg.go.dev/github.com/gliderlabs/ssh Parses an SSH public key formatted for the SSH wire protocol. ```go func ParsePublicKey(in []byte) (out PublicKey, err error) ``` -------------------------------- ### Define PTY Window Source: https://pkg.go.dev/github.com/gliderlabs/ssh Represents the dimensions of a PTY window. ```go type Window struct { Width int Height int } ``` -------------------------------- ### func ParsePublicKey Source: https://pkg.go.dev/github.com/gliderlabs/ssh Parses an SSH public key formatted for the SSH wire protocol. ```APIDOC ## func ParsePublicKey(in []byte) (out PublicKey, err error) ### Description ParsePublicKey parses an SSH public key formatted for use in the SSH wire protocol according to RFC 4253, section 6.6. ### Parameters - **in** ([]byte) - Required - The byte slice containing the public key data. ``` -------------------------------- ### func NoPty Source: https://pkg.go.dev/github.com/gliderlabs/ssh Returns a functional option that sets PtyCallback to return false, denying PTY requests. ```APIDOC ## func NoPty() ### Description NoPty returns a functional option that sets PtyCallback to return false, denying PTY requests. ### Signature `func NoPty() Option` ``` -------------------------------- ### Define Forwarded TCP Handler Source: https://pkg.go.dev/github.com/gliderlabs/ssh Handler for TCP forwarding requests, enabled by adding HandleSSHRequest to server request handlers. ```go type ForwardedTCPHandler struct { sync.Mutex // contains filtered or unexported fields } ``` ```go func (h *ForwardedTCPHandler) HandleSSHRequest(ctx Context, srv *Server, req *gossh.Request) (bool, []byte) ``` -------------------------------- ### func ParseAuthorizedKey Source: https://pkg.go.dev/github.com/gliderlabs/ssh Parses a public key from an authorized_keys file format. ```APIDOC ## func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) ### Description ParseAuthorizedKey parses a public key from an authorized_keys file used in OpenSSH according to the sshd(8) manual page. ### Parameters - **in** ([]byte) - Required - The byte slice containing the authorized_keys data. ``` -------------------------------- ### func AgentRequested Source: https://pkg.go.dev/github.com/gliderlabs/ssh AgentRequested returns true if the client requested agent forwarding. ```APIDOC ## func AgentRequested(sess Session) bool ### Description Checks if the SSH client has requested agent forwarding for the given session. ### Parameters - **sess** (Session) - Required - The current SSH session. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.