Browse Source

Refactor: remove single-use function EnableClientSessionCache

Amir Khan 1 year ago
parent
commit
57ca1afa9c
2 changed files with 2 additions and 10 deletions
  1. 2 1
      psiphon/net.go
  2. 0 9
      psiphon/tlsDialer.go

+ 2 - 1
psiphon/net.go

@@ -42,6 +42,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"
 	"golang.org/x/net/bpf"
 )
 
@@ -728,8 +729,8 @@ func MakeUntunneledHTTPClient(
 		SkipVerify:                    skipVerify,
 		DisableSystemRootCAs:          disableSystemRootCAs,
 		TrustedCACertificatesFilename: untunneledDialConfig.TrustedCACertificatesFilename,
+		ClientSessionCache:            utls.NewLRUClientSessionCache(0),
 	}
-	tlsConfig.EnableClientSessionCache()
 
 	tlsDialer := NewCustomTLSDialer(tlsConfig)
 

+ 0 - 9
psiphon/tlsDialer.go

@@ -187,15 +187,6 @@ type CustomTLSConfig struct {
 	ClientSessionCache utls.ClientSessionCache
 }
 
-// EnableClientSessionCache initializes a cache to use to persist session
-// tickets, enabling TLS session resumability across multiple
-// CustomTLSDial calls or dialers using the same CustomTLSConfig.
-func (config *CustomTLSConfig) EnableClientSessionCache() {
-	if config.ClientSessionCache == nil {
-		config.ClientSessionCache = utls.NewLRUClientSessionCache(0)
-	}
-}
-
 // NewCustomTLSDialer creates a new dialer based on CustomTLSDial.
 func NewCustomTLSDialer(config *CustomTLSConfig) common.Dialer {
 	return func(ctx context.Context, network, addr string) (net.Conn, error) {