save version numbers such that can be written in big endian

This makes the version number representation consistent with the IETF
draft.
This commit is contained in:
Marten Seemann
2017-10-24 10:45:08 +07:00
parent e81795e49b
commit d98a11bb35
18 changed files with 68 additions and 65 deletions

View File

@@ -7,7 +7,7 @@ import (
"net"
"net/http"
"runtime"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
@@ -280,12 +280,11 @@ func (s *Server) SetQuicHeaders(hdr http.Header) error {
}
if s.supportedVersionsAsString == "" {
for i, v := range protocol.SupportedVersions {
s.supportedVersionsAsString += strconv.Itoa(int(v))
if i != len(protocol.SupportedVersions)-1 {
s.supportedVersionsAsString += ","
}
var versions []string
for _, v := range protocol.SupportedVersions {
versions = append(versions, v.ToAltSvc())
}
s.supportedVersionsAsString = strings.Join(versions, ",")
}
hdr.Add("Alt-Svc", fmt.Sprintf(`quic=":%d"; ma=2592000; v="%s"`, port, s.supportedVersionsAsString))