-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* replace old suite approved routes test with table driven Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> * add test to reproduce issue Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> * add integration test for 2068 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> --------- Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
- Loading branch information
Showing
5 changed files
with
214 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
package util | ||
|
||
import ( | ||
"cmp" | ||
"context" | ||
"net" | ||
"net/netip" | ||
) | ||
|
||
func GrpcSocketDialer(ctx context.Context, addr string) (net.Conn, error) { | ||
var d net.Dialer | ||
|
||
return d.DialContext(ctx, "unix", addr) | ||
} | ||
|
||
|
||
// TODO(kradalby): Remove after go 1.24, will be in stdlib. | ||
// Compare returns an integer comparing two prefixes. | ||
// The result will be 0 if p == p2, -1 if p < p2, and +1 if p > p2. | ||
// Prefixes sort first by validity (invalid before valid), then | ||
// address family (IPv4 before IPv6), then prefix length, then | ||
// address. | ||
func ComparePrefix(p, p2 netip.Prefix) int { | ||
if c := cmp.Compare(p.Addr().BitLen(), p2.Addr().BitLen()); c != 0 { | ||
return c | ||
} | ||
if c := cmp.Compare(p.Bits(), p2.Bits()); c != 0 { | ||
return c | ||
} | ||
return p.Addr().Compare(p2.Addr()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters