diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df57e397..ed72f751 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: - name: Run integration tests in test container run: | - docker run --rm --entrypoint "go test -tags=integration ./internal/restrictednet" test-container + docker run --rm --entrypoint go test-container test -tags=integration ./internal/restrictednet - name: Verify dev cross platform compatibility run: docker build --target xcompile . diff --git a/internal/restrictednet/client.go b/internal/restrictednet/client.go index 6b355f34..04055758 100644 --- a/internal/restrictednet/client.go +++ b/internal/restrictednet/client.go @@ -62,6 +62,8 @@ func (c *Client) OpenHTTPSByHostname(ctx context.Context, hostname string) ( portUint, err := strconv.ParseUint(portStr, 10, 16) if err != nil { return nil, nil, fmt.Errorf("parsing port: %w", err) + } else if portUint == 0 { + return nil, nil, errors.New("destination port cannot be 0") } port := uint16(portUint) diff --git a/internal/restrictednet/helpers_test.go b/internal/restrictednet/helpers_test.go index 54070c32..091aefd1 100644 --- a/internal/restrictednet/helpers_test.go +++ b/internal/restrictednet/helpers_test.go @@ -1,3 +1,5 @@ +//go:build integration + package restrictednet func ptrTo[T any](value T) *T { diff --git a/internal/restrictednet/https.go b/internal/restrictednet/https.go index 10def5c6..209b5a9f 100644 --- a/internal/restrictednet/https.go +++ b/internal/restrictednet/https.go @@ -73,7 +73,6 @@ func newHTTPSClient(destinationTLSName string, dial dialFunc) *http.Client { MaxIdleConns: 1, MaxIdleConnsPerHost: 1, MaxConnsPerHost: 1, - IdleConnTimeout: time.Second, TLSClientConfig: &tls.Config{ MinVersion: tls.VersionTLS12, ServerName: destinationTLSName, diff --git a/internal/restrictednet/https_test.go b/internal/restrictednet/https_integration_test.go similarity index 100% rename from internal/restrictednet/https_test.go rename to internal/restrictednet/https_integration_test.go diff --git a/internal/restrictednet/resolve_test.go b/internal/restrictednet/resolve_integration_test.go similarity index 100% rename from internal/restrictednet/resolve_test.go rename to internal/restrictednet/resolve_integration_test.go