Documentation
¶
Index ¶
- type Options
- type Response
- type SSH
- func (o *SSH) BenchRunCmd(connectionInfo model.ConnectionInfo, types []string) ([]model.Benchmark, error)
- func (o *SSH) CheckKubernetes(connectionInfo model.ConnectionInfo) (bool, error)
- func (o *SSH) Close()
- func (o *SSH) NewClientConn(connectionInfo model.ConnectionInfo) error
- func (o *SSH) ProbeFromHost(connectionInfo model.ConnectionInfo, rawURL string, timeout time.Duration) error
- func (o *SSH) RunAgent(connectionInfo model.ConnectionInfo) error
- func (o *SSH) RunBenchmark(connectionInfo model.ConnectionInfo, types string) (string, error)
- func (o *SSH) RunCmd(cmd string) (string, error)
- func (o *SSH) RunCmdWithTimeout(cmd string, timeout time.Duration) (string, error)
- func (o *SSH) SendGetRequestToAgent(connectionInfo model.ConnectionInfo, requestPath string) (string, error)
- func (o *SSH) SendPostRequestToAgent(connectionInfo model.ConnectionInfo, requestPath string, body []byte) (int, string, error)
- func (o *SSH) StopBenchmark(connectionInfo model.ConnectionInfo) error
- func (o *SSH) UninstallAgent(connectionInfo model.ConnectionInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 (*SSH) CheckKubernetes ¶
func (o *SSH) CheckKubernetes(connectionInfo model.ConnectionInfo) (bool, error)
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) RunBenchmark ¶
func (*SSH) RunCmdWithTimeout ¶
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 (*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.