mirror of
https://github.com/juanfont/headscale.git
synced 2025-10-18 02:53:36 +00:00
Rename name -> hostname, nickname -> givenname
This commit is contained in:
17
api.go
17
api.go
@@ -133,7 +133,7 @@ func (h *Headscale) RegistrationHandler(ctx *gin.Context) {
|
||||
|
||||
return
|
||||
}
|
||||
hname, err := NormalizeToFQDNRules(
|
||||
normalizedHostname, err := NormalizeToFQDNRules(
|
||||
req.Hostinfo.Hostname,
|
||||
h.cfg.OIDC.StripEmaildomain,
|
||||
)
|
||||
@@ -153,7 +153,8 @@ func (h *Headscale) RegistrationHandler(ctx *gin.Context) {
|
||||
// happens
|
||||
newMachine := Machine{
|
||||
MachineKey: machineKeyStr,
|
||||
Name: hname,
|
||||
Hostname: req.Hostinfo.Hostname,
|
||||
GivenName: normalizedHostname,
|
||||
NodeKey: NodePublicKeyStripPrefix(req.NodeKey),
|
||||
LastSeen: &now,
|
||||
Expiry: &time.Time{},
|
||||
@@ -361,7 +362,7 @@ func (h *Headscale) handleMachineLogOut(
|
||||
resp := tailcfg.RegisterResponse{}
|
||||
|
||||
log.Info().
|
||||
Str("machine", machine.Name).
|
||||
Str("machine", machine.Hostname).
|
||||
Msg("Client requested logout")
|
||||
|
||||
h.ExpireMachine(&machine)
|
||||
@@ -391,7 +392,7 @@ func (h *Headscale) handleMachineValidRegistration(
|
||||
|
||||
// The machine registration is valid, respond with redirect to /map
|
||||
log.Debug().
|
||||
Str("machine", machine.Name).
|
||||
Str("machine", machine.Hostname).
|
||||
Msg("Client is registered and we have the current NodeKey. All clear to /map")
|
||||
|
||||
resp.AuthURL = ""
|
||||
@@ -426,7 +427,7 @@ func (h *Headscale) handleMachineExpired(
|
||||
|
||||
// The client has registered before, but has expired
|
||||
log.Debug().
|
||||
Str("machine", machine.Name).
|
||||
Str("machine", machine.Hostname).
|
||||
Msg("Machine registration has expired. Sending a authurl to register")
|
||||
|
||||
if registerRequest.Auth.AuthKey != "" {
|
||||
@@ -469,7 +470,7 @@ func (h *Headscale) handleMachineRefreshKey(
|
||||
resp := tailcfg.RegisterResponse{}
|
||||
|
||||
log.Debug().
|
||||
Str("machine", machine.Name).
|
||||
Str("machine", machine.Hostname).
|
||||
Msg("We have the OldNodeKey in the database. This is a key refresh")
|
||||
machine.NodeKey = NodePublicKeyStripPrefix(registerRequest.NodeKey)
|
||||
h.db.Save(&machine)
|
||||
@@ -594,7 +595,7 @@ func (h *Headscale) handleAuthKey(
|
||||
if machine != nil {
|
||||
log.Trace().
|
||||
Caller().
|
||||
Str("machine", machine.Name).
|
||||
Str("machine", machine.Hostname).
|
||||
Msg("machine already registered, refreshing with new auth key")
|
||||
|
||||
machine.NodeKey = nodeKey
|
||||
@@ -603,7 +604,7 @@ func (h *Headscale) handleAuthKey(
|
||||
} else {
|
||||
now := time.Now().UTC()
|
||||
machineToRegister := Machine{
|
||||
Name: registerRequest.Hostinfo.Hostname,
|
||||
Hostname: registerRequest.Hostinfo.Hostname,
|
||||
NamespaceID: pak.Namespace.ID,
|
||||
MachineKey: machineKeyStr,
|
||||
RegisterMethod: RegisterMethodAuthKey,
|
||||
|
Reference in New Issue
Block a user