Documentation ¶
Index ¶
- Constants
- Variables
- func ChannelWithAuth(username, password string) channelOpt
- func ChannelWithPrivateKey(privateKey string) channelOpt
- func ChannelWithRemoteSSH(sshAddress string) channelOpt
- func CleanRsaKeys()
- func PrivateKeyPath(name string) string
- func WritePrivateKey(privateKeyPath string, data []byte) error
- type IChannel
- type InterpretableReader
- type SSHGenerator
- type SocksLogger
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 WritePrivateKey ¶
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()
type SSHGenerator ¶
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)
Click to show internal directories.
Click to hide internal directories.