This commit is contained in:
2023-08-23 17:19:01 +08:00
parent 3b6b2929a2
commit bda2a9f5e6
2 changed files with 3 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ type YamlConfig struct {
IPv6 string `yaml:"ipv6"`
Port uint16 `yaml:"port"`
Schema string `yaml:"schema"`
CaFile string `yaml:"caFile"`
CertFile string `yaml:"certFile"`
KeyFile string `yaml:"keyFile"`
} `yaml:"rest"`

View File

@@ -158,7 +158,7 @@ func main() {
if rest.IPv4 != "" {
listen := rest.IPv4 + ":" + strconv.Itoa(int(rest.Port))
if strings.ToLower(rest.Schema) == "https" {
go HttpListenTLS(listen, rest.CertFile, rest.KeyFile, router)
go HttpListenConfigTLS(listen, rest.CaFile, rest.CertFile, rest.KeyFile, router)
} else {
go HttpListen(listen, router)
}
@@ -168,7 +168,7 @@ func main() {
if rest.IPv6 != "" {
listenv6 := "[" + rest.IPv6 + "]" + ":" + strconv.Itoa(int(rest.Port))
if strings.ToLower(rest.Schema) == "https" {
go HttpListenTLS(listenv6, rest.CertFile, rest.KeyFile, router)
go HttpListenConfigTLS(listenv6, rest.CaFile, rest.CertFile, rest.KeyFile, router)
} else {
go HttpListen(listenv6, router)
}