Files
EdgeCommon/pkg/serverconfigs/protocol_https_config.go

37 lines
700 B
Go
Raw Normal View History

2020-09-13 19:27:47 +08:00
package serverconfigs
2020-12-18 21:19:25 +08:00
import (
"encoding/json"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
)
2020-09-13 19:27:47 +08:00
2020-09-30 17:46:33 +08:00
// HTTPS协议配置
2020-09-13 19:27:47 +08:00
type HTTPSProtocolConfig struct {
BaseProtocol `yaml:",inline"`
2020-10-01 16:01:28 +08:00
SSLPolicyRef *sslconfigs.SSLPolicyRef `yaml:"sslPolicyRef" json:"sslPolicyRef"`
SSLPolicy *sslconfigs.SSLPolicy `yaml:"sslPolicy" json:"sslPolicy"`
2020-09-13 19:27:47 +08:00
}
2020-09-30 17:46:33 +08:00
// 初始化
2020-09-13 19:27:47 +08:00
func (this *HTTPSProtocolConfig) Init() error {
err := this.InitBase()
if err != nil {
return err
}
2020-09-30 17:46:33 +08:00
if this.SSLPolicy != nil {
err := this.SSLPolicy.Init()
if err != nil {
return err
}
}
2020-09-13 19:27:47 +08:00
return nil
}
2020-12-18 21:19:25 +08:00
// 转换为JSON
func (this *HTTPSProtocolConfig) AsJSON() ([]byte, error) {
return json.Marshal(this)
}