tailcfg: remove unused Domain field from Login/User

Updates #cleanup

Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/8966/head
Maisem Ali 1 year ago committed by Brad Fitzpatrick
parent 58a4fd43d8
commit 02b47d123f

@ -155,7 +155,6 @@ type User struct {
LoginName string `json:"-"` // not stored, filled from Login // TODO REMOVE LoginName string `json:"-"` // not stored, filled from Login // TODO REMOVE
DisplayName string // if non-empty overrides Login field DisplayName string // if non-empty overrides Login field
ProfilePicURL string // if non-empty overrides Login field ProfilePicURL string // if non-empty overrides Login field
Domain string
Logins []LoginID Logins []LoginID
Created time.Time Created time.Time
} }
@ -167,7 +166,6 @@ type Login struct {
LoginName string LoginName string
DisplayName string DisplayName string
ProfilePicURL string ProfilePicURL string
Domain string
} }
// A UserProfile is display-friendly data for a user. // A UserProfile is display-friendly data for a user.

@ -34,7 +34,6 @@ var _UserCloneNeedsRegeneration = User(struct {
LoginName string LoginName string
DisplayName string DisplayName string
ProfilePicURL string ProfilePicURL string
Domain string
Logins []LoginID Logins []LoginID
Created time.Time Created time.Time
}{}) }{})
@ -217,7 +216,6 @@ var _LoginCloneNeedsRegeneration = Login(struct {
LoginName string LoginName string
DisplayName string DisplayName string
ProfilePicURL string ProfilePicURL string
Domain string
}{}) }{})
// Clone makes a deep copy of DNSConfig. // Clone makes a deep copy of DNSConfig.

@ -71,7 +71,6 @@ func (v UserView) ID() UserID { return v.ж.ID }
func (v UserView) LoginName() string { return v.ж.LoginName } func (v UserView) LoginName() string { return v.ж.LoginName }
func (v UserView) DisplayName() string { return v.ж.DisplayName } func (v UserView) DisplayName() string { return v.ж.DisplayName }
func (v UserView) ProfilePicURL() string { return v.ж.ProfilePicURL } func (v UserView) ProfilePicURL() string { return v.ж.ProfilePicURL }
func (v UserView) Domain() string { return v.ж.Domain }
func (v UserView) Logins() views.Slice[LoginID] { return views.SliceOf(v.ж.Logins) } func (v UserView) Logins() views.Slice[LoginID] { return views.SliceOf(v.ж.Logins) }
func (v UserView) Created() time.Time { return v.ж.Created } func (v UserView) Created() time.Time { return v.ж.Created }
@ -81,7 +80,6 @@ var _UserViewNeedsRegeneration = User(struct {
LoginName string LoginName string
DisplayName string DisplayName string
ProfilePicURL string ProfilePicURL string
Domain string
Logins []LoginID Logins []LoginID
Created time.Time Created time.Time
}{}) }{})
@ -475,7 +473,6 @@ func (v LoginView) Provider() string { return v.ж.Provider }
func (v LoginView) LoginName() string { return v.ж.LoginName } func (v LoginView) LoginName() string { return v.ж.LoginName }
func (v LoginView) DisplayName() string { return v.ж.DisplayName } func (v LoginView) DisplayName() string { return v.ж.DisplayName }
func (v LoginView) ProfilePicURL() string { return v.ж.ProfilePicURL } func (v LoginView) ProfilePicURL() string { return v.ж.ProfilePicURL }
func (v LoginView) Domain() string { return v.ж.Domain }
// A compilation failure here means this code must be regenerated, with the command at the top of this file. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _LoginViewNeedsRegeneration = Login(struct { var _LoginViewNeedsRegeneration = Login(struct {
@ -485,7 +482,6 @@ var _LoginViewNeedsRegeneration = Login(struct {
LoginName string LoginName string
DisplayName string DisplayName string
ProfilePicURL string ProfilePicURL string
Domain string
}{}) }{})
// View returns a readonly view of DNSConfig. // View returns a readonly view of DNSConfig.

@ -400,6 +400,8 @@ func (s *Server) AllNodes() (nodes []*tailcfg.Node) {
return nodes return nodes
} }
const domain = "fake-control.example.net"
func (s *Server) getUser(nodeKey key.NodePublic) (*tailcfg.User, *tailcfg.Login) { func (s *Server) getUser(nodeKey key.NodePublic) (*tailcfg.User, *tailcfg.Login) {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
@ -413,7 +415,6 @@ func (s *Server) getUser(nodeKey key.NodePublic) (*tailcfg.User, *tailcfg.Login)
return u, s.logins[nodeKey] return u, s.logins[nodeKey]
} }
id := tailcfg.UserID(len(s.users) + 1) id := tailcfg.UserID(len(s.users) + 1)
domain := "fake-control.example.net"
loginName := fmt.Sprintf("user-%d@%s", id, domain) loginName := fmt.Sprintf("user-%d@%s", id, domain)
displayName := fmt.Sprintf("User %d", id) displayName := fmt.Sprintf("User %d", id)
login := &tailcfg.Login{ login := &tailcfg.Login{
@ -422,13 +423,11 @@ func (s *Server) getUser(nodeKey key.NodePublic) (*tailcfg.User, *tailcfg.Login)
LoginName: loginName, LoginName: loginName,
DisplayName: displayName, DisplayName: displayName,
ProfilePicURL: "https://tailscale.com/static/images/marketing/team-carney.jpg", ProfilePicURL: "https://tailscale.com/static/images/marketing/team-carney.jpg",
Domain: domain,
} }
user := &tailcfg.User{ user := &tailcfg.User{
ID: id, ID: id,
LoginName: loginName, LoginName: loginName,
DisplayName: displayName, DisplayName: displayName,
Domain: domain,
Logins: []tailcfg.LoginID{login.ID}, Logins: []tailcfg.LoginID{login.ID},
} }
s.users[nodeKey] = user s.users[nodeKey] = user
@ -829,7 +828,7 @@ func (s *Server) MapResponse(req *tailcfg.MapRequest) (res *tailcfg.MapResponse,
res = &tailcfg.MapResponse{ res = &tailcfg.MapResponse{
Node: node, Node: node,
DERPMap: s.DERPMap, DERPMap: s.DERPMap,
Domain: string(user.Domain), Domain: domain,
CollectServices: "true", CollectServices: "true",
PacketFilter: packetFilterWithIngressCaps(), PacketFilter: packetFilterWithIngressCaps(),
DNSConfig: dns, DNSConfig: dns,

Loading…
Cancel
Save