internal/server: set quic to protocol version 39

This commit is contained in:
Cadey Ratio 2017-12-11 18:57:09 -08:00
parent 90536c6ec0
commit d16b00a1a4
1 changed files with 1 additions and 9 deletions

View File

@ -7,14 +7,12 @@ import (
"net" "net"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
"strings"
"time" "time"
"git.xeserv.us/xena/route/internal/database" "git.xeserv.us/xena/route/internal/database"
"git.xeserv.us/xena/route/internal/tun2" "git.xeserv.us/xena/route/internal/tun2"
proto "git.xeserv.us/xena/route/proto" proto "git.xeserv.us/xena/route/proto"
"github.com/Xe/ln" "github.com/Xe/ln"
"github.com/lucas-clemente/quic-go/protocol"
"github.com/mtneug/pkg/ulid" "github.com/mtneug/pkg/ulid"
kcp "github.com/xtaci/kcp-go" kcp "github.com/xtaci/kcp-go"
"golang.org/x/crypto/acme/autocert" "golang.org/x/crypto/acme/autocert"
@ -169,13 +167,7 @@ func (s *Server) Director(r *http.Request) {
r.Header.Del("X-Forwarded-For") r.Header.Del("X-Forwarded-For")
r.Header.Del("X-Client-Ip") r.Header.Del("X-Client-Ip")
var versions []string r.Header.Add("Alt-Svc", fmt.Sprintf(`quic="%s"; ma=2592000; v="39"`, s.cfg.QuicAddr))
for _, v := range protocol.SupportedVersions {
versions = append(versions, v.ToAltSvc())
}
versionsStr := strings.Join(versions, ",")
r.Header.Add("Alt-Svc", fmt.Sprintf(`quic="%s"; ma=2592000; v="%s"`, s.cfg.QuicAddr, versionsStr))
} }
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {