headscale/hscontrol/db
Kristoffer Dalby d6dfdc100c hscontrol: route hostname handling through dnsname and NodeStore
Ingest (registration and MapRequest updates) now calls
dnsname.SanitizeHostname directly and lets NodeStore auto-bump on
collision. Admin rename uses dnsname.ValidLabel + SetGivenName so
conflicts are surfaced to the caller instead of silently mutated.

Three duplicate invalidDNSRegex definitions, the old NormaliseHostname
and ValidateHostname helpers, EnsureHostname, InvalidString,
ApplyHostnameFromHostInfo, GivenNameHasBeenChanged, generateGivenName
and EnsureUniqueGivenName are removed along with their tests.
ValidateHostname's username half is retained as ValidateUsername for
users.go.

The SaaS-matching collision rule replaces the random "invalid-xxxxxx"
fallback and the 8-character hash suffix; the empty-input fallback is
the literal "node". TestUpdateHostnameFromClient now exercises the
rewrite end-to-end with awkward macOS/Windows names.

Fixes #3188
Fixes #2926
Fixes #2343
Fixes #2762
Fixes #2449
Updates #2177
Updates #2121
Updates #363
2026-04-18 15:12:21 +01:00
..
sqliteconfig all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
testdata/sqlite db: use PolicyManager for RequestTags migration 2026-01-21 15:10:29 +01:00
api_key.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
api_key_test.go grpc: support expire/delete API keys by ID 2026-01-20 17:13:38 +01:00
db.go state: replace zcache with bounded LRU for auth cache 2026-04-10 14:09:57 +01:00
db_test.go state: replace zcache with bounded LRU for auth cache 2026-04-10 14:09:57 +01:00
ephemeral_garbage_collector_test.go all: apply formatter changes 2026-04-13 17:23:47 +01:00
ip.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
ip_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
main_test.go all: fix test flakiness and improve test infrastructure 2026-03-14 02:52:28 -07:00
node.go hscontrol: route hostname handling through dnsname and NodeStore 2026-04-18 15:12:21 +01:00
node_test.go hscontrol: route hostname handling through dnsname and NodeStore 2026-04-18 15:12:21 +01:00
policy.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
preauth_keys.go db: guard UsePreAuthKey with WHERE used=false 2026-04-10 14:09:57 +01:00
preauth_keys_test.go db: guard UsePreAuthKey with WHERE used=false 2026-04-10 14:09:57 +01:00
schema.sql hscontrol/db: add migration to clear user_id on tagged nodes 2026-02-20 21:51:00 +01:00
suite_test.go hscontrol/types: silence zerolog by default in tests 2026-04-17 16:31:49 +01:00
text_serialiser.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
user_update_test.go hscontrol: use Updates() instead of Save() for partial updates 2025-11-11 12:47:48 -06:00
users.go hscontrol: route hostname handling through dnsname and NodeStore 2026-04-18 15:12:21 +01:00
users_test.go db: scope DestroyUser to only delete the target user's pre-auth keys 2026-04-09 08:30:21 +01:00
versioncheck.go db: fix database_versions table creation for PostgreSQL 2026-02-19 08:21:23 +01:00
versioncheck_test.go db: enforce strict version upgrade path 2026-02-19 08:21:23 +01:00