|
@@ -20,8 +20,6 @@
|
|
|
package common
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
- "fmt"
|
|
|
|
|
-
|
|
|
|
|
tls "github.com/Psiphon-Labs/psiphon-tls"
|
|
tls "github.com/Psiphon-Labs/psiphon-tls"
|
|
|
utls "github.com/refraction-networking/utls"
|
|
utls "github.com/refraction-networking/utls"
|
|
|
)
|
|
)
|
|
@@ -32,7 +30,7 @@ import (
|
|
|
type TLSClientSessionCacheWrapper struct {
|
|
type TLSClientSessionCacheWrapper struct {
|
|
|
tls.ClientSessionCache
|
|
tls.ClientSessionCache
|
|
|
|
|
|
|
|
- // sessinoKey specifies the value of the hard-coded TLS session cache key.
|
|
|
|
|
|
|
+ // sessionKey specifies the value of the hard-coded TLS session cache key.
|
|
|
sessionKey string
|
|
sessionKey string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -40,12 +38,12 @@ type TLSClientSessionCacheWrapper struct {
|
|
|
// derived from the ipAddress and dialPortNumber.
|
|
// derived from the ipAddress and dialPortNumber.
|
|
|
func WrapClientSessionCache(
|
|
func WrapClientSessionCache(
|
|
|
cache tls.ClientSessionCache,
|
|
cache tls.ClientSessionCache,
|
|
|
- ipAddress string,
|
|
|
|
|
- dialPortNumber int) *TLSClientSessionCacheWrapper {
|
|
|
|
|
|
|
+ hardCodedSessionKey string,
|
|
|
|
|
+) *TLSClientSessionCacheWrapper {
|
|
|
|
|
|
|
|
return &TLSClientSessionCacheWrapper{
|
|
return &TLSClientSessionCacheWrapper{
|
|
|
ClientSessionCache: cache,
|
|
ClientSessionCache: cache,
|
|
|
- sessionKey: sessionKey(ipAddress, dialPortNumber),
|
|
|
|
|
|
|
+ sessionKey: hardCodedSessionKey,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -81,12 +79,12 @@ type UtlsClientSessionCacheWrapper struct {
|
|
|
// derived from the ipAddress and dialPortNumber.
|
|
// derived from the ipAddress and dialPortNumber.
|
|
|
func WrapUtlsClientSessionCache(
|
|
func WrapUtlsClientSessionCache(
|
|
|
cache utls.ClientSessionCache,
|
|
cache utls.ClientSessionCache,
|
|
|
- ipAddress string,
|
|
|
|
|
- dialPortNumber int) *UtlsClientSessionCacheWrapper {
|
|
|
|
|
|
|
+ hardCodedSessionKey string,
|
|
|
|
|
+) *UtlsClientSessionCacheWrapper {
|
|
|
|
|
|
|
|
return &UtlsClientSessionCacheWrapper{
|
|
return &UtlsClientSessionCacheWrapper{
|
|
|
ClientSessionCache: cache,
|
|
ClientSessionCache: cache,
|
|
|
- sessionKey: sessionKey(ipAddress, dialPortNumber),
|
|
|
|
|
|
|
+ sessionKey: hardCodedSessionKey,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -107,7 +105,3 @@ func (c *UtlsClientSessionCacheWrapper) IsSessionResumptionAvailable() bool {
|
|
|
func (c *UtlsClientSessionCacheWrapper) RemoveCacheEntry() {
|
|
func (c *UtlsClientSessionCacheWrapper) RemoveCacheEntry() {
|
|
|
c.ClientSessionCache.Put(c.sessionKey, nil)
|
|
c.ClientSessionCache.Put(c.sessionKey, nil)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-func sessionKey(ipAddress string, dialPortNumber int) string {
|
|
|
|
|
- return fmt.Sprintf("%s:%d", ipAddress, dialPortNumber)
|
|
|
|
|
-}
|
|
|