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

Add server diagnosticID to server-oriented handshake notices

Rod Hynes 5 лет назад
Родитель
Сommit
70ab9a349a
2 измененных файлов с 15 добавлено и 6 удалено
  1. 8 3
      psiphon/notice.go
  2. 7 3
      psiphon/serverApi.go

+ 8 - 3
psiphon/notice.go

@@ -779,15 +779,16 @@ func NoticeSLOKSeeded(slokID string, duplicate bool) {
 }
 
 // NoticeServerTimestamp reports server side timestamp as seen in the handshake.
-func NoticeServerTimestamp(timestamp string) {
+func NoticeServerTimestamp(diagnosticID string, timestamp string) {
 	singletonNoticeLogger.outputNotice(
 		"ServerTimestamp", 0,
+		"diagnosticID", diagnosticID,
 		"timestamp", timestamp)
 }
 
 // NoticeActiveAuthorizationIDs reports the authorizations the server has accepted.
 // Each ID is a base64-encoded accesscontrol.Authorization.ID value.
-func NoticeActiveAuthorizationIDs(activeAuthorizationIDs []string) {
+func NoticeActiveAuthorizationIDs(diagnosticID string, activeAuthorizationIDs []string) {
 
 	// Never emit 'null' instead of empty list
 	if activeAuthorizationIDs == nil {
@@ -796,6 +797,7 @@ func NoticeActiveAuthorizationIDs(activeAuthorizationIDs []string) {
 
 	singletonNoticeLogger.outputNotice(
 		"ActiveAuthorizationIDs", 0,
+		"diagnosticID", diagnosticID,
 		"IDs", activeAuthorizationIDs)
 }
 
@@ -806,9 +808,12 @@ func NoticeActiveAuthorizationIDs(activeAuthorizationIDs []string) {
 //
 // Limitation: any rate limit changes during the lifetime of the tunnel are
 // not reported.
-func NoticeTrafficRateLimits(upstreamBytesPerSecond, downstreamBytesPerSecond int64) {
+func NoticeTrafficRateLimits(
+	diagnosticID string, upstreamBytesPerSecond, downstreamBytesPerSecond int64) {
+
 	singletonNoticeLogger.outputNotice(
 		"TrafficRateLimits", 0,
+		"diagnosticID", diagnosticID,
 		"upstreamBytesPerSecond", upstreamBytesPerSecond,
 		"downstreamBytesPerSecond", downstreamBytesPerSecond)
 }

+ 7 - 3
psiphon/serverApi.go

@@ -293,13 +293,17 @@ func (serverContext *ServerContext) doHandshakeRequest(
 		}
 	}
 
+	diagnosticID := serverContext.tunnel.dialParams.ServerEntry.GetDiagnosticID()
+
 	serverContext.serverHandshakeTimestamp = handshakeResponse.ServerTimestamp
-	NoticeServerTimestamp(serverContext.serverHandshakeTimestamp)
+	NoticeServerTimestamp(diagnosticID, serverContext.serverHandshakeTimestamp)
 
-	NoticeActiveAuthorizationIDs(handshakeResponse.ActiveAuthorizationIDs)
+	NoticeActiveAuthorizationIDs(diagnosticID, handshakeResponse.ActiveAuthorizationIDs)
 
 	NoticeTrafficRateLimits(
-		handshakeResponse.UpstreamBytesPerSecond, handshakeResponse.DownstreamBytesPerSecond)
+		diagnosticID,
+		handshakeResponse.UpstreamBytesPerSecond,
+		handshakeResponse.DownstreamBytesPerSecond)
 
 	if doTactics && handshakeResponse.TacticsPayload != nil &&
 		networkID == serverContext.tunnel.config.GetNetworkID() {