Просмотр исходного кода

Fix SSHClientVersionPicker changes

- Add clarifying comments
- Revert "meekTransformedHostName" notice
  field back to bool (wasn't necessary to
  have changed it)
- Enable psiphond logging of "ssh_client_version"
- Fix userAgent_test to work with new
  notice output
Rod Hynes 9 лет назад
Родитель
Сommit
053adf6078
5 измененных файлов с 9 добавлено и 9 удалено
  1. 2 5
      psiphon/notice.go
  2. 1 0
      psiphon/server/api.go
  3. 1 0
      psiphon/serverApi.go
  4. 2 0
      psiphon/tunnel.go
  5. 3 4
      psiphon/userAgent_test.go

+ 2 - 5
psiphon/notice.go

@@ -203,12 +203,9 @@ func noticeServerDialStats(noticeType, ipAddress, region, protocol string, tunne
 		args = append(args, "meekHostHeader", tunnelDialStats.MeekHostHeader)
 	}
 
+	// MeekTransformedHostName is meaningful when meek is used, which is when MeekDialAddress != ""
 	if tunnelDialStats.MeekDialAddress != "" {
-		transformedHostName := "0"
-		if tunnelDialStats.MeekTransformedHostName {
-			transformedHostName = "1"
-		}
-		args = append(args, "meekTransformedHostName", transformedHostName)
+		args = append(args, "meekTransformedHostName", tunnelDialStats.MeekTransformedHostName)
 	}
 
 	if tunnelDialStats.SelectedUserAgent {

+ 1 - 0
psiphon/server/api.go

@@ -517,6 +517,7 @@ var baseRequestParams = []requestParamSpec{
 	requestParamSpec{"relay_protocol", isRelayProtocol, 0},
 	requestParamSpec{"tunnel_whole_device", isBooleanFlag, requestParamOptional},
 	requestParamSpec{"device_region", isRegionCode, requestParamOptional},
+	requestParamSpec{"ssh_client_version", isAnyString, requestParamOptional},
 	requestParamSpec{"upstream_proxy_type", isUpstreamProxyType, requestParamOptional},
 	requestParamSpec{"upstream_proxy_custom_header_names", isAnyString, requestParamOptional | requestParamArray},
 	requestParamSpec{"meek_dial_address", isDialAddress, requestParamOptional},

+ 1 - 0
psiphon/serverApi.go

@@ -854,6 +854,7 @@ func (serverContext *ServerContext) getBaseParams() requestJSONObject {
 		params["meek_host_header"] = tunnel.dialStats.MeekHostHeader
 	}
 
+	// MeekTransformedHostName is meaningful when meek is used, which is when MeekDialAddress != ""
 	if tunnel.dialStats.MeekDialAddress != "" {
 		transformedHostName := "0"
 		if tunnel.dialStats.MeekTransformedHostName {

+ 2 - 0
psiphon/tunnel.go

@@ -600,6 +600,8 @@ func dialSsh(
 	// The meek protocols tunnel obfuscated SSH. Obfuscated SSH is layered on top of SSH.
 	// So depending on which protocol is used, multiple layers are initialized.
 
+	// Note: when SSHClientVersion is "", a default is supplied by the ssh package:
+	// https://godoc.org/golang.org/x/crypto/ssh#ClientConfig
 	var selectedSSHClientVersion bool
 	SSHClientVersion := ""
 	useObfuscatedSsh := false

+ 3 - 4
psiphon/userAgent_test.go

@@ -214,10 +214,9 @@ func attemptConnectionsWithUserAgent(
 				return
 			}
 			if noticeType == "ConnectingServer" {
-				selectedUserAgent := payload["selectedUserAgent"].(bool)
-				userAgent := payload["userAgent"].(string)
-				if selectedUserAgent {
-					countNoticeUserAgent(userAgent)
+				userAgent, ok := payload["userAgent"]
+				if ok {
+					countNoticeUserAgent(userAgent.(string))
 				}
 			}
 		}))