ssh

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GostSSHTunnelRequest = "gost-tunnel" // extended request type for ssh tunnel
)

Variables

View Source
var (
	ErrSessionDead = errors.New("session is dead")
)

Functions

func NewClientConn

func NewClientConn(session *Session) net.Conn

func NewConn

func NewConn(conn net.Conn, channel ssh.Channel) net.Conn

func ParseAuthorizedKeysFile

func ParseAuthorizedKeysFile(name string) (map[string]bool, error)

ParseSSHAuthorizedKeysFile parses ssh authorized keys file.

Types

type ClientConn

type ClientConn struct {
	net.Conn
	// contains filtered or unexported fields
}

a dummy ssh client conn used by client connector

func (*ClientConn) Client

func (c *ClientConn) Client() *ssh.Client

type PasswordCallbackFunc

type PasswordCallbackFunc func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error)

PasswordCallbackFunc is a callback function used by SSH server. It authenticates user using a password.

func PasswordCallback

func PasswordCallback(au auth.Authenticator) PasswordCallbackFunc

type PublicKeyCallbackFunc

type PublicKeyCallbackFunc func(c ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error)

PublicKeyCallbackFunc is a callback function used by SSH server. It offers a public key for authentication.

func PublicKeyCallback

func PublicKeyCallback(keys map[string]bool) PublicKeyCallbackFunc

type Session

type Session struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewSession

func NewSession(c net.Conn, client *ssh.Client, log logger.Logger) *Session

func (*Session) IsClosed

func (s *Session) IsClosed() bool

func (*Session) Keepalive

func (s *Session) Keepalive(interval, timeout time.Duration, retries int)

func (*Session) OpenChannel

func (s *Session) OpenChannel(name string) (ssh.Channel, <-chan *ssh.Request, error)

func (*Session) Wait

func (s *Session) Wait() error

func (*Session) WaitClose

func (s *Session) WaitClose()

Jump to

Keyboard shortcuts

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