ssh

package
v0.0.0-...-e06c804 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

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

type Response

type Response struct {
	StatusCode string              `json:"status_code"`
	Type       string              `json:"type"`
	Data       model.BenchmarkData `json:"data"`
}

type SSH

type SSH struct {
	ConnectionInfo *model.ConnectionInfo
	Options        Options
}

func (*SSH) BenchRunCmd

func (o *SSH) BenchRunCmd(connectionInfo model.ConnectionInfo, types []string) ([]model.Benchmark, error)

func (*SSH) CheckKubernetes

func (o *SSH) CheckKubernetes(connectionInfo model.ConnectionInfo) (bool, error)

func (*SSH) Close

func (o *SSH) Close()

func (*SSH) NewClientConn

func (o *SSH) NewClientConn(connectionInfo model.ConnectionInfo) error

func (*SSH) ProbeFromHost

func (o *SSH) ProbeFromHost(connectionInfo model.ConnectionInfo, rawURL string, timeout time.Duration) error

ProbeFromHost reports whether the source host can open a TCP connection to the host:port in rawURL. It runs curl on the source host, so it sees what the agent sees when it inspects a tunnelled database or bucket.

Success is "the TCP handshake completed" (%{time_connect} > 0), the same bar the direct path's net.DialTimeout sets. curl's exit code is not the verdict: a telnet:// probe of a DBMS ends on --max-time (28) even after a successful connect, and an https:// probe can fail TLS verification (60) against a server that is plainly reachable. The code only explains a failure.

func (*SSH) RunAgent

func (o *SSH) RunAgent(connectionInfo model.ConnectionInfo) error

func (*SSH) RunBenchmark

func (o *SSH) RunBenchmark(connectionInfo model.ConnectionInfo, types string) (string, error)

func (*SSH) RunCmd

func (o *SSH) RunCmd(cmd string) (string, error)

RunCmd to SSH Server

func (*SSH) RunCmdWithTimeout

func (o *SSH) RunCmdWithTimeout(cmd string, timeout time.Duration) (string, error)

RunCmdWithTimeout runs cmd and gives up after timeout, closing the session so the caller is not blocked forever by a remote command that never returns. A timeout of zero or less waits indefinitely, like RunCmd.

func (*SSH) SendGetRequestToAgent

func (o *SSH) SendGetRequestToAgent(connectionInfo model.ConnectionInfo, requestPath string) (string, error)

func (*SSH) SendPostRequestToAgent

func (o *SSH) SendPostRequestToAgent(connectionInfo model.ConnectionInfo, requestPath string, body []byte) (int, string, error)

SendPostRequestToAgent POSTs body to the agent and returns the HTTP status code with the response body. The body travels on the SSH session's stdin and never on the command line, so credentials inside it do not show up in the remote host's process list, the agent's access log or this server's DEBUG log. The status code is returned as is: deciding what counts as a failure, and how to read an error body, is up to the caller.

func (*SSH) StopBenchmark

func (o *SSH) StopBenchmark(connectionInfo model.ConnectionInfo) error

func (*SSH) UninstallAgent

func (o *SSH) UninstallAgent(connectionInfo model.ConnectionInfo) error

UninstallAgent removes cm-honeybee-agent from the connection's host by running uninstallAgent.sh over SSH (inverse of RunAgent). No busybox is needed — the script only uses systemctl/rm already present on the host.

Jump to

Keyboard shortcuts

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