ssh

package
v0.0.0-...-99ef61b Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// SshBitSize ssh bit size
	SshBitSize      = 2048
	StandardSshPort = 22
	// SshAuthKey auth key name
	SshAuthKey = "authorized"
	// SshAuthPrivateKey ssh private key
	SshAuthPrivateKey = "privateKey"
	// PostfixRsaKey postfix of local private key name
	PostfixRsaKey = ".key"
	Eol           = "\n"
)

Variables

View Source
var (
	UserHome      = os.Getenv("HOME")
	NettoolHome   = fmt.Sprintf("%s/.nettool", UserHome)
	NettoolKeyDir = fmt.Sprintf("%s/key", NettoolHome)
)
View Source
var BackgroundLogger = io.Discard

Functions

func ChannelWithAuth

func ChannelWithAuth(username, password string) channelOpt

func ChannelWithPrivateKey

func ChannelWithPrivateKey(privateKey string) channelOpt

func ChannelWithRemoteSSH

func ChannelWithRemoteSSH(sshAddress string) channelOpt

func CleanRsaKeys

func CleanRsaKeys()

CleanRsaKeys ...

func PrivateKeyPath

func PrivateKeyPath(name string) string

PrivateKeyPath ...

func WritePrivateKey

func WritePrivateKey(privateKeyPath string, data []byte) error

WritePrivateKey write ssh private key to privateKeyPath

Types

type IChannel

type IChannel interface {
	StartSocks5Proxy(ctx context.Context, local string) error
	Socks5HeartBeat(remoteIP, socks5Address string) *time.Ticker
	ForwardRemoteToLocal(privateKey, sshAddress, remoteEndpoint, localEndpoint string) error
	RunScript(sshAddress, script string) (string, error)
}

Channel network channel

func NewChannel

func NewChannel(opts ...channelOpt) IChannel

type InterpretableReader

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

func NewInterpretableReader

func NewInterpretableReader(r io.Reader) InterpretableReader

func (InterpretableReader) Cancel

func (r InterpretableReader) Cancel()

func (InterpretableReader) Read

func (r InterpretableReader) Read(p []byte) (n int, err error)

type SSHGenerator

type SSHGenerator struct {
	PrivateKey, PublicKey []byte
	PrivateKeyPath        string
}

SSHGenerator ssh key pair generator

func Generate

func Generate(privateKeyPath string) (*SSHGenerator, error)

Generate generate SSHGenerator

func NewSSHGenerator

func NewSSHGenerator(privateKey string, publicKey string, privateKeyPath string) *SSHGenerator

NewSSHGenerator create ssh generator

type SocksLogger

type SocksLogger struct{}

func (SocksLogger) Println

func (s SocksLogger) Println(v ...any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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