Improve: add session cache for trojan
This commit is contained in:
parent
55ee8695b3
commit
11b67b19e6
2 changed files with 11 additions and 8 deletions
|
@ -80,6 +80,7 @@ func NewTrojan(option TrojanOption) (*Trojan, error) {
|
||||||
ALPN: option.ALPN,
|
ALPN: option.ALPN,
|
||||||
ServerName: option.Server,
|
ServerName: option.Server,
|
||||||
SkipCertVerify: option.SkipCertVerify,
|
SkipCertVerify: option.SkipCertVerify,
|
||||||
|
ClientSessionCache: getClientSessionCache(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if option.SNI != "" {
|
if option.SNI != "" {
|
||||||
|
|
|
@ -32,6 +32,7 @@ type Option struct {
|
||||||
ALPN []string
|
ALPN []string
|
||||||
ServerName string
|
ServerName string
|
||||||
SkipCertVerify bool
|
SkipCertVerify bool
|
||||||
|
ClientSessionCache tls.ClientSessionCache
|
||||||
}
|
}
|
||||||
|
|
||||||
type Trojan struct {
|
type Trojan struct {
|
||||||
|
@ -50,6 +51,7 @@ func (t *Trojan) StreamConn(conn net.Conn) (net.Conn, error) {
|
||||||
MinVersion: tls.VersionTLS12,
|
MinVersion: tls.VersionTLS12,
|
||||||
InsecureSkipVerify: t.option.SkipCertVerify,
|
InsecureSkipVerify: t.option.SkipCertVerify,
|
||||||
ServerName: t.option.ServerName,
|
ServerName: t.option.ServerName,
|
||||||
|
ClientSessionCache: t.option.ClientSessionCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
tlsConn := tls.Client(conn, tlsConfig)
|
tlsConn := tls.Client(conn, tlsConfig)
|
||||||
|
|
Loading…
Reference in a new issue