mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-25 19:31:05 +00:00
improve experimental quic setup
This commit is contained in:
parent
2c8dbef79f
commit
5e735c2632
2 changed files with 16 additions and 12 deletions
|
@ -545,27 +545,30 @@ func server(c *cli.Context) error {
|
||||||
Cache: autocert.DirCache(dir),
|
Cache: autocert.DirCache(dir),
|
||||||
}
|
}
|
||||||
httpServer := &http.Server{
|
httpServer := &http.Server{
|
||||||
Addr: ":https",
|
Addr: ":443",
|
||||||
TLSConfig: &tls.Config{GetCertificate: manager.GetCertificate},
|
|
||||||
Handler: handler,
|
Handler: handler,
|
||||||
|
TLSConfig: &tls.Config{
|
||||||
|
GetCertificate: manager.GetCertificate,
|
||||||
|
NextProtos: []string{"h2", "http/1.1"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
quicServer := &h2quic.Server{
|
||||||
|
Server: httpServer,
|
||||||
}
|
}
|
||||||
quicServer := &h2quic.Server{Server: httpServer}
|
|
||||||
quicServer.TLSConfig = httpServer.TLSConfig
|
|
||||||
|
|
||||||
httpServer.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
quicServer.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
quicServer.SetQuicHeaders(w.Header())
|
quicServer.SetQuicHeaders(w.Header())
|
||||||
handler.ServeHTTP(w, r)
|
handler.ServeHTTP(w, r)
|
||||||
})
|
})
|
||||||
|
|
||||||
addr, err := net.ResolveUDPAddr("udp", ":443")
|
conn, err := net.ListenPacket("udp", ":443")
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
conn, err := net.ListenUDP("udp", addr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
g.Go(func() error {
|
||||||
return quicServer.Serve(conn)
|
return quicServer.Serve(conn)
|
||||||
|
})
|
||||||
|
return http.Serve(manager.Listener(), quicServer.Handler)
|
||||||
}
|
}
|
||||||
return http.Serve(autocert.NewListener(address.Host), handler)
|
return http.Serve(autocert.NewListener(address.Host), handler)
|
||||||
})
|
})
|
||||||
|
|
|
@ -59,6 +59,7 @@ func (w *website) Page(rw http.ResponseWriter, r *http.Request, u *model.User) {
|
||||||
"csrf": csrf,
|
"csrf": csrf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rw.Header().Set("Content-Type", "text/html; charset=UTF-8")
|
||||||
template.T.ExecuteTemplate(rw, "index_polymer.html", params)
|
template.T.ExecuteTemplate(rw, "index_polymer.html", params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue