初步实现HTTP3

This commit is contained in:
GoEdgeLab
2023-06-01 17:48:01 +08:00
parent 5513350da3
commit b2b03adbbb
11 changed files with 1763 additions and 991 deletions

View File

@@ -463,3 +463,13 @@ func (this *ServerConfig) ShouldCheckTrafficLimit() bool {
func (this *ServerConfig) PlanId() int64 {
return this.planId
}
// SupportsHTTP3 是否支持HTTP/3
func (this *ServerConfig) SupportsHTTP3() bool {
return this.isOk &&
this.HTTPS != nil &&
this.HTTPS.IsOn &&
this.HTTPS.SSLPolicy != nil &&
this.HTTPS.SSLPolicy.IsOn &&
this.HTTPS.SSLPolicy.HTTP3Enabled
}

View File

@@ -32,7 +32,8 @@ type SSLPolicy struct {
CipherSuites []TLSCipherSuite `yaml:"cipherSuites" json:"cipherSuites"` // 加密算法套件
HSTS *HSTSConfig `yaml:"hsts" json:"hsts"` // HSTS配置
HTTP2Enabled bool `yaml:"http2Enabled" json:"http2Enabled"` // 是否启用HTTP2
HTTP2Enabled bool `yaml:"http2Enabled" json:"http2Enabled"` // 是否启用HTTP/2
HTTP3Enabled bool `yaml:"http3Enabled" json:"http3Enabled"` // 是否启用HTTP/3
OCSPIsOn bool `yaml:"ocspIsOn" json:"ocspIsOn"` // 是否启用OCSP
@@ -110,7 +111,7 @@ func (this *SSLPolicy) Init(ctx context.Context) error {
cipherSuites = nil
}
nextProto := []string{}
var nextProto = []string{}
if this.HTTP2Enabled {
nextProto = []string{http2.NextProtoTLS}
}