server

package
v0.0.0-...-ec5e93e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "0.2.3"
)

Variables

View Source
var (
	ErrNoAvailable = errors.New("no available gateway")
	ErrGatewayDial = errors.New("gateway dial addr failed")
	ErrSSHClient   = errors.New("new ssh client failed")
)

Functions

func NewServer

func NewServer(c *core.Core) *server

func ParsePrivateKeyFromString

func ParsePrivateKeyFromString(content string) (signer ssh.Signer, err error)

func ParsePrivateKeyWithPassphrase

func ParsePrivateKeyWithPassphrase(privateKey, Passphrase string) (signer ssh.Signer, err error)

func Run

func Run(cfg string, isDaemon bool)

Types

type SSHClient

type SSHClient struct {
	*gossh.Client
	Cfg         *SSHClientOptions
	ProxyClient *SSHClient

	sync.Mutex
	// contains filtered or unexported fields
}

func NewSSHClient

func NewSSHClient(opts ...SSHClientOption) (*SSHClient, error)

func NewSSHClientWithCfg

func NewSSHClientWithCfg(cfg *SSHClientOptions) (*SSHClient, error)

func (*SSHClient) AcquireSession

func (s *SSHClient) AcquireSession() (*gossh.Session, error)

func (*SSHClient) Close

func (s *SSHClient) Close() error

func (*SSHClient) RefCount

func (s *SSHClient) RefCount() int32

func (*SSHClient) ReleaseSession

func (s *SSHClient) ReleaseSession(sess *gossh.Session)

func (*SSHClient) String

func (s *SSHClient) String() string

type SSHClientOption

type SSHClientOption func(conf *SSHClientOptions)

func SSHClientHost

func SSHClientHost(host string) SSHClientOption

func SSHClientKeyboardAuth

func SSHClientKeyboardAuth(keyboardAuth gossh.KeyboardInteractiveChallenge) SSHClientOption

func SSHClientPassphrase

func SSHClientPassphrase(passphrase string) SSHClientOption

func SSHClientPassword

func SSHClientPassword(password string) SSHClientOption

func SSHClientPort

func SSHClientPort(port int) SSHClientOption

func SSHClientPrivateAuth

func SSHClientPrivateAuth(privateAuth gossh.Signer) SSHClientOption

func SSHClientPrivateKey

func SSHClientPrivateKey(privateKey string) SSHClientOption

func SSHClientProxyClient

func SSHClientProxyClient(proxyArgs ...SSHClientOptions) SSHClientOption

func SSHClientTimeout

func SSHClientTimeout(timeout int) SSHClientOption

func SSHClientUsername

func SSHClientUsername(username string) SSHClientOption

type SSHClientOptions

type SSHClientOptions struct {
	Host       string
	Port       string
	Username   string
	Password   string
	PrivateKey string
	Passphrase string
	Timeout    int

	PrivateAuth gossh.Signer
	// contains filtered or unexported fields
}

func (*SSHClientOptions) AuthMethods

func (cfg *SSHClientOptions) AuthMethods() []gossh.AuthMethod

Jump to

Keyboard shortcuts

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