mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
Add "masterKeyLog" in TLS config (#2758)
* Add "enableMasterKeyLog" in TLS config Turn on the debug option for Wireshark to decrypt traffic * Change to "masterKeyLog" to configure a path
This commit is contained in:
parent
2570855cd7
commit
6f092bd212
5 changed files with 37 additions and 12 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -364,6 +365,15 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
|
|||
|
||||
config.PreferServerCipherSuites = c.PreferServerCipherSuites
|
||||
|
||||
if (len(c.MasterKeyLog) > 0 && c.MasterKeyLog != "none") {
|
||||
writer, err := os.OpenFile(c.MasterKeyLog, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644)
|
||||
if err != nil {
|
||||
newError("failed to open ", c.MasterKeyLog, " as master key log").AtError().Base(err).WriteToLog()
|
||||
} else {
|
||||
config.KeyLogWriter = writer
|
||||
}
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue