mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
types/netmap,*: pass around UserProfiles as views (pointers) instead
Smaller. Updates tailscale/corp#26058 (@andrew-d noticed during this) Change-Id: Id33cddd171aaf8f042073b6d3c183b0a746e9931 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
1047d11102
commit
9706c9f4ff
@@ -76,7 +76,9 @@ type NetworkMap struct {
|
||||
// If this is empty, then data-plane audit logging is disabled.
|
||||
DomainAuditLogID string
|
||||
|
||||
UserProfiles map[tailcfg.UserID]tailcfg.UserProfile
|
||||
// UserProfiles contains the profile information of UserIDs referenced
|
||||
// in SelfNode and Peers.
|
||||
UserProfiles map[tailcfg.UserID]tailcfg.UserProfileView
|
||||
|
||||
// MaxKeyDuration describes the MaxKeyDuration setting for the tailnet.
|
||||
MaxKeyDuration time.Duration
|
||||
@@ -289,7 +291,12 @@ func (nm *NetworkMap) PeerWithStableID(pid tailcfg.StableNodeID) (_ tailcfg.Node
|
||||
func (nm *NetworkMap) printConciseHeader(buf *strings.Builder) {
|
||||
fmt.Fprintf(buf, "netmap: self: %v auth=%v",
|
||||
nm.NodeKey.ShortString(), nm.GetMachineStatus())
|
||||
login := nm.UserProfiles[nm.User()].LoginName
|
||||
|
||||
var login string
|
||||
up, ok := nm.UserProfiles[nm.User()]
|
||||
if ok {
|
||||
login = up.LoginName()
|
||||
}
|
||||
if login == "" {
|
||||
if nm.User().IsZero() {
|
||||
login = "?"
|
||||
|
Reference in New Issue
Block a user