tailcfg: make Node.Hostinfo a HostinfoView
Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@ -474,7 +474,7 @@ func (s *Server) serveRegister(w http.ResponseWriter, r *http.Request, mkey key.
|
||||
MachineAuthorized: machineAuthorized,
|
||||
Addresses: allowedIPs,
|
||||
AllowedIPs: allowedIPs,
|
||||
Hostinfo: *req.Hostinfo,
|
||||
Hostinfo: req.Hostinfo.View(),
|
||||
}
|
||||
requireAuth := s.RequireAuth
|
||||
if requireAuth && s.nodeKeyAuthed[nk] {
|
||||
@ -611,10 +611,10 @@ func (s *Server) serveMap(w http.ResponseWriter, r *http.Request, mkey key.Machi
|
||||
node.Endpoints = endpoints
|
||||
node.DiscoKey = req.DiscoKey
|
||||
if req.Hostinfo != nil {
|
||||
node.Hostinfo = *req.Hostinfo.Clone()
|
||||
if ni := node.Hostinfo.NetInfo; ni != nil {
|
||||
if ni.PreferredDERP != 0 {
|
||||
node.DERP = fmt.Sprintf("127.3.3.40:%d", ni.PreferredDERP)
|
||||
node.Hostinfo = req.Hostinfo.View()
|
||||
if ni := node.Hostinfo.NetInfo(); ni.Valid() {
|
||||
if ni.PreferredDERP() != 0 {
|
||||
node.DERP = fmt.Sprintf("127.3.3.40:%d", ni.PreferredDERP())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user