repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
docker/compose
https://github.com/docker/compose/blob/ec88588cd81a5b01eb2853d4ef538db4cb11e093/internal/sync/tar.go
internal/sync/tar.go
/* Copyright 2018 The Tilt Dev Authors Copyright 2023 Docker Compose CLI authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ...
go
Apache-2.0
ec88588cd81a5b01eb2853d4ef538db4cb11e093
2026-01-07T08:36:00.670150Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/swagger.go
swagger.go
package headscale import ( "bytes" _ "embed" "html/template" "net/http" "github.com/rs/zerolog/log" ) //go:embed gen/openapiv2/headscale/v1/headscale.swagger.json var apiV1JSON []byte func SwaggerUI( writer http.ResponseWriter, req *http.Request, ) { swaggerTemplate := template.Must(template.New("swagger")....
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/.github/workflows/gh-action-integration-generator.go
.github/workflows/gh-action-integration-generator.go
package main //go:generate go run ./gh-action-integration-generator.go import ( "bytes" "fmt" "log" "os/exec" "strings" ) // testsToSplit defines tests that should be split into multiple CI jobs. // Key is the test function name, value is a list of subtest prefixes. // Each prefix becomes a separate CI job as "...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/auth_tags_test.go
hscontrol/auth_tags_test.go
package hscontrol import ( "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/tailcfg" "tailscale.com/types/key" ) // TestTaggedPreAuthKeyCreatesTaggedNode tests that a PreAuthKey with tags creates // a tag...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/grpcv1.go
hscontrol/grpcv1.go
//go:generate buf generate --template ../buf.gen.yaml -o .. ../proto // nolint package hscontrol import ( "context" "errors" "fmt" "io" "net/netip" "os" "slices" "sort" "strings" "time" "github.com/rs/zerolog/log" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobu...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/tailsql.go
hscontrol/tailsql.go
package hscontrol import ( "context" "errors" "fmt" "net/http" "os" "github.com/tailscale/tailsql/server/tailsql" "tailscale.com/tsnet" "tailscale.com/tsweb" "tailscale.com/types/logger" ) func runTailSQLService(ctx context.Context, logf logger.Logf, stateDir, dbPath string) error { opts := tailsql.Options...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/metrics.go
hscontrol/metrics.go
package hscontrol import ( "net/http" "strconv" "github.com/gorilla/mux" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "tailscale.com/envknob" ) var debugHighCardinalityMetrics = envknob.Bool("HEADSCALE_DEBUG_HIGH_CARDINALITY_METRICS") var mapRespon...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/oidc.go
hscontrol/oidc.go
package hscontrol import ( "bytes" "cmp" "context" "errors" "fmt" "net/http" "slices" "strings" "time" "github.com/coreos/go-oidc/v3/oidc" "github.com/gorilla/mux" "github.com/juanfont/headscale/hscontrol/db" "github.com/juanfont/headscale/hscontrol/templates" "github.com/juanfont/headscale/hscontrol/ty...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/grpcv1_test.go
hscontrol/grpcv1_test.go
package hscontrol import ( "context" "testing" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "tailscale.com/tailcfg" "tailscale.com/types/key" ) func Test_valida...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/templates_consistency_test.go
hscontrol/templates_consistency_test.go
package hscontrol import ( "strings" "testing" "github.com/juanfont/headscale/hscontrol/templates" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" ) func TestTemplateHTMLConsistency(t *testing.T) { // Test all templates produce consistent modern HTML testCases := []struct ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/debug.go
hscontrol/debug.go
package hscontrol import ( "encoding/json" "fmt" "net/http" "strings" "github.com/arl/statsviz" "github.com/juanfont/headscale/hscontrol/mapper" "github.com/juanfont/headscale/hscontrol/types" "github.com/prometheus/client_golang/prometheus/promhttp" "tailscale.com/tsweb" ) func (h *Headscale) debugHTTPServ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/platform_config.go
hscontrol/platform_config.go
package hscontrol import ( "bytes" _ "embed" "html/template" "net/http" textTemplate "text/template" "github.com/gofrs/uuid/v5" "github.com/gorilla/mux" "github.com/juanfont/headscale/hscontrol/templates" ) // WindowsConfigMessage shows a simple message in the browser for how to configure the Windows Tailsca...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/oidc_template_test.go
hscontrol/oidc_template_test.go
package hscontrol import ( "testing" "github.com/juanfont/headscale/hscontrol/templates" "github.com/stretchr/testify/assert" ) func TestOIDCCallbackTemplate(t *testing.T) { tests := []struct { name string userName string verb string }{ { name: "logged_in_user", userName: "test@example...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/suite_test.go
hscontrol/suite_test.go
package hscontrol import ( "os" "testing" "github.com/juanfont/headscale/hscontrol/types" "gopkg.in/check.v1" ) func Test(t *testing.T) { check.TestingT(t) } var _ = check.Suite(&Suite{}) type Suite struct{} var ( tmpDir string app *Headscale ) func (s *Suite) SetUpTest(c *check.C) { s.ResetDB(c) } f...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/auth.go
hscontrol/auth.go
package hscontrol import ( "cmp" "context" "errors" "fmt" "net/http" "net/url" "strings" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog/log" "gorm.io/gorm" "tailscale.com/tailcfg" "tailscale.com/types/key" "tailscale.com/type...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/noise.go
hscontrol/noise.go
package hscontrol import ( "encoding/binary" "encoding/json" "errors" "fmt" "io" "net/http" "github.com/gorilla/mux" "github.com/juanfont/headscale/hscontrol/capver" "github.com/juanfont/headscale/hscontrol/types" "github.com/rs/zerolog/log" "golang.org/x/net/http2" "tailscale.com/control/controlbase" "t...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/poll.go
hscontrol/poll.go
package hscontrol import ( "context" "encoding/binary" "encoding/json" "fmt" "math/rand/v2" "net/http" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/sasha-s/go-deadlock" "tailscale.com/...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/app.go
hscontrol/app.go
package hscontrol import ( "context" "crypto/tls" "errors" "fmt" "io" "net" "net/http" _ "net/http/pprof" // nolint "os" "os/signal" "path/filepath" "runtime" "strings" "sync" "syscall" "time" "github.com/cenkalti/backoff/v5" "github.com/davecgh/go-spew/spew" "github.com/gorilla/mux" grpcRuntime "...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/handlers.go
hscontrol/handlers.go
package hscontrol import ( "bytes" "encoding/json" "errors" "fmt" "io" "net/http" "strconv" "strings" "time" "github.com/gorilla/mux" "github.com/juanfont/headscale/hscontrol/assets" "github.com/juanfont/headscale/hscontrol/templates" "github.com/juanfont/headscale/hscontrol/types" "github.com/rs/zerolo...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/auth_test.go
hscontrol/auth_test.go
package hscontrol import ( "context" "fmt" "net/url" "strings" "testing" "time" "github.com/juanfont/headscale/hscontrol/mapper" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/tailcfg" "tailscale.com/types/key" ) /...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
true
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/oidc_test.go
hscontrol/oidc_test.go
package hscontrol import ( "testing" "github.com/juanfont/headscale/hscontrol/types" ) func TestDoOIDCAuthorization(t *testing.T) { testCases := []struct { name string cfg *types.OIDCConfig claims *types.OIDCClaims wantErr bool }{ { name: "verified email domain", wantErr: false, cfg...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/dns_test.go
hscontrol/util/dns_test.go
package util import ( "net/netip" "strings" "testing" "github.com/stretchr/testify/assert" "tailscale.com/util/dnsname" "tailscale.com/util/must" ) func TestNormaliseHostname(t *testing.T) { type args struct { name string } tests := []struct { name string args args want string wantErr boo...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/file.go
hscontrol/util/file.go
package util import ( "errors" "fmt" "io/fs" "os" "path/filepath" "strconv" "strings" "github.com/spf13/viper" ) const ( Base8 = 8 Base10 = 10 BitSize16 = 16 BitSize32 = 32 BitSize64 = 64 PermissionFallback = 0o700 ) func AbsolutePathFromConfigPath(p...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/prompt_test.go
hscontrol/util/prompt_test.go
package util import ( "bytes" "io" "os" "strings" "testing" ) func TestYesNo(t *testing.T) { tests := []struct { name string input string expected bool }{ { name: "y answer", input: "y\n", expected: true, }, { name: "Y answer", input: "Y\n", expected: true, ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/net.go
hscontrol/util/net.go
package util import ( "context" "net" "net/netip" "sync" "go4.org/netipx" "tailscale.com/net/tsaddr" ) func GrpcSocketDialer(ctx context.Context, addr string) (net.Conn, error) { var d net.Dialer return d.DialContext(ctx, "unix", addr) } func PrefixesToString(prefixes []netip.Prefix) []string { ret := mak...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/addr.go
hscontrol/util/addr.go
package util import ( "fmt" "iter" "net/netip" "strings" "go4.org/netipx" ) // This is borrowed from, and updated to use IPSet // https://github.com/tailscale/tailscale/blob/71029cea2ddf82007b80f465b256d027eab0f02d/wgengine/filter/tailcfg.go#L97-L162 // TODO(kradalby): contribute upstream and make public. var (...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/util.go
hscontrol/util/util.go
package util import ( "cmp" "errors" "fmt" "net/netip" "net/url" "os" "regexp" "strconv" "strings" "time" "tailscale.com/tailcfg" "tailscale.com/util/cmpver" ) func TailscaleVersionNewerOrEqual(minimum, toCheck string) bool { if cmpver.Compare(minimum, toCheck) <= 0 || toCheck == "unstable" || toChe...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/dns.go
hscontrol/util/dns.go
package util import ( "errors" "fmt" "net/netip" "regexp" "strconv" "strings" "unicode" "go4.org/netipx" "tailscale.com/util/dnsname" ) const ( ByteSize = 8 ipv4AddressLength = 32 ipv6AddressLength = 128 // value related to RFC 1123 and 952. LabelHostnameLength = 63 ) var invalidDNSRegex = r...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/addr_test.go
hscontrol/util/addr_test.go
package util import ( "net/netip" "testing" "github.com/google/go-cmp/cmp" "go4.org/netipx" ) func Test_parseIPSet(t *testing.T) { set := func(ips []string, prefixes []string) *netipx.IPSet { var builder netipx.IPSetBuilder for _, ip := range ips { builder.Add(netip.MustParseAddr(ip)) } for _, pre ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/log.go
hscontrol/util/log.go
package util import ( "context" "errors" "time" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "gorm.io/gorm" gormLogger "gorm.io/gorm/logger" "tailscale.com/types/logger" ) func LogErr(err error, msg string) { log.Error().Caller().Err(err).Msg(msg) } func TSLogfWrapper() logger.Logf { return func(fo...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/const.go
hscontrol/util/const.go
package util const ( RegisterMethodAuthKey = "authkey" RegisterMethodOIDC = "oidc" RegisterMethodCLI = "cli" )
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/string.go
hscontrol/util/string.go
package util import ( "crypto/rand" "encoding/base64" "fmt" "strings" "tailscale.com/tailcfg" ) // GenerateRandomBytes returns securely generated random bytes. // It will return an error if the system's secure random // number generator fails to function correctly, in which // case the caller should not continu...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/test.go
hscontrol/util/test.go
package util import ( "net/netip" "github.com/google/go-cmp/cmp" "tailscale.com/types/ipproto" "tailscale.com/types/key" "tailscale.com/types/views" ) var PrefixComparer = cmp.Comparer(func(x, y netip.Prefix) bool { return x == y }) var IPComparer = cmp.Comparer(func(x, y netip.Addr) bool { return x.Compare(...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/prompt.go
hscontrol/util/prompt.go
package util import ( "fmt" "os" "strings" ) // YesNo takes a question and prompts the user to answer the // question with a yes or no. It appends a [y/n] to the message. // The question is written to stderr so that content can be redirected // without interfering with the prompt. func YesNo(msg string) bool { fm...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/key.go
hscontrol/util/key.go
package util import ( "errors" ) var ( ErrCannotDecryptResponse = errors.New("cannot decrypt response") ZstdCompression = "zstd" )
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/util_test.go
hscontrol/util/util_test.go
package util import ( "errors" "net/netip" "strings" "testing" "time" "github.com/google/go-cmp/cmp" "tailscale.com/tailcfg" ) func TestTailscaleVersionNewerOrEqual(t *testing.T) { type args struct { minimum string toCheck string } tests := []struct { name string args args want bool }{ { na...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
true
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/util/string_test.go
hscontrol/util/string_test.go
package util import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestGenerateRandomStringDNSSafe(t *testing.T) { for range 100000 { str, err := GenerateRandomStringDNSSafe(8) require.NoError(t, err) assert.Len(t, str, 8) } }
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/test_helpers.go
hscontrol/state/test_helpers.go
package state import ( "time" ) // Test configuration for NodeStore batching. // These values are optimized for test speed rather than production use. const ( TestBatchSize = 5 TestBatchTimeout = 5 * time.Millisecond )
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/ephemeral_test.go
hscontrol/state/ephemeral_test.go
package state import ( "net/netip" "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/types/ptr" ) // TestEphemeralNodeDeleteWithConcurrentUpdate tests the race condition where UpdateNode and DeleteNode // ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/node_store_test.go
hscontrol/state/node_store_test.go
package state import ( "context" "fmt" "net/netip" "runtime" "sync" "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/types/key" "tailscale.com/types/ptr" ) func TestSnapshotFromNodes(t *testing.T) { ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
true
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/tags.go
hscontrol/state/tags.go
package state import ( "errors" "fmt" "github.com/juanfont/headscale/hscontrol/types" "github.com/rs/zerolog/log" ) var ( // ErrNodeMarkedTaggedButHasNoTags is returned when a node is marked as tagged but has no tags. ErrNodeMarkedTaggedButHasNoTags = errors.New("node marked as tagged but has no tags") // Er...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/state.go
hscontrol/state/state.go
// Package state provides core state management for Headscale, coordinating // between subsystems like database, IP allocation, policy management, and DERP routing. package state import ( "cmp" "context" "errors" "fmt" "io" "net/netip" "os" "slices" "strings" "sync" "sync/atomic" "time" hsdb "github.com...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
true
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/node_store.go
hscontrol/state/node_store.go
package state import ( "fmt" "maps" "strings" "sync/atomic" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "tailscale.com/types/key" "tailscale.com/types/views" ) const ( put = 1 ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/debug_test.go
hscontrol/state/debug_test.go
package state import ( "testing" "github.com/stretchr/testify/assert" ) func TestNodeStoreDebugString(t *testing.T) { tests := []struct { name string setupFn func() *NodeStore contains []string }{ { name: "empty nodestore", setupFn: func() *NodeStore { return NewNodeStore(nil, allowAllPeer...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/debug.go
hscontrol/state/debug.go
package state import ( "fmt" "strings" "time" "github.com/juanfont/headscale/hscontrol/routes" "github.com/juanfont/headscale/hscontrol/types" "tailscale.com/tailcfg" ) // DebugOverviewInfo represents the state overview information in a structured format. type DebugOverviewInfo struct { Nodes struct { Total...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/endpoint_test.go
hscontrol/state/endpoint_test.go
package state import ( "net/netip" "testing" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/tailcfg" ) // TestEndpointStorageInNodeStore verifies that endpoints sent in MapRequest via ApplyPeerChange // are correctly sto...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/maprequest.go
hscontrol/state/maprequest.go
// Package state provides pure functions for processing MapRequest data. // These functions are extracted from UpdateNodeFromMapRequest to improve // testability and maintainability. package state import ( "github.com/juanfont/headscale/hscontrol/types" "github.com/rs/zerolog/log" "tailscale.com/tailcfg" ) // net...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/state/maprequest_test.go
hscontrol/state/maprequest_test.go
package state import ( "net/netip" "testing" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/tailcfg" "tailscale.com/types/key" "tailscale.com/types/ptr" ) func TestNetInfoFromMapRequest(t *testing.T) { nodeID := types...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/derp/derp.go
hscontrol/derp/derp.go
package derp import ( "cmp" "context" "encoding/json" "hash/crc64" "io" "maps" "math/rand" "net/http" "net/url" "os" "reflect" "slices" "sync" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/spf13/viper" "gopkg.in/yaml.v3" "tailscale.com/tailcfg" ) func loadDERPMapFromPath(path s...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/derp/derp_test.go
hscontrol/derp/derp_test.go
package derp import ( "testing" "github.com/google/go-cmp/cmp" "github.com/spf13/viper" "tailscale.com/tailcfg" ) func TestShuffleDERPMapDeterministic(t *testing.T) { tests := []struct { name string baseDomain string derpMap *tailcfg.DERPMap expected *tailcfg.DERPMap }{ { name: "s...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/derp/server/derp_server.go
hscontrol/derp/server/derp_server.go
package server import ( "bufio" "bytes" "context" "encoding/json" "fmt" "io" "net" "net/http" "net/netip" "net/url" "strconv" "strings" "time" "github.com/coder/websocket" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog/log" "tail...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/policy.go
hscontrol/db/policy.go
package db import ( "errors" "github.com/juanfont/headscale/hscontrol/types" "gorm.io/gorm" "gorm.io/gorm/clause" ) // SetPolicy sets the policy in the database. func (hsdb *HSDatabase) SetPolicy(policy string) (*types.Policy, error) { // Create a new policy. p := types.Policy{ Data: policy, } if err := h...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/ephemeral_garbage_collector_test.go
hscontrol/db/ephemeral_garbage_collector_test.go
package db import ( "runtime" "sync" "sync/atomic" "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" ) const ( fiveHundred = 500 * time.Millisecond oneHundred = 100 * time.Millisecond fifty = 50 * time.Millisecond ) // TestEphemeralGarbageCollecto...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/user_update_test.go
hscontrol/db/user_update_test.go
package db import ( "database/sql" "testing" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gorm.io/gorm" ) // TestUserUpdatePreservesUnchangedFields verifies that updating a user // preserves fields that aren't modified. This test va...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/users_test.go
hscontrol/db/users_test.go
package db import ( "testing" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gorm.io/gorm" "tailscale.com/types/ptr" ) func TestCreateAndDestroyUser(t *testing.T) { db, err := newSQLite...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/node.go
hscontrol/db/node.go
package db import ( "encoding/json" "errors" "fmt" "net/netip" "regexp" "slices" "sort" "strconv" "strings" "sync" "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog/log" "gorm.io/gorm" "tailscale.com/net/tsaddr" "ta...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/api_key.go
hscontrol/db/api_key.go
package db import ( "errors" "fmt" "strings" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "golang.org/x/crypto/bcrypt" "gorm.io/gorm" ) const ( apiKeyPrefix = "hskey-api-" //nolint:gosec // This is a prefix, not a credential apiKeyPrefixLength ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/text_serialiser.go
hscontrol/db/text_serialiser.go
package db import ( "context" "encoding" "fmt" "reflect" "gorm.io/gorm/schema" ) // Got from https://github.com/xdg-go/strum/blob/main/types.go var textUnmarshalerType = reflect.TypeFor[encoding.TextUnmarshaler]() func isTextUnmarshaler(rv reflect.Value) bool { return rv.Type().Implements(textUnmarshalerType)...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/node_test.go
hscontrol/db/node_test.go
package db import ( "crypto/rand" "fmt" "math/big" "net/netip" "regexp" "runtime" "sync" "sync/atomic" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/juanfont/headscale/hscontrol/policy" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github....
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/preauth_keys_test.go
hscontrol/db/preauth_keys_test.go
package db import ( "fmt" "slices" "strings" "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/types/ptr" ) func TestCreatePreAuthKey(t *testing.T) { test...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/preauth_keys.go
hscontrol/db/preauth_keys.go
package db import ( "errors" "fmt" "slices" "strings" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "golang.org/x/crypto/bcrypt" "gorm.io/gorm" "tailscale.com/util/set" ) var ( ErrPreAuthKeyNotFound = errors.New("auth-key not found") ErrPre...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/db_test.go
hscontrol/db/db_test.go
package db import ( "database/sql" "os" "os/exec" "path/filepath" "strings" "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gorm.io/gorm" "zgo.at/zcache/v2" ) // TestSQLiteMigrationAndDataValidation tests specifi...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/suite_test.go
hscontrol/db/suite_test.go
package db import ( "log" "net/url" "os" "strconv" "strings" "testing" "github.com/juanfont/headscale/hscontrol/types" "github.com/rs/zerolog" "gopkg.in/check.v1" "zombiezen.com/go/postgrestest" ) func Test(t *testing.T) { check.TestingT(t) } var _ = check.Suite(&Suite{}) type Suite struct{} var ( tmp...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/db.go
hscontrol/db/db.go
package db import ( "context" _ "embed" "encoding/json" "errors" "fmt" "net/netip" "path/filepath" "slices" "strconv" "time" "github.com/glebarez/sqlite" "github.com/go-gormigrate/gormigrate/v2" "github.com/juanfont/headscale/hscontrol/db/sqliteconfig" "github.com/juanfont/headscale/hscontrol/types" "g...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/api_key_test.go
hscontrol/db/api_key_test.go
package db import ( "strings" "testing" "time" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/crypto/bcrypt" "gopkg.in/check.v1" ) func (*Suite) TestCreateAPIKey(c *check.C) { apiKeyStr, apiKey, err := db.CreateAPIKey(...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/users.go
hscontrol/db/users.go
package db import ( "errors" "fmt" "strconv" "testing" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "gorm.io/gorm" ) var ( ErrUserExists = errors.New("user already exists") ErrUserNotFound = errors.New("user not found") ErrUserStillHasNodes = er...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/ip_test.go
hscontrol/db/ip_test.go
package db import ( "fmt" "net/netip" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscal...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/ip.go
hscontrol/db/ip.go
package db import ( "crypto/rand" "database/sql" "errors" "fmt" "math/big" "net/netip" "sync" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog/log" "go4.org/netipx" "gorm.io/gorm" "tailscale.com/net/tsaddr" ) var errGeneratedIPBytesInv...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/sqliteconfig/config.go
hscontrol/db/sqliteconfig/config.go
// Package sqliteconfig provides type-safe configuration for SQLite databases // with proper enum validation and URL generation for modernc.org/sqlite driver. package sqliteconfig import ( "errors" "fmt" "strings" ) // Errors returned by config validation. var ( ErrPathEmpty = errors.New("path cannot be...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/sqliteconfig/config_test.go
hscontrol/db/sqliteconfig/config_test.go
package sqliteconfig import ( "testing" ) func TestJournalMode(t *testing.T) { tests := []struct { mode JournalMode valid bool }{ {JournalModeWAL, true}, {JournalModeDelete, true}, {JournalModeTruncate, true}, {JournalModePersist, true}, {JournalModeMemory, true}, {JournalModeOff, true}, {Journa...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/db/sqliteconfig/integration_test.go
hscontrol/db/sqliteconfig/integration_test.go
package sqliteconfig import ( "database/sql" "path/filepath" "strings" "testing" _ "modernc.org/sqlite" ) const memoryDBPath = ":memory:" // TestSQLiteDriverPragmaIntegration verifies that the modernc.org/sqlite driver // correctly applies all pragma settings from URL parameters, ensuring they work // the same...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/routes/primary.go
hscontrol/routes/primary.go
package routes import ( "fmt" "net/netip" "slices" "sort" "strings" "sync" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog/log" xmaps "golang.org/x/exp/maps" "tailscale.com/net/tsaddr" "tailscale.com/util/set" ) type PrimaryRoutes stru...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/routes/primary_test.go
hscontrol/routes/primary_test.go
package routes import ( "net/netip" "sync" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/juanfont/headscale/hscontrol/types" "github.com/juanfont/headscale/hscontrol/util" "tailscale.com/util/set" ) // mp is a helper function that wraps netip.MustParsePrefix. fun...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/types_clone.go
hscontrol/types/types_clone.go
// Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause // Code generated by tailscale.com/cmd/cloner; DO NOT EDIT. package types import ( "database/sql" "net/netip" "time" "gorm.io/gorm" "tailscale.com/tailcfg" "tailscale.com/types/key" "tailscale.com/types/ptr" ) // Clone makes a...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/policy.go
hscontrol/types/policy.go
package types import ( "errors" "gorm.io/gorm" ) var ( ErrPolicyNotFound = errors.New("acl policy not found") ErrPolicyUpdateIsDisabled = errors.New("update is disabled for modes other than 'database'") ) // Policy represents a policy in the database. type Policy struct { gorm.Model // Data contains ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/common_test.go
hscontrol/types/common_test.go
package types import ( "testing" ) func TestDefaultBatcherWorkersFor(t *testing.T) { tests := []struct { cpuCount int expected int }{ {1, 1}, // (1*3)/4 = 0, should be minimum 1 {2, 1}, // (2*3)/4 = 1 {4, 3}, // (4*3)/4 = 3 {8, 6}, // (8*3)/4 = 6 {12, 9}, // (12*3)/4 = 9 {16, 12}, // (16*3...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/users_test.go
hscontrol/types/users_test.go
package types import ( "database/sql" "encoding/json" "testing" "github.com/google/go-cmp/cmp" "github.com/juanfont/headscale/hscontrol/util" "github.com/stretchr/testify/assert" ) func TestUnmarshallOIDCClaims(t *testing.T) { tests := []struct { name string jsonstr string want OIDCClaims }{ { ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/node.go
hscontrol/types/node.go
package types import ( "errors" "fmt" "net/netip" "regexp" "slices" "strconv" "strings" "time" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/juanfont/headscale/hscontrol/policy/matcher" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog/log" "go4.org/netipx" "goog...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/preauth_key.go
hscontrol/types/preauth_key.go
package types import ( "time" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/rs/zerolog/log" "google.golang.org/protobuf/types/known/timestamppb" ) type PAKError string func (e PAKError) Error() string { return string(e) } // PreAuthKey describes a pre-authorization key usable in a particul...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/api_key.go
hscontrol/types/api_key.go
package types import ( "time" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "google.golang.org/protobuf/types/known/timestamppb" ) const ( // NewAPIKeyPrefixLength is the length of the prefix for new API keys. NewAPIKeyPrefixLength = 12 // LegacyAPIKeyPrefixLength is the length of the prefix for legac...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/config.go
hscontrol/types/config.go
package types import ( "errors" "fmt" "io/fs" "net/netip" "net/url" "os" "strings" "time" "github.com/coreos/go-oidc/v3/oidc" "github.com/juanfont/headscale/hscontrol/util" "github.com/prometheus/common/model" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/viper" "go4.org/netipx"...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
true
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/node_tags_test.go
hscontrol/types/node_tags_test.go
package types import ( "testing" "github.com/juanfont/headscale/hscontrol/util" "github.com/stretchr/testify/assert" "gorm.io/gorm" "tailscale.com/types/ptr" ) // TestNodeIsTagged tests the IsTagged() method for determining if a node is tagged. func TestNodeIsTagged(t *testing.T) { tests := []struct { name s...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/node_test.go
hscontrol/types/node_test.go
package types import ( "fmt" "net/netip" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/juanfont/headscale/hscontrol/policy/matcher" "github.com/juanfont/headscale/hscontrol/util" "tailscale.com/tai...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/types_view.go
hscontrol/types/types_view.go
// Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause // Code generated by tailscale/cmd/viewer; DO NOT EDIT. package types import ( "database/sql" "encoding/json" "errors" "net/netip" "time" "gorm.io/gorm" "tailscale.com/tailcfg" "tailscale.com/types/key" "tailscale.com/types/v...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/config_test.go
hscontrol/types/config_test.go
package types import ( "fmt" "os" "path/filepath" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "tailscale.com/tailcfg" "tailscale.com/types/dnstype" ) func TestReadConfig(...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/const.go
hscontrol/types/const.go
package types import "time" const ( HTTPTimeout = 30 * time.Second HTTPShutdownTimeout = 3 * time.Second TLSALPN01ChallengeType = "TLS-ALPN-01" HTTP01ChallengeType = "HTTP-01" JSONLogFormat = "json" TextLogFormat = "text" KeepAliveInterval = 60 * time.Second MaxHostnameLength = 255 )
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/preauth_key_test.go
hscontrol/types/preauth_key_test.go
package types import ( "errors" "testing" "time" "github.com/google/go-cmp/cmp" ) func TestCanUsePreAuthKey(t *testing.T) { now := time.Now() past := now.Add(-time.Hour) future := now.Add(time.Hour) tests := []struct { name string pak *PreAuthKey wantErr bool err PAKError }{ { name:...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/version.go
hscontrol/types/version.go
package types import ( "fmt" "runtime" "runtime/debug" "strings" "sync" ) type GoInfo struct { Version string `json:"version"` OS string `json:"os"` Arch string `json:"arch"` } type VersionInfo struct { Version string `json:"version"` Commit string `json:"commit"` BuildTime string `json:"buil...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/users.go
hscontrol/types/users.go
package types import ( "cmp" "database/sql" "encoding/json" "fmt" "net/mail" "net/url" "strconv" "strings" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/juanfont/headscale/hscontrol/util" "github.com/rs/zerolog/log" "google.golang.org/protobuf/types/known/timestamppb" "gorm.io/gorm" ...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/routes.go
hscontrol/types/routes.go
package types import ( "net/netip" "gorm.io/gorm" ) // Deprecated: Approval of routes is denormalised onto the relevant node. // Struct is kept for GORM migrations only. type Route struct { gorm.Model NodeID uint64 `gorm:"not null"` Node *Node Prefix netip.Prefix `gorm:"serializer:text"` // Advertised is...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/common.go
hscontrol/types/common.go
//go:generate go tool viewer --type=User,Node,PreAuthKey package types //go:generate go run tailscale.com/cmd/viewer --type=User,Node,PreAuthKey import ( "errors" "fmt" "runtime" "sync/atomic" "time" "github.com/juanfont/headscale/hscontrol/util" "tailscale.com/tailcfg" ) const ( SelfUpdateIdentifier = "sel...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/change/change.go
hscontrol/types/change/change.go
package change import ( "slices" "time" "github.com/juanfont/headscale/hscontrol/types" "tailscale.com/tailcfg" ) // Change declares what should be included in a MapResponse. // The mapper uses this to build the response without guessing. type Change struct { // Reason is a human-readable description for loggin...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/types/change/change_test.go
hscontrol/types/change/change_test.go
package change import ( "reflect" "testing" "github.com/juanfont/headscale/hscontrol/types" "github.com/stretchr/testify/assert" "tailscale.com/tailcfg" ) func TestChange_FieldSync(t *testing.T) { r := Change{} fieldNames := r.boolFieldNames() typ := reflect.TypeFor[Change]() boolCount := 0 for i := rang...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/capver/capver_generated.go
hscontrol/capver/capver_generated.go
package capver // Generated DO NOT EDIT import "tailscale.com/tailcfg" var tailscaleToCapVer = map[string]tailcfg.CapabilityVersion{ "v1.24": 32, "v1.26": 32, "v1.28": 32, "v1.30": 41, "v1.32": 46, "v1.34": 51, "v1.36": 56, "v1.38": 58, "v1.40": 61, "v1.42": 62, "v1.44": 63, "v1.46": 65, "v1.48": 68, "...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/capver/capver_test_data.go
hscontrol/capver/capver_test_data.go
package capver // Generated DO NOT EDIT import "tailscale.com/tailcfg" var tailscaleLatestMajorMinorTests = []struct { n int stripV bool expected []string }{ {3, false, []string{"v1.88", "v1.90", "v1.92"}}, {2, true, []string{"1.90", "1.92"}}, {10, true, []string{ "1.74", "1.76", "1.78", "1.80...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/capver/capver.go
hscontrol/capver/capver.go
package capver //go:generate go run ../../tools/capver/main.go import ( "slices" "sort" "strings" xmaps "golang.org/x/exp/maps" "tailscale.com/tailcfg" "tailscale.com/util/set" ) const ( // minVersionParts is the minimum number of version parts needed for major.minor. minVersionParts = 2 // legacyDERPCapV...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/capver/capver_test.go
hscontrol/capver/capver_test.go
package capver import ( "testing" "github.com/google/go-cmp/cmp" ) func TestTailscaleLatestMajorMinor(t *testing.T) { for _, test := range tailscaleLatestMajorMinorTests { t.Run("", func(t *testing.T) { output := TailscaleLatestMajorMinor(test.n, test.stripV) if diff := cmp.Diff(output, test.expected); di...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/assets/assets.go
hscontrol/assets/assets.go
// Package assets provides embedded static assets for Headscale. // All static files (favicon, CSS, SVG) are embedded here for // centralized asset management. package assets import ( _ "embed" ) // Favicon is the embedded favicon.png file served at /favicon.ico // //go:embed favicon.png var Favicon []byte // CSS i...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/dns/extrarecords.go
hscontrol/dns/extrarecords.go
package dns import ( "context" "crypto/sha256" "encoding/json" "fmt" "os" "sync" "github.com/cenkalti/backoff/v5" "github.com/fsnotify/fsnotify" "github.com/rs/zerolog/log" "tailscale.com/tailcfg" "tailscale.com/util/set" ) type ExtraRecordsMan struct { mu sync.RWMutex records set.Set[tailcfg.DNSRe...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false
juanfont/headscale
https://github.com/juanfont/headscale/blob/84c092a9f9875ed274aa40c9c14ebbcb05166f43/hscontrol/templates/windows.go
hscontrol/templates/windows.go
package templates import ( "github.com/chasefleming/elem-go" ) func Windows(url string) *elem.Element { return HtmlStructure( elem.Title(nil, elem.Text("headscale - Windows"), ), mdTypesetBody( headscaleLogo(), H1(elem.Text("Windows configuration")), P( elem.Text("Download "), externalLink...
go
BSD-3-Clause
84c092a9f9875ed274aa40c9c14ebbcb05166f43
2026-01-07T08:36:04.247985Z
false