[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [pluggable-transports/snowflake] 06/13: Add uTLS remove SNI to snowflake client



This is an automated email from the git hooks/post-receive script.

shelikhoo pushed a commit to branch main
in repository pluggable-transports/snowflake.

commit ccfdcab8feb7857a3089f2a88bc2e1e6c52d5865
Author: Shelikhoo <xiaokangwang@xxxxxxxxxxx>
AuthorDate: Fri Feb 11 09:57:37 2022 +0000

    Add uTLS remove SNI to snowflake client
---
 client/lib/rendezvous.go | 6 +++---
 client/lib/snowflake.go  | 3 +++
 client/snowflake.go      | 2 ++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/client/lib/rendezvous.go b/client/lib/rendezvous.go
index 4c7c6f9..7c27dfc 100644
--- a/client/lib/rendezvous.go
+++ b/client/lib/rendezvous.go
@@ -56,13 +56,13 @@ func createBrokerTransport() http.RoundTripper {
 }
 
 func NewBrokerChannel(broker, ampCache, front string, keepLocalAddresses bool) (*BrokerChannel, error) {
-	return NewBrokerChannelWithUTlsClientID(broker, ampCache, front, keepLocalAddresses, "")
+	return NewBrokerChannelWithUTlsClientID(broker, ampCache, front, keepLocalAddresses, "", false)
 }
 
 // NewBrokerChannelWithUTlsClientID construct a new BrokerChannel, where:
 // |broker| is the full URL of the facilitating program which assigns proxies
 // to clients, and |front| is the option fronting domain.
-func NewBrokerChannelWithUTlsClientID(broker, ampCache, front string, keepLocalAddresses bool, utlsClientID string) (*BrokerChannel, error) {
+func NewBrokerChannelWithUTlsClientID(broker, ampCache, front string, keepLocalAddresses bool, utlsClientID string, removeSNI bool) (*BrokerChannel, error) {
 	log.Println("Rendezvous using Broker at:", broker)
 	if ampCache != "" {
 		log.Println("Through AMP cache at:", ampCache)
@@ -79,7 +79,7 @@ func NewBrokerChannelWithUTlsClientID(broker, ampCache, front string, keepLocalA
 			return nil, fmt.Errorf("unable to create broker channel: %v", err)
 		}
 		config := &utls.Config{}
-		brokerTransport = utlsutil.NewUTLSHTTPRoundTripper(utlsClientHelloID, config, brokerTransport, false)
+		brokerTransport = utlsutil.NewUTLSHTTPRoundTripper(utlsClientHelloID, config, brokerTransport, removeSNI)
 	}
 
 	var rendezvous RendezvousMethod
diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go
index 19442d8..510567e 100644
--- a/client/lib/snowflake.go
+++ b/client/lib/snowflake.go
@@ -100,6 +100,9 @@ type ClientConfig struct {
 	// UTlsClientID is the type of user application that snowflake should imitate.
 	// If an empty value is provided, it will use Go's default TLS implementation
 	UTlsClientID string
+	// UTlsRemoveSNI is the flag to control whether SNI should be removed from Client Hello
+	// when uTLS is used.
+	UTlsRemoveSNI bool
 }
 
 // NewSnowflakeClient creates a new Snowflake transport client that can spawn multiple
diff --git a/client/snowflake.go b/client/snowflake.go
index addedb9..a693ca6 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -127,6 +127,7 @@ func main() {
 	ampCacheURL := flag.String("ampcache", "", "URL of AMP cache to use as a proxy for signaling")
 	logFilename := flag.String("log", "", "name of log file")
 	utlsClientHelloID := flag.String("utls-imitate", "", "type of TLS client to imitate with utls")
+	utlsRemoveSNI := flag.Bool("utls-nosni", false, "remove SNI from client hello(ignored if uTLS is not used)")
 	logToStateDir := flag.Bool("log-to-state-dir", false, "resolve the log file relative to tor's pt state dir")
 	keepLocalAddresses := flag.Bool("keep-local-addresses", false, "keep local LAN address ICE candidates")
 	unsafeLogging := flag.Bool("unsafe-logging", false, "prevent logs from being scrubbed")
@@ -180,6 +181,7 @@ func main() {
 		KeepLocalAddresses: *keepLocalAddresses || *oldKeepLocalAddresses,
 		Max:                *max,
 		UTlsClientID:       *utlsClientHelloID,
+		UTlsRemoveSNI:      *utlsRemoveSNI,
 	}
 
 	// Begin goptlib client process.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits