tailcfg: remove unused Domain field from Login/User

Updates #cleanup

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali 2023-08-18 11:15:13 -04:00 committed by Brad Fitzpatrick
parent 58a4fd43d8
commit 02b47d123f
4 changed files with 3 additions and 12 deletions

View File

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

View File

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

View File

@ -71,7 +71,6 @@ func (v UserView) ID() UserID { return v.ж.ID }
func (v UserView) LoginName() string { return v.ж.LoginName }
func (v UserView) DisplayName() string { return v.ж.DisplayName }
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) Created() time.Time { return v.ж.Created }
@ -81,7 +80,6 @@ var _UserViewNeedsRegeneration = User(struct {
LoginName string
DisplayName string
ProfilePicURL string
Domain string
Logins []LoginID
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) DisplayName() string { return v.ж.DisplayName }
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.
var _LoginViewNeedsRegeneration = Login(struct {
@ -485,7 +482,6 @@ var _LoginViewNeedsRegeneration = Login(struct {
LoginName string
DisplayName string
ProfilePicURL string
Domain string
}{})
// View returns a readonly view of DNSConfig.

View File

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