mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-19 13:48:20 +02:00
Add comment, improve error message
This commit is contained in:
parent
7610e8c398
commit
fe97600c88
@ -210,18 +210,19 @@ func (ns *noiseServer) NoisePollNetMapHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
node, err := ns.headscale.db.GetNodeByMachineKey(ns.machineKey)
|
node, err := ns.headscale.db.GetNodeByMachineKey(ns.machineKey)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
httpError(writer, NewHTTPError(http.StatusNotFound, "node not found", nil))
|
httpError(writer, NewHTTPError(http.StatusNotFound, "node not found", nil))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
httpError(writer, err)
|
httpError(writer, err)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the NodeKey in the request matches the one associated with the machine key from the Noise session
|
||||||
if node.NodeKey != mapRequest.NodeKey {
|
if node.NodeKey != mapRequest.NodeKey {
|
||||||
httpError(writer, NewHTTPError(http.StatusNotFound, "node does not belong to machine key", nil))
|
httpError(writer, NewHTTPError(http.StatusNotFound, "node key in request does not match the one associated with this machine key", nil))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,6 +275,7 @@ func (ns *noiseServer) NoiseRegistrationHandler(
|
|||||||
return ®Req, resp
|
return ®Req, resp
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ®Req, regErr(err)
|
return ®Req, regErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user