all: Simplify some method calls (#7499)

strings.Replace(a, b, c, -1) -> strings.ReplaceAll(a, b, c)

(Go 1.12) and who knows what was up with that dialQueue.Sort() thing.
This commit is contained in:
Jakob Borg
2021-03-17 23:12:26 +01:00
committed by GitHub
parent 960e850a78
commit 8ef504f745
10 changed files with 18 additions and 19 deletions
+2 -2
View File
@@ -79,7 +79,7 @@ func (t *quicListener) OnExternalAddressChanged(address *stun.Host, via string)
}
func (t *quicListener) serve(ctx context.Context) error {
network := strings.Replace(t.uri.Scheme, "quic", "udp", -1)
network := strings.ReplaceAll(t.uri.Scheme, "quic", "udp")
packetConn, err := net.ListenPacket(network, t.uri.Host)
if err != nil {
@@ -174,7 +174,7 @@ func (t *quicListener) WANAddresses() []*url.URL {
func (t *quicListener) LANAddresses() []*url.URL {
addrs := []*url.URL{t.uri}
network := strings.Replace(t.uri.Scheme, "quic", "udp", -1)
network := strings.ReplaceAll(t.uri.Scheme, "quic", "udp")
addrs = append(addrs, getURLsForAllAdaptersIfUnspecified(network, t.uri)...)
return addrs
}
+1 -1
View File
@@ -478,7 +478,7 @@ func (s *service) dialDevices(ctx context.Context, now time.Time, cfg config.Con
// doesn't have much effect, but it may result in getting up and running
// quicker if only a subset of configured devices are actually reachable
// (by prioritizing those that were reachable recently).
dialQueue.Sort(queue)
queue.Sort()
// Perform dials according to the queue, stopping when we've reached the
// allowed additional number of connections (if limited).