Explorar el Código

Relay client verification required flag from handshake to outer client

Rod Hynes hace 9 años
padre
commit
5d5de5866d
Se han modificado 2 ficheros con 18 adiciones y 7 borrados
  1. 6 0
      psiphon/notice.go
  2. 12 7
      psiphon/serverApi.go

+ 6 - 0
psiphon/notice.go

@@ -201,6 +201,12 @@ func NoticeHomepage(url string) {
 	outputNotice("Homepage", false, false, "url", url)
 }
 
+// NoticeClientVerificationRequired indicates that client verification is required, as
+// indicated bythe handshake. The client should submit a client verification payload.
+func NoticeClientVerificationRequired() {
+	outputNotice("ClientVerificationRequired", false, false)
+}
+
 // NoticeClientRegion is the client's region, as determined by the server and
 // reported to the client in the handshake.
 func NoticeClientRegion(region string) {

+ 12 - 7
psiphon/serverApi.go

@@ -143,13 +143,14 @@ func (serverContext *ServerContext) doHandshakeRequest() error {
 	// - 'preemptive_reconnect_lifetime_milliseconds' is currently unused
 	// - 'ssh_session_id' is ignored; client session ID is used instead
 	var handshakeConfig struct {
-		Homepages            []string            `json:"homepages"`
-		UpgradeClientVersion string              `json:"upgrade_client_version"`
-		PageViewRegexes      []map[string]string `json:"page_view_regexes"`
-		HttpsRequestRegexes  []map[string]string `json:"https_request_regexes"`
-		EncodedServerList    []string            `json:"encoded_server_list"`
-		ClientRegion         string              `json:"client_region"`
-		ServerTimestamp      string              `json:"server_timestamp"`
+		Homepages                  []string            `json:"homepages"`
+		UpgradeClientVersion       string              `json:"upgrade_client_version"`
+		PageViewRegexes            []map[string]string `json:"page_view_regexes"`
+		HttpsRequestRegexes        []map[string]string `json:"https_request_regexes"`
+		EncodedServerList          []string            `json:"encoded_server_list"`
+		ClientRegion               string              `json:"client_region"`
+		ServerTimestamp            string              `json:"server_timestamp"`
+		ClientVerificationRequired bool                `json:"client_verification_required"`
 	}
 	err = json.Unmarshal(configLine, &handshakeConfig)
 	if err != nil {
@@ -215,6 +216,10 @@ func (serverContext *ServerContext) doHandshakeRequest() error {
 
 	serverContext.serverHandshakeTimestamp = handshakeConfig.ServerTimestamp
 
+	if handshakeConfig.ClientVerificationRequired {
+		NoticeClientVerificationRequired()
+	}
+
 	return nil
 }