Przeglądaj źródła

Added comment on rational for fixes session keys

Amir Khan 1 rok temu
rodzic
commit
deb7740b2a
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10 0
      psiphon/dialParameters.go

+ 10 - 0
psiphon/dialParameters.go

@@ -690,6 +690,11 @@ func MakeDialParameters(
 		if err != nil {
 		if err != nil {
 			return nil, errors.Trace(err)
 			return nil, errors.Trace(err)
 		}
 		}
+		// Rationale for using fixed <ip>:<port> as the session key:
+		// The usual session key is the dialed domain or SNI, but those may vary between dials;
+		// for direct protocols, that fixed key always exactly maps to that TLS server;
+		// and for fronted protocols, we're assuming that a fronted domain dial typically
+		// ends up at the same CDN edge TLS server.
 		sessionKey := net.JoinHostPort(serverEntry.IpAddress, strconv.Itoa(dialPortNumber))
 		sessionKey := net.JoinHostPort(serverEntry.IpAddress, strconv.Itoa(dialPortNumber))
 		dialParams.tlsClientSessionCache = common.WrapUtlsClientSessionCache(tlsClientSessionCache, sessionKey)
 		dialParams.tlsClientSessionCache = common.WrapUtlsClientSessionCache(tlsClientSessionCache, sessionKey)
 
 
@@ -831,6 +836,11 @@ func MakeDialParameters(
 		if err != nil {
 		if err != nil {
 			return nil, errors.Trace(err)
 			return nil, errors.Trace(err)
 		}
 		}
+		// Rationale for using fixed <ip>:<port> as the session key:
+		// The usual session key is the dialed domain or SNI, but those may vary between dials;
+		// for direct protocols, that fixed key always exactly maps to that QUIC server;
+		// and for fronted protocols, we're assuming that a fronted domain dial typically
+		// ends up at the same CDN edge QUIC server.
 		sessionKey := net.JoinHostPort(serverEntry.IpAddress, strconv.Itoa(dialPortNumber))
 		sessionKey := net.JoinHostPort(serverEntry.IpAddress, strconv.Itoa(dialPortNumber))
 		dialParams.quicTLSClientSessionCache = common.WrapClientSessionCache(
 		dialParams.quicTLSClientSessionCache = common.WrapClientSessionCache(
 			quicTLSClientSessionCache,
 			quicTLSClientSessionCache,