mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-05 04:11:59 +00:00
tailcfg: remove unused User fields
Fixes #14542 Change-Id: Ifeb0f90c570c1b555af761161f79df75f18ae3f9 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
5da772c670
commit
b90707665e
@@ -6,6 +6,7 @@ package testcontrol
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"cmp"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
@@ -476,13 +477,22 @@ func (s *Server) AddFakeNode() {
|
||||
// TODO: send updates to other (non-fake?) nodes
|
||||
}
|
||||
|
||||
func (s *Server) AllUsers() (users []*tailcfg.User) {
|
||||
func (s *Server) allUserProfiles() (res []tailcfg.UserProfile) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for _, u := range s.users {
|
||||
users = append(users, u.Clone())
|
||||
for k, u := range s.users {
|
||||
up := tailcfg.UserProfile{
|
||||
ID: u.ID,
|
||||
DisplayName: u.DisplayName,
|
||||
}
|
||||
if login, ok := s.logins[k]; ok {
|
||||
up.LoginName = login.LoginName
|
||||
up.ProfilePicURL = cmp.Or(up.ProfilePicURL, login.ProfilePicURL)
|
||||
up.DisplayName = cmp.Or(up.DisplayName, login.DisplayName)
|
||||
}
|
||||
res = append(res, up)
|
||||
}
|
||||
return users
|
||||
return res
|
||||
}
|
||||
|
||||
func (s *Server) AllNodes() (nodes []*tailcfg.Node) {
|
||||
@@ -523,9 +533,7 @@ func (s *Server) getUser(nodeKey key.NodePublic) (*tailcfg.User, *tailcfg.Login)
|
||||
}
|
||||
user := &tailcfg.User{
|
||||
ID: id,
|
||||
LoginName: loginName,
|
||||
DisplayName: displayName,
|
||||
Logins: []tailcfg.LoginID{login.ID},
|
||||
}
|
||||
s.users[nodeKey] = user
|
||||
s.logins[nodeKey] = login
|
||||
@@ -1001,13 +1009,7 @@ func (s *Server) MapResponse(req *tailcfg.MapRequest) (res *tailcfg.MapResponse,
|
||||
sort.Slice(res.Peers, func(i, j int) bool {
|
||||
return res.Peers[i].ID < res.Peers[j].ID
|
||||
})
|
||||
for _, u := range s.AllUsers() {
|
||||
res.UserProfiles = append(res.UserProfiles, tailcfg.UserProfile{
|
||||
ID: u.ID,
|
||||
LoginName: u.LoginName,
|
||||
DisplayName: u.DisplayName,
|
||||
})
|
||||
}
|
||||
res.UserProfiles = s.allUserProfiles()
|
||||
|
||||
v4Prefix := netip.PrefixFrom(netaddr.IPv4(100, 64, uint8(tailcfg.NodeID(user.ID)>>8), uint8(tailcfg.NodeID(user.ID))), 32)
|
||||
v6Prefix := netip.PrefixFrom(tsaddr.Tailscale4To6(v4Prefix.Addr()), 128)
|
||||
|
||||
Reference in New Issue
Block a user