ssh

package
v0.0.0-...-3faa176 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const IdleTimeout = time.Minute

IdleTimeout sets how long a session can be idle before getting disconnected

View Source
const KeepAliveInterval = time.Minute * 10
View Source
const KeepAliveTimeout = time.Second * 15

Variables

View Source
var RawPrivateKey string

RawPrivateKey could be set with ldflags on build time

Functions

func CommandReset

func CommandReset(cmd *cobra.Command)

CommandReset does various house keeping

func DefaultCmd

func DefaultCmd(s *Session, r *routertwo.Router) *cobra.Command

DefaultCmd is the default top level command, embedding all others

func DefaultConfig

func DefaultConfig() (*ssh.ServerConfig, error)

DefaultConfig generates a default ssh.ServerConfig

Types

type ChannelConn

type ChannelConn struct {
	ssh.Channel
}

ChannelConn embedds a ssh.Channel and implements dummy methods to fulfill the net.Conn interface

func (*ChannelConn) LocalAddr

func (c *ChannelConn) LocalAddr() net.Addr

LocalAddr is required by net.Conn

func (*ChannelConn) RemoteAddr

func (c *ChannelConn) RemoteAddr() net.Addr

RemoteAddr is required by net.Conn

func (*ChannelConn) SetDeadline

func (c *ChannelConn) SetDeadline(_ time.Time) error

SetDeadline is required by net.Conn

func (*ChannelConn) SetReadDeadline

func (c *ChannelConn) SetReadDeadline(_ time.Time) error

SetReadDeadline is required by net.Conn

func (*ChannelConn) SetWriteDeadline

func (c *ChannelConn) SetWriteDeadline(_ time.Time) error

SetWriteDeadline is required by net.Conn

type Console

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

Console represents a terminal and handles commands

func (*Console) Accept

func (c *Console) Accept(channelRequest ssh.NewChannel) error

Accept accepts a session NewChannel and sets up the terminal and commands

type Server

type Server struct {
	// Config is the ssh serverconfig
	Config *ssh.ServerConfig

	Router *routertwo.Router
}

Server represents a listening ssh server

func (*Server) Serve

func (s *Server) Serve(l net.Listener) error

Serve will accept ssh connections

type Session

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

Session represents a ongoing SSH connection

func (*Session) Close

func (s *Session) Close() error

Close closes a ssh session

func (*Session) DialContext

func (s *Session) DialContext(ctx context.Context, network, address string) (net.Conn, error)

DialContext tries to dial connections though the ssh session FIXME: figure out what to do with the Context

func (*Session) DisableTimeout

func (s *Session) DisableTimeout()

DisableTimeout disables the idle timeout, used when a connection provides some endpoints i.e. requests ports to be forwarded...

func (*Session) FQDN

func (s *Session) FQDN() string

FQDN returns the fully qualified hostname for this session

func (*Session) Forwards

func (s *Session) Forwards() map[uint32]struct{}

Forwards returns a copy of forwarded port numbers

func (*Session) Handle

func (s *Session) Handle()

Handle takes care of a Sessions lifetime

func (*Session) KeepAlive

func (s *Session) KeepAlive()

func (*Session) PokeTimeout

func (s *Session) PokeTimeout()

PokeTimeout postprones the idle timer - unless disabled or already fired

func (*Session) Replaced

func (s *Session) Replaced()

Replaced is called when another ssh session is replacing this current one

func (*Session) Timeout

func (s *Session) Timeout()

Timeout fires when the session has done too much idling

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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