MCPcopy Index your code
hub / github.com/coder/coder / sshClient

Function sshClient

agent/agentssh/agentssh_test.go:493–512  ·  view source on GitHub ↗
(t *testing.T, addr string)

Source from the content-addressed store, hash-verified

491}
492
493func sshClient(t *testing.T, addr string) *ssh.Client {
494 conn, err := net.Dial("tcp", addr)
495 require.NoError(t, err)
496 t.Cleanup(func() {
497 _ = conn.Close()
498 })
499
500 sshConn, channels, requests, err := ssh.NewClientConn(conn, "localhost:22", &ssh.ClientConfig{
501 HostKeyCallback: ssh.InsecureIgnoreHostKey(), //nolint:gosec // This is a test.
502 })
503 require.NoError(t, err)
504 t.Cleanup(func() {
505 _ = sshConn.Close()
506 })
507 c := ssh.NewClient(sshConn, channels, requests)
508 t.Cleanup(func() {
509 _ = c.Close()
510 })
511 return c
512}

Callers 6

TestServer_X11Function · 0.85
TestNewServer_SignalFunction · 0.85

Calls 4

CloseMethod · 0.95
DialMethod · 0.65
CleanupMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected