mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-01-07 04:25:50 +08:00
智能DNS支持自定义端口
This commit is contained in:
@@ -16,7 +16,7 @@ func NewHTTPSProtocolConfigFromJSON(configJSON []byte) (*HTTPSProtocolConfig, er
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// HTTPS协议配置
|
||||
// HTTPSProtocolConfig HTTPS协议配置
|
||||
type HTTPSProtocolConfig struct {
|
||||
BaseProtocol `yaml:",inline"`
|
||||
|
||||
@@ -24,7 +24,7 @@ type HTTPSProtocolConfig struct {
|
||||
SSLPolicy *sslconfigs.SSLPolicy `yaml:"sslPolicy" json:"sslPolicy"`
|
||||
}
|
||||
|
||||
// 初始化
|
||||
// Init 初始化
|
||||
func (this *HTTPSProtocolConfig) Init() error {
|
||||
err := this.InitBase()
|
||||
if err != nil {
|
||||
@@ -41,7 +41,7 @@ func (this *HTTPSProtocolConfig) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 转换为JSON
|
||||
// AsJSON 转换为JSON
|
||||
func (this *HTTPSProtocolConfig) AsJSON() ([]byte, error) {
|
||||
return json.Marshal(this)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func (this *TCPProtocolConfig) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 转换为JSON
|
||||
// AsJSON 转换为JSON
|
||||
func (this *TCPProtocolConfig) AsJSON() ([]byte, error) {
|
||||
return json.Marshal(this)
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ func FindServerType(code string) maps.Map {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AllServerProtocolsForType 获取所有协议
|
||||
func AllServerProtocolsForType(serverType ServerType) []maps.Map {
|
||||
protocols := []maps.Map{
|
||||
// FindAllServerProtocols 查找所有协议
|
||||
func FindAllServerProtocols() []maps.Map {
|
||||
return []maps.Map{
|
||||
{
|
||||
"name": "HTTP",
|
||||
"code": "http",
|
||||
@@ -89,10 +89,13 @@ func AllServerProtocolsForType(serverType ServerType) []maps.Map {
|
||||
"serverTypes": []ServerType{ServerTypeUDPProxy},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
result := []maps.Map{}
|
||||
for _, p := range protocols {
|
||||
serverTypes := p.GetSlice("serverTypes")
|
||||
// FindAllServerProtocolsForType 获取所有协议
|
||||
func FindAllServerProtocolsForType(serverType ServerType) []maps.Map {
|
||||
var result = []maps.Map{}
|
||||
for _, p := range FindAllServerProtocols() {
|
||||
var serverTypes = p.GetSlice("serverTypes")
|
||||
if lists.Contains(serverTypes, serverType) {
|
||||
result = append(result, p)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user