(t *testing.T, addr string, config *gossh.ClientConfig)
| 38 | } |
| 39 | |
| 40 | func newClientSession(t *testing.T, addr string, config *gossh.ClientConfig) (*gossh.Session, *gossh.Client, func()) { |
| 41 | if config == nil { |
| 42 | config = &gossh.ClientConfig{ |
| 43 | User: "testuser", |
| 44 | Auth: []gossh.AuthMethod{ |
| 45 | gossh.Password("testpass"), |
| 46 | }, |
| 47 | } |
| 48 | } |
| 49 | if config.HostKeyCallback == nil { |
| 50 | config.HostKeyCallback = gossh.InsecureIgnoreHostKey() |
| 51 | } |
| 52 | client, err := gossh.Dial("tcp", addr, config) |
| 53 | if err != nil { |
| 54 | t.Fatal(err) |
| 55 | } |
| 56 | session, err := client.NewSession() |
| 57 | if err != nil { |
| 58 | t.Fatal(err) |
| 59 | } |
| 60 | return session, client, func() { |
| 61 | session.Close() |
| 62 | client.Close() |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func newTestSession(t *testing.T, srv *Server, cfg *gossh.ClientConfig) (*gossh.Session, *gossh.Client, func()) { |
| 67 | l := newLocalListener() |
no test coverage detected
searching dependent graphs…