mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 13:35:23 +00:00
Format
Signed-off-by: Kristoffer Dalby <kristoffer@dalby.cc>
This commit is contained in:
parent
33ae56acfa
commit
356b76fc56
31
machine.go
31
machine.go
@ -26,9 +26,11 @@ const (
|
|||||||
)
|
)
|
||||||
ErrCouldNotConvertMachineInterface = Error("failed to convert machine interface")
|
ErrCouldNotConvertMachineInterface = Error("failed to convert machine interface")
|
||||||
ErrHostnameTooLong = Error("Hostname too long")
|
ErrHostnameTooLong = Error("Hostname too long")
|
||||||
ErrDifferentRegisteredNamespace = Error("machine was previously registered with a different namespace")
|
ErrDifferentRegisteredNamespace = Error(
|
||||||
MachineGivenNameHashLength = 8
|
"machine was previously registered with a different namespace",
|
||||||
MachineGivenNameTrimSize = 2
|
)
|
||||||
|
MachineGivenNameHashLength = 8
|
||||||
|
MachineGivenNameTrimSize = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -695,17 +697,17 @@ func (machine Machine) toNode(
|
|||||||
StableID: tailcfg.StableNodeID(
|
StableID: tailcfg.StableNodeID(
|
||||||
strconv.FormatUint(machine.ID, Base10),
|
strconv.FormatUint(machine.ID, Base10),
|
||||||
), // in headscale, unlike tailcontrol server, IDs are permanent
|
), // in headscale, unlike tailcontrol server, IDs are permanent
|
||||||
Name: hostname,
|
Name: hostname,
|
||||||
User: tailcfg.UserID(machine.NamespaceID),
|
User: tailcfg.UserID(machine.NamespaceID),
|
||||||
Key: nodeKey,
|
Key: nodeKey,
|
||||||
KeyExpiry: keyExpiry,
|
KeyExpiry: keyExpiry,
|
||||||
Machine: machineKey,
|
Machine: machineKey,
|
||||||
DiscoKey: discoKey,
|
DiscoKey: discoKey,
|
||||||
Addresses: addrs,
|
Addresses: addrs,
|
||||||
AllowedIPs: allowedIPs,
|
AllowedIPs: allowedIPs,
|
||||||
PrimaryRoutes: primaryRoutes,
|
PrimaryRoutes: primaryRoutes,
|
||||||
Endpoints: machine.Endpoints,
|
Endpoints: machine.Endpoints,
|
||||||
DERP: derp,
|
DERP: derp,
|
||||||
|
|
||||||
Online: &online,
|
Online: &online,
|
||||||
Hostinfo: hostInfo.View(),
|
Hostinfo: hostInfo.View(),
|
||||||
@ -820,7 +822,8 @@ func (h *Headscale) RegisterMachineFromAuthCallback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Registration of expired machine with different namespace
|
// Registration of expired machine with different namespace
|
||||||
if registrationMachine.ID != 0 && registrationMachine.NamespaceID != namespace.ID {
|
if registrationMachine.ID != 0 &&
|
||||||
|
registrationMachine.NamespaceID != namespace.ID {
|
||||||
return nil, ErrDifferentRegisteredNamespace
|
return nil, ErrDifferentRegisteredNamespace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user