Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e728a7

Browse files
chore(vpn/tunnel): sort outgoing fqdns by length (#16520)
On the Mac app, we want to display the shortest FQDN - we might as welldo the sorting as they leave the tunnel.Right now it's coming from a map, so it's they arrive in a random ordereach peer update.
1 parent4867cbe commit0e728a7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎vpn/tunnel.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"net/netip"
1111
"net/url"
1212
"reflect"
13+
"sort"
1314
"strconv"
1415
"sync"
1516
"time"
@@ -402,6 +403,9 @@ func (u *updater) createPeerUpdateLocked(update tailnet.WorkspaceUpdate) *PeerUp
402403
forname:=rangeagent.Hosts {
403404
fqdn=append(fqdn,name.WithTrailingDot())
404405
}
406+
sort.Slice(fqdn,func(i,jint)bool {
407+
returnlen(fqdn[i])<len(fqdn[j])
408+
})
405409
out.DeletedAgents[i]=&Agent{
406410
Id:tailnet.UUIDToByteSlice(agent.ID),
407411
Name:agent.Name,
@@ -424,6 +428,9 @@ func (u *updater) convertAgentsLocked(agents []*tailnet.Agent) []*Agent {
424428
forname:=rangeagent.Hosts {
425429
fqdn=append(fqdn,name.WithTrailingDot())
426430
}
431+
sort.Slice(fqdn,func(i,jint)bool {
432+
returnlen(fqdn[i])<len(fqdn[j])
433+
})
427434
protoAgent:=&Agent{
428435
Id:tailnet.UUIDToByteSlice(agent.ID),
429436
Name:agent.Name,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp