Browse Source

Merge branch 'master' into quic-enhancements

Rod Hynes 4 years ago
parent
commit
7ed630eb8c
2 changed files with 18 additions and 2 deletions
  1. 4 2
      psiphon/common/obfuscator/history.go
  2. 14 0
      psiphon/notice.go

+ 4 - 2
psiphon/common/obfuscator/history.go

@@ -140,7 +140,9 @@ func (h *SeedHistory) AddNewWithTTL(
 	// an unlikely possibility that this Add and the following Get don't see the
 	// same existing key/value state.
 
-	if h.seedToTime.Add(key, time.Now(), TTL) == nil {
+	now := time.Now()
+
+	if h.seedToTime.Add(key, now, TTL) == nil {
 		// Seed was not already in cache
 		// TODO: if TTL < SeedHistory.ClientIPTTL, use the shorter TTL here
 		h.seedToClientIP.Set(key, clientIP, lrucache.DefaultExpiration)
@@ -150,7 +152,7 @@ func (h *SeedHistory) AddNewWithTTL(
 	previousTime, ok := h.seedToTime.Get(key)
 	if !ok {
 		// Inconsistent Add/Get state: assume cache item just expired.
-		previousTime = h.seedTTL
+		previousTime = now.Add(-h.seedTTL)
 	}
 
 	logFields := common.LogFields{

+ 14 - 0
psiphon/notice.go

@@ -459,6 +459,8 @@ func noticeWithDialParameters(noticeType string, dialParams *DialParameters) {
 
 	if GetEmitNetworkParameters() {
 
+		// Omit appliedTacticsTag as that is emitted in another notice.
+
 		if dialParams.BPFProgramName != "" {
 			args = append(args, "client_bpf", dialParams.BPFProgramName)
 		}
@@ -510,6 +512,18 @@ func noticeWithDialParameters(noticeType string, dialParams *DialParameters) {
 			args = append(args, "TLSVersion", dialParams.GetTLSVersionForMetrics())
 		}
 
+		// dialParams.ServerEntry.Region is emitted above.
+
+		if dialParams.ServerEntry.LocalSource != "" {
+			args = append(args, "serverEntrySource", dialParams.ServerEntry.LocalSource)
+		}
+
+		localServerEntryTimestamp := common.TruncateTimestampToHour(
+			dialParams.ServerEntry.LocalTimestamp)
+		if localServerEntryTimestamp != "" {
+			args = append(args, "serverEntryTimestamp", localServerEntryTimestamp)
+		}
+
 		if dialParams.DialPortNumber != "" {
 			args = append(args, "dialPortNumber", dialParams.DialPortNumber)
 		}