Browse Source

Fix Inproxy tests after merge 8385f32

* Fixes missing argument in inproxy_test
* Initializes TLS cache for inproxy and makeFrontedHTTPClient
Amir Khan 1 year ago
parent
commit
6b98cf8454
3 changed files with 9 additions and 3 deletions
  1. 6 3
      psiphon/common/inproxy/inproxy_test.go
  2. 2 0
      psiphon/inproxy.go
  3. 1 0
      psiphon/net.go

+ 6 - 3
psiphon/common/inproxy/inproxy_test.go

@@ -24,7 +24,7 @@ package inproxy
 import (
 	"bytes"
 	"context"
-	"crypto/tls"
+	std_tls "crypto/tls"
 	"encoding/base64"
 	"fmt"
 	"io"
@@ -39,6 +39,7 @@ import (
 	"testing"
 	"time"
 
+	tls "github.com/Psiphon-Labs/psiphon-tls"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/prng"
@@ -511,7 +512,9 @@ func runTestInproxy() error {
 					dialCtx,
 					conn,
 					&net.UDPAddr{Port: 1}, // This address is ignored, but the zero value is not allowed
-					"test", "QUICv1", nil, quicEchoServer.ObfuscationKey(), nil, nil, true)
+					"test", "QUICv1", nil, quicEchoServer.ObfuscationKey(), nil, nil, true,
+					false, false, common.WrapClientSessionCache(tls.NewLRUClientSessionCache(0), ""),
+				)
 				if err != nil {
 					return errors.Trace(err)
 				}
@@ -852,7 +855,7 @@ func newHTTPRoundTripper(endpointAddr string, path string) *httpRoundTripper {
 				MaxIdleConns:        2,
 				IdleConnTimeout:     1 * time.Minute,
 				TLSHandshakeTimeout: 10 * time.Second,
-				TLSClientConfig: &tls.Config{
+				TLSClientConfig: &std_tls.Config{
 					InsecureSkipVerify: true,
 				},
 			},

+ 2 - 0
psiphon/inproxy.go

@@ -43,6 +43,7 @@ import (
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/prng"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/protocol"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/resolver"
+	utls "github.com/Psiphon-Labs/utls"
 	"github.com/cespare/xxhash"
 	"golang.org/x/net/bpf"
 )
@@ -1034,6 +1035,7 @@ func (brokerDialParams *InproxyBrokerDialParameters) prepareDialConfigs(
 		TransformedHostName:      brokerDialParams.TransformedHostName,
 		NetworkLatencyMultiplier: brokerDialParams.NetworkLatencyMultiplier,
 		AdditionalHeaders:        config.MeekAdditionalHeaders,
+		TLSClientSessionCache:    common.WrapUtlsClientSessionCache(utls.NewLRUClientSessionCache(0), brokerDialParams.DialAddress),
 	}
 
 	switch brokerDialParams.BrokerTransport {

+ 1 - 0
psiphon/net.go

@@ -525,6 +525,7 @@ func makeFrontedHTTPClient(
 		TransformedHostName:      meekTransformedHostName,
 		ClientTunnelProtocol:     effectiveTunnelProtocol,
 		NetworkLatencyMultiplier: networkLatencyMultiplier,
+		TLSClientSessionCache:    common.WrapUtlsClientSessionCache(utls.NewLRUClientSessionCache(0), meekDialAddress),
 	}
 
 	if !skipVerify {