mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	Peers is always returned sorted by Node.ID.
(https://github.com/awsong/headscale)
This commit is contained in:
		
							parent
							
								
									563f3c4017
								
							
						
					
					
						commit
						a20fffc3e9
					
				| @ -4,6 +4,7 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"log" | 	"log" | ||||||
|  | 	"sort" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"github.com/jinzhu/gorm/dialects/postgres" | 	"github.com/jinzhu/gorm/dialects/postgres" | ||||||
| @ -128,5 +129,6 @@ func (h *Headscale) getPeers(m Machine) (*[]*tailcfg.Node, error) { | |||||||
| 		} | 		} | ||||||
| 		peers = append(peers, peer) | 		peers = append(peers, peer) | ||||||
| 	} | 	} | ||||||
|  | 	sort.Slice(peers, func(i, j int) bool { return peers[i].ID < peers[j].ID }) | ||||||
| 	return &peers, nil | 	return &peers, nil | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user