mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-26 06:05:52 -05:00
fix(poll): Normalize hostname
This function is called often. Normalization of the hostname will be written in database.
This commit is contained in:
parent
f2ea6fb30f
commit
44a5372c53
13
poll.go
13
poll.go
@ -83,7 +83,18 @@ func (h *Headscale) PollNetMapHandler(ctx *gin.Context) {
|
|||||||
Str("machine", machine.Name).
|
Str("machine", machine.Name).
|
||||||
Msg("Found machine in database")
|
Msg("Found machine in database")
|
||||||
|
|
||||||
machine.Name = req.Hostinfo.Hostname
|
hname, err := NormalizeNamespaceName(
|
||||||
|
req.Hostinfo.Hostname,
|
||||||
|
h.cfg.OIDC.StripEmaildomain,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Str("func", "handleAuthKey").
|
||||||
|
Str("hostinfo.name", req.Hostinfo.Hostname).
|
||||||
|
Err(err)
|
||||||
|
}
|
||||||
|
machine.Name = hname
|
||||||
machine.HostInfo = HostInfo(*req.Hostinfo)
|
machine.HostInfo = HostInfo(*req.Hostinfo)
|
||||||
machine.DiscoKey = DiscoPublicKeyStripPrefix(req.DiscoKey)
|
machine.DiscoKey = DiscoPublicKeyStripPrefix(req.DiscoKey)
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
|
Loading…
Reference in New Issue
Block a user