restore
This commit is contained in:
parent
1a230252c7
commit
e2e8f59fc5
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -42,8 +41,6 @@ func SetCors(w http.ResponseWriter, r *http.Request) {
|
||||||
var pathdict sync.Map = sync.Map{}
|
var pathdict sync.Map = sync.Map{}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetFlags(log.Llongfile)
|
|
||||||
|
|
||||||
// 将静态资源路径存储到pathdict
|
// 将静态资源路径存储到pathdict
|
||||||
pathdict.Store("/css", true)
|
pathdict.Store("/css", true)
|
||||||
pathdict.Store("/fonts", true)
|
pathdict.Store("/fonts", true)
|
||||||
|
@ -117,34 +114,7 @@ func main() {
|
||||||
|
|
||||||
ServerAddress := ":9900"
|
ServerAddress := ":9900"
|
||||||
log.Println("listen on ", ServerAddress)
|
log.Println("listen on ", ServerAddress)
|
||||||
|
log.Fatal(http.ListenAndServe(ServerAddress, mux))
|
||||||
keydata, err := os.ReadFile("/opt/server.fusen.3718.cn.key")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
pemdata, err := os.ReadFile("/opt/server.fusen.3718.cn.pem")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
cert, err := tls.X509KeyPair(pemdata, keydata)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
tlscfg := &tls.Config{
|
|
||||||
Certificates: []tls.Certificate{cert},
|
|
||||||
MinVersion: tls.VersionTLS12,
|
|
||||||
MaxVersion: tls.VersionTLS13,
|
|
||||||
}
|
|
||||||
serv := http.Server{
|
|
||||||
Addr: ServerAddress,
|
|
||||||
Handler: mux,
|
|
||||||
TLSConfig: tlscfg,
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Fatal(serv.ListenAndServeTLS("", ""))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 后端服务的类型
|
// 后端服务的类型
|
||||||
|
|
Loading…
Reference in New Issue
Block a user