(t *testing.T, forwardingEnabled bool)
| 29 | } |
| 30 | |
| 31 | func newTestSessionWithForwarding(t *testing.T, forwardingEnabled bool) (net.Listener, *gossh.Client, func()) { |
| 32 | l := sampleSocketServer() |
| 33 | |
| 34 | _, client, cleanup := newTestSession(t, &Server{ |
| 35 | Handler: func(s Session) {}, |
| 36 | LocalPortForwardingCallback: func(ctx Context, destinationHost string, destinationPort uint32) bool { |
| 37 | addr := net.JoinHostPort(destinationHost, strconv.FormatInt(int64(destinationPort), 10)) |
| 38 | if addr != l.Addr().String() { |
| 39 | panic("unexpected destinationHost: " + addr) |
| 40 | } |
| 41 | return forwardingEnabled |
| 42 | }, |
| 43 | }, nil) |
| 44 | |
| 45 | return l, client, func() { |
| 46 | cleanup() |
| 47 | l.Close() |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | func TestLocalPortForwardingWorks(t *testing.T) { |
| 52 | t.Parallel() |
no test coverage detected
searching dependent graphs…