Skip to content

Commit

Permalink
fix: open API spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Nov 6, 2023
1 parent 75bdcf1 commit 18f082e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions openapi/SwarmCommon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ components:
$ref: "#/components/schemas/Address"
fullNode:
type: boolean
p2pTransport:
underlay:
type: array
nullable: true
items:
type: string
$ref: "SwarmCommon.yaml#/components/schemas/MultiAddress"


BlockListedPeers:
Expand Down
10 changes: 5 additions & 5 deletions pkg/p2p/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package p2p

import (
"cmp"
"context"
"errors"
"fmt"
"sort"
"strings"
"slices"

ma "github.com/multiformats/go-multiaddr"
madns "github.com/multiformats/go-multiaddr-dns"
Expand All @@ -36,9 +36,9 @@ func Discover(ctx context.Context, addr ma.Multiaddr, f func(ma.Multiaddr) (bool
return false, errors.New("non-resolvable API endpoint")
}

// sort addrs so that quic is tried first
sort.Slice(addrs, func(i, j int) bool {
return strings.Contains(addrs[i].String(), "/quic")
// Prioritize QUIC transport connections over the others.
slices.SortFunc(addrs, func(i, j ma.Multiaddr) int {
return cmp.Compare(i.String(), "/quic")
})

for _, addr := range addrs {
Expand Down

0 comments on commit 18f082e

Please sign in to comment.