ssh

package
v0.0.0-...-086e79a Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package ssh provides core SSH server functionality for ssh-ify.

Index

Constants

View Source
const (
	// SSHBufferPoolSize is the size of each buffer in the SSH pool (32KB)
	// Optimized for SSH channel data transfer
	SSHBufferPoolSize = 32 * 1024
)

Constants

Variables

This section is empty.

Functions

func CopyWithSSHBuffer

func CopyWithSSHBuffer(dst io.Writer, src io.Reader) (int64, error)

CopyWithSSHBuffer performs buffered copying using a pooled buffer.

func ForwardData

func ForwardData(ch ssh.Channel, targetConn net.Conn, addr string)

Channel handling functions ForwardData relays data bidirectionally between an SSH channel and a target connection.

func GetUserDB

func GetUserDB() *usermgmt.UserDB

GetUserDB returns the global user database instance.

func HandleSSHChannels

func HandleSSHChannels(chans <-chan ssh.NewChannel)

HandleSSHChannels processes incoming SSH channels for port forwarding.

func HandleSSHConnection

func HandleSSHConnection(conn net.Conn, config *ssh.ServerConfig, onAuthSuccess func())

Server functions HandleSSHConnection handles an incoming SSH connection.

func InitializeAuth

func InitializeAuth(dbPath string) error

Authentication functions InitializeAuth sets up the global authentication system.

func NewConfig

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

Configuration functions NewConfig initializes and returns a new SSH server configuration.

func NewRSAPrivateKey

func NewRSAPrivateKey(bitSize int) (*rsa.PrivateKey, error)

Key generation functions NewRSAPrivateKey generates a new RSA private key.

func PasswordAuth

func PasswordAuth(c ssh.ConnMetadata, password []byte) (*ssh.Permissions, error)

PasswordAuth implements ssh.PasswordCallback for authentication.

func RSAPrivateKeyPEM

func RSAPrivateKeyPEM(privateKey *rsa.PrivateKey) []byte

RSAPrivateKeyPEM encodes an RSA private key to PEM format.

Types

type ServerConfig

type ServerConfig = ssh.ServerConfig

Type aliases ServerConfig is a type alias for ssh.ServerConfig.

Jump to

Keyboard shortcuts

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