mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-13 03:49:35 +03:00
Add cipherSuites setting for TLS & XTLS (#78)
This commit is contained in:
@ -185,11 +185,12 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
|
||||
}
|
||||
|
||||
config := &tls.Config{
|
||||
ClientSessionCache: globalSessionCache,
|
||||
RootCAs: root,
|
||||
InsecureSkipVerify: c.AllowInsecure,
|
||||
NextProtos: c.NextProtocol,
|
||||
SessionTicketsDisabled: c.DisableSessionResumption,
|
||||
ClientSessionCache: globalSessionCache,
|
||||
RootCAs: root,
|
||||
InsecureSkipVerify: c.AllowInsecure,
|
||||
NextProtos: c.NextProtocol,
|
||||
SessionTicketsDisabled: c.DisableSessionResumption,
|
||||
PreferServerCipherSuites: c.PreferServerCipherSuites,
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
@ -223,6 +224,22 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
|
||||
config.NextProtos = []string{"h2", "http/1.1"}
|
||||
}
|
||||
|
||||
var cipherSuites []uint16
|
||||
if c.PreferServerCipherSuites && len(c.CipherSuites) > 0 {
|
||||
cipherSuitesArray := strings.Split(c.CipherSuites, ":")
|
||||
if len(cipherSuitesArray) > 0 {
|
||||
all := tls.CipherSuites()
|
||||
for _, suite := range cipherSuitesArray {
|
||||
for _, s := range all {
|
||||
if s.Name == suite {
|
||||
cipherSuites = append(cipherSuites, s.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
config.CipherSuites = cipherSuites
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user