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

[tor-commits] [pluggable-transports/snowflake] 10/13: Harmonize identifiers to uTLS



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 8d5998b7441eb9e213b8d86052e94a27d7656495
Author: Shelikhoo <xiaokangwang@xxxxxxxxxxx>
AuthorDate: Fri Feb 11 11:26:41 2022 +0000

    Harmonize identifiers to uTLS
---
 client/lib/rendezvous.go       | 12 ++++++------
 client/lib/snowflake.go        | 12 ++++++------
 client/snowflake.go            |  8 ++++----
 common/utls/client_hello_id.go |  2 +-
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/client/lib/rendezvous.go b/client/lib/rendezvous.go
index dcf613c..1fc2a69 100644
--- a/client/lib/rendezvous.go
+++ b/client/lib/rendezvous.go
@@ -56,14 +56,14 @@ func createBrokerTransport() http.RoundTripper {
 }
 
 func NewBrokerChannel(broker, ampCache, front string, keepLocalAddresses bool) (*BrokerChannel, error) {
-	return NewBrokerChannelWithUTlsSettings(broker, ampCache, front, keepLocalAddresses, "", false)
+	return NewBrokerChannelWithUTLSSettings(broker, ampCache, front, keepLocalAddresses, "", false)
 }
 
-// NewBrokerChannelWithUTlsSettings construct a new BrokerChannel, where:
+// NewBrokerChannelWithUTLSSettings 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 NewBrokerChannelWithUTlsSettings(broker, ampCache, front string, keepLocalAddresses bool,
-	utlsClientID string, removeSNI bool) (*BrokerChannel, error) {
+func NewBrokerChannelWithUTLSSettings(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)
@@ -74,8 +74,8 @@ func NewBrokerChannelWithUTlsSettings(broker, ampCache, front string, keepLocalA
 
 	brokerTransport := createBrokerTransport()
 
-	if utlsClientID != "" {
-		utlsClientHelloID, err := utlsutil.NameToUTlsID(utlsClientID)
+	if uTLSClientID != "" {
+		utlsClientHelloID, err := utlsutil.NameToUTLSID(uTLSClientID)
 		if err != nil {
 			return nil, fmt.Errorf("unable to create broker channel: %v", err)
 		}
diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go
index e309b44..1c6c381 100644
--- a/client/lib/snowflake.go
+++ b/client/lib/snowflake.go
@@ -97,12 +97,12 @@ type ClientConfig struct {
 	// Max is the maximum number of snowflake proxy peers that the client should attempt to
 	// connect to. Defaults to 1.
 	Max int
-	// UTlsClientID is the type of user application that snowflake should imitate.
+	// 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
+	UTLSClientID string
+	// UTLSRemoveSNI is the flag to control whether SNI should be removed from Client Hello
 	// when uTLS is used.
-	UTlsRemoveSNI bool
+	UTLSRemoveSNI bool
 }
 
 // NewSnowflakeClient creates a new Snowflake transport client that can spawn multiple
@@ -131,9 +131,9 @@ func NewSnowflakeClient(config ClientConfig) (*Transport, error) {
 	}
 
 	// Rendezvous with broker using the given parameters.
-	broker, err := NewBrokerChannelWithUTlsSettings(
+	broker, err := NewBrokerChannelWithUTLSSettings(
 		config.BrokerURL, config.AmpCacheURL, config.FrontDomain,
-		config.KeepLocalAddresses, config.UTlsClientID, config.UTlsRemoveSNI)
+		config.KeepLocalAddresses, config.UTLSClientID, config.UTLSRemoveSNI)
 	if err != nil {
 		return nil, err
 	}
diff --git a/client/snowflake.go b/client/snowflake.go
index a693ca6..76a5cc4 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -126,8 +126,8 @@ func main() {
 	frontDomain := flag.String("front", "", "front domain")
 	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)")
+	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,8 +180,8 @@ func main() {
 		ICEAddresses:       iceAddresses,
 		KeepLocalAddresses: *keepLocalAddresses || *oldKeepLocalAddresses,
 		Max:                *max,
-		UTlsClientID:       *utlsClientHelloID,
-		UTlsRemoveSNI:      *utlsRemoveSNI,
+		UTLSClientID:       *uTLSClientHelloID,
+		UTLSRemoveSNI:      *uTLSRemoveSNI,
 	}
 
 	// Begin goptlib client process.
diff --git a/common/utls/client_hello_id.go b/common/utls/client_hello_id.go
index e423cf3..8a13280 100644
--- a/common/utls/client_hello_id.go
+++ b/common/utls/client_hello_id.go
@@ -29,7 +29,7 @@ var clientHelloIDMap = map[string]utls.ClientHelloID{
 
 var errNameNotFound = errors.New("client hello name is unrecognized")
 
-func NameToUTlsID(name string) (utls.ClientHelloID, error) {
+func NameToUTLSID(name string) (utls.ClientHelloID, error) {
 	normalizedName := strings.ToLower(name)
 	if id, ok := clientHelloIDMap[normalizedName]; ok {
 		return id, nil

-- 
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