lib/connections: Add QUIC protocol support (fixes #5377) (#5737)

This commit is contained in:
Audrius Butkevicius
2019-05-29 08:56:40 +01:00
committed by Jakob Borg
parent d8fa61e27c
commit e714df013f
32 changed files with 1290 additions and 128 deletions

View File

@@ -6,13 +6,13 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"net/url"
"sort"
"time"
"github.com/syncthing/syncthing/lib/osutil"
"github.com/syncthing/syncthing/lib/rand"
"github.com/syncthing/syncthing/lib/relay/protocol"
"github.com/syncthing/syncthing/lib/sync"
)
@@ -209,7 +209,7 @@ func relayAddressesOrder(input []string) []string {
var ids []int
for id, bucket := range buckets {
shuffle(bucket)
rand.Shuffle(bucket)
ids = append(ids, id)
}
@@ -223,10 +223,3 @@ func relayAddressesOrder(input []string) []string {
return addresses
}
func shuffle(slice []string) {
for i := len(slice) - 1; i > 0; i-- {
j := rand.Intn(i + 1)
slice[i], slice[j] = slice[j], slice[i]
}
}