fix
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m52s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m52s
This commit is contained in:
31
main.go
31
main.go
@@ -112,19 +112,14 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
tlsConf.NextProtos = []string{"h3"}
|
||||
tlsConf.NextProtos = []string{"h3", "http/1.1"}
|
||||
tlsConf.MinVersion = tls.VersionTLS13
|
||||
|
||||
server := NewServer()
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
wtServer := &webtransport.Server{
|
||||
H3: &http3.Server{
|
||||
Addr: ":443",
|
||||
TLSConfig: tlsConf,
|
||||
},
|
||||
}
|
||||
wtServer := &webtransport.Server{}
|
||||
|
||||
mux.HandleFunc("/room/", func(w http.ResponseWriter, r *http.Request) {
|
||||
roomName := strings.TrimPrefix(r.URL.Path, "/room/")
|
||||
@@ -138,9 +133,27 @@ func main() {
|
||||
go server.handleSession(roomName, sess)
|
||||
})
|
||||
|
||||
wtServer.H3.Handler = mux
|
||||
// HTTP/1.1 server (TCP 443)
|
||||
httpServer := &http.Server{
|
||||
Addr: ":443",
|
||||
TLSConfig: tlsConf,
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
// HTTP/3 server (UDP 443)
|
||||
h3Server := &http3.Server{
|
||||
Addr: ":443",
|
||||
TLSConfig: tlsConf,
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
log.Println("Relay running on https://" + domain + "/room/{room}")
|
||||
|
||||
log.Fatal(wtServer.ListenAndServe())
|
||||
// Запускаем HTTP/3
|
||||
go func() {
|
||||
log.Fatal(h3Server.ListenAndServe())
|
||||
}()
|
||||
|
||||
// Запускаем HTTPS (TCP)
|
||||
log.Fatal(httpServer.ListenAndServeTLS("", ""))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user