Add minVersion setting for TLS & XTLS (#77)

This commit is contained in:
eMeab 2020-12-16 13:20:24 +08:00 committed by GitHub
parent 45f44c401a
commit dab978749c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 150 additions and 96 deletions

View file

@ -294,6 +294,7 @@ type TLSConfig struct {
ALPN *StringList `json:"alpn"`
DisableSessionResumption bool `json:"disableSessionResumption"`
DisableSystemRoot bool `json:"disableSystemRoot"`
MinVersion string `json:"minVersion"`
}
// Build implements Buildable.
@ -308,6 +309,7 @@ func (c *TLSConfig) Build() (proto.Message, error) {
config.Certificate[idx] = cert
}
serverName := c.ServerName
config.MinVersion = c.MinVersion
config.AllowInsecure = c.Insecure
config.AllowInsecureCiphers = c.InsecureCiphers
if len(c.ServerName) > 0 {
@ -369,6 +371,7 @@ type XTLSConfig struct {
ALPN *StringList `json:"alpn"`
DisableSessionResumption bool `json:"disableSessionResumption"`
DisableSystemRoot bool `json:"disableSystemRoot"`
MinVersion string `json:"minVersion"`
}
// Build implements Buildable.
@ -391,6 +394,7 @@ func (c *XTLSConfig) Build() (proto.Message, error) {
if c.ALPN != nil && len(*c.ALPN) > 0 {
config.NextProtocol = []string(*c.ALPN)
}
config.MinVersion = c.MinVersion
config.DisableSessionResumption = c.DisableSessionResumption
config.DisableSystemRoot = c.DisableSystemRoot
return config, nil