cmd/routed: alt-svc fix again

This commit is contained in:
Cadey Ratio 2018-01-03 11:12:21 -08:00
parent d63c627669
commit 7ea63913b9
2 changed files with 6 additions and 2 deletions

View File

@ -87,6 +87,8 @@ func setupQuic(s *Server, scfg Config) {
},
}
s.QuicServer = qs
for {
ln.FatalErr(context.Background(), qs.ListenAndServe())
}

View File

@ -3,7 +3,6 @@ package main
import (
"crypto/tls"
"errors"
"fmt"
"net"
"net/http"
"net/http/httputil"
@ -13,6 +12,7 @@ import (
"git.xeserv.us/xena/route/internal/tun2"
proto "git.xeserv.us/xena/route/proto"
"github.com/Xe/ln"
"github.com/lucas-clemente/quic-go/h2quic"
"github.com/mtneug/pkg/ulid"
kcp "github.com/xtaci/kcp-go"
"golang.org/x/crypto/acme/autocert"
@ -32,6 +32,8 @@ type Server struct {
db database.Storage
ts *tun2.Server
QuicServer *h2quic.Server
*autocert.Manager
}
@ -185,7 +187,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
rid := ulid.New().String()
r.Header.Set("X-Request-Id", rid)
w.Header().Set("X-Request-Id", rid)
w.Header().Add("Alt-Svc", fmt.Sprintf(`hq="%s"; ma=2592000`, s.cfg.QuicAddr))
s.QuicServer.SetQuicHeaders(w.Header())
// http://www.gnuterrypratchett.com/
w.Header().Set("X-Clacks-Overhead", "GNU Ashlynn")