mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-17 06:19:51 +02:00
Compare commits
7 Commits
v0.23.0-al
...
v0.23.0-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cedc2942b | ||
|
|
062b9a5611 | ||
|
|
887302e8f1 | ||
|
|
b1b90d165d | ||
|
|
4ea12f472a | ||
|
|
b4210e2c90 | ||
|
|
a369d57a17 |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -20,6 +20,6 @@ jobs:
|
|||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
- name: Run goreleaser
|
- name: Run goreleaser
|
||||||
run: nix develop --command -- goreleaser release --clean
|
run: nix develop --command -- goreleaser release --clean --verbose
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ builds:
|
|||||||
env:
|
env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
targets:
|
targets:
|
||||||
- darwin_amd64
|
# - darwin_amd64
|
||||||
- darwin_arm64
|
# - darwin_arm64
|
||||||
- freebsd_amd64
|
# - freebsd_amd64
|
||||||
- linux_386
|
# - linux_386
|
||||||
- linux_amd64
|
- linux_amd64
|
||||||
- linux_arm64
|
# - linux_arm64
|
||||||
- linux_arm_5
|
# - linux_arm_5
|
||||||
- linux_arm_6
|
# - linux_arm_6
|
||||||
- linux_arm_7
|
# - linux_arm_7
|
||||||
flags:
|
flags:
|
||||||
- -mod=readonly
|
- -mod=readonly
|
||||||
ldflags:
|
ldflags:
|
||||||
@@ -63,7 +63,6 @@ nfpms:
|
|||||||
bindir: /usr/bin
|
bindir: /usr/bin
|
||||||
formats:
|
formats:
|
||||||
- deb
|
- deb
|
||||||
# - rpm
|
|
||||||
contents:
|
contents:
|
||||||
- src: ./config-example.yaml
|
- src: ./config-example.yaml
|
||||||
dst: /etc/headscale/config.yaml
|
dst: /etc/headscale/config.yaml
|
||||||
@@ -80,6 +79,38 @@ nfpms:
|
|||||||
postinstall: ./docs/packaging/postinstall.sh
|
postinstall: ./docs/packaging/postinstall.sh
|
||||||
postremove: ./docs/packaging/postremove.sh
|
postremove: ./docs/packaging/postremove.sh
|
||||||
|
|
||||||
|
kos:
|
||||||
|
- id: ghcr
|
||||||
|
build: headscale
|
||||||
|
base_image: gcr.io/distroless/base-debian11
|
||||||
|
repository: ghcr.io/juanfont/headscale
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
# - linux/386
|
||||||
|
# - linux/arm64
|
||||||
|
# - linux/arm/v7
|
||||||
|
# - linux/arm/v6
|
||||||
|
# - linux/arm/v5
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- '{{.Tag}}'
|
||||||
|
- '{{ .Major }}.{{ .Minor }}'
|
||||||
|
- '{{ .Major }}'
|
||||||
|
# - id: dockerhub
|
||||||
|
# build: headscale
|
||||||
|
# base_image: gcr.io/distroless/base-debian11
|
||||||
|
# repository: headscale/headscale
|
||||||
|
# platforms:
|
||||||
|
# - linux/amd64
|
||||||
|
# - linux/386
|
||||||
|
# - linux/arm64
|
||||||
|
# - linux/arm/v7
|
||||||
|
# - linux/arm/v6
|
||||||
|
# - linux/arm/v5
|
||||||
|
# tags:
|
||||||
|
# - latest
|
||||||
|
# - '{{.Tag}}'
|
||||||
|
|
||||||
checksum:
|
checksum:
|
||||||
name_template: "checksums.txt"
|
name_template: "checksums.txt"
|
||||||
snapshot:
|
snapshot:
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
# Builder image
|
# This Dockerfile and the images produced are for testing headscale,
|
||||||
|
# and are in no way endorsed by Headscale's maintainers as an
|
||||||
|
# official nor supported release or distribution.
|
||||||
|
|
||||||
FROM docker.io/golang:1.21-bookworm AS build
|
FROM docker.io/golang:1.21-bookworm AS build
|
||||||
ARG VERSION=dev
|
ARG VERSION=dev
|
||||||
ENV GOPATH /go
|
ENV GOPATH /go
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
# Builder image
|
# This Dockerfile and the images produced are for testing headscale,
|
||||||
|
# and are in no way endorsed by Headscale's maintainers as an
|
||||||
|
# official nor supported release or distribution.
|
||||||
|
|
||||||
FROM docker.io/golang:1.21-bookworm AS build
|
FROM docker.io/golang:1.21-bookworm AS build
|
||||||
ARG VERSION=dev
|
ARG VERSION=dev
|
||||||
ENV GOPATH /go
|
ENV GOPATH /go
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# This Dockerfile and the images produced are for testing headscale,
|
||||||
|
# and are in no way endorsed by Headscale's maintainers as an
|
||||||
|
# official nor supported release or distribution.
|
||||||
|
|
||||||
FROM golang:latest
|
FROM golang:latest
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
|
|||||||
@@ -900,7 +900,7 @@ func (hsdb *HSDatabase) ExpireExpiredNodes(lastCheck time.Time) time.Time {
|
|||||||
// Do not use setNodeExpiry as that has a notifier hook, which
|
// Do not use setNodeExpiry as that has a notifier hook, which
|
||||||
// can cause a deadlock, we are updating all changed nodes later
|
// can cause a deadlock, we are updating all changed nodes later
|
||||||
// and there is no point in notifiying twice.
|
// and there is no point in notifiying twice.
|
||||||
if err := hsdb.db.Model(nodes[index]).Updates(types.Node{
|
if err := hsdb.db.Model(&nodes[index]).Updates(types.Node{
|
||||||
Expiry: &started,
|
Expiry: &started,
|
||||||
}).Error; err != nil {
|
}).Error; err != nil {
|
||||||
log.Error().
|
log.Error().
|
||||||
|
|||||||
@@ -585,6 +585,10 @@ func (hsdb *HSDatabase) failoverRoute(r *types.Route) ([]key.MachinePublic, erro
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !route.Enabled {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if hsdb.notifier.IsConnected(route.Node.MachineKey) {
|
if hsdb.notifier.IsConnected(route.Node.MachineKey) {
|
||||||
newPrimary = &routes[idx]
|
newPrimary = &routes[idx]
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
routes: types.Routes{
|
routes: types.Routes{
|
||||||
types.Route{
|
types.Route{
|
||||||
@@ -382,6 +383,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
types.Route{
|
types.Route{
|
||||||
Model: gorm.Model{
|
Model: gorm.Model{
|
||||||
@@ -392,6 +394,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[1],
|
MachineKey: machineKeys[1],
|
||||||
},
|
},
|
||||||
IsPrimary: false,
|
IsPrimary: false,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: []key.MachinePublic{
|
want: []key.MachinePublic{
|
||||||
@@ -411,6 +414,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: false,
|
IsPrimary: false,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
routes: types.Routes{
|
routes: types.Routes{
|
||||||
types.Route{
|
types.Route{
|
||||||
@@ -422,6 +426,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
types.Route{
|
types.Route{
|
||||||
Model: gorm.Model{
|
Model: gorm.Model{
|
||||||
@@ -432,6 +437,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[1],
|
MachineKey: machineKeys[1],
|
||||||
},
|
},
|
||||||
IsPrimary: false,
|
IsPrimary: false,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: nil,
|
want: nil,
|
||||||
@@ -448,6 +454,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[1],
|
MachineKey: machineKeys[1],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
routes: types.Routes{
|
routes: types.Routes{
|
||||||
types.Route{
|
types.Route{
|
||||||
@@ -459,6 +466,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: false,
|
IsPrimary: false,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
types.Route{
|
types.Route{
|
||||||
Model: gorm.Model{
|
Model: gorm.Model{
|
||||||
@@ -469,6 +477,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[1],
|
MachineKey: machineKeys[1],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
types.Route{
|
types.Route{
|
||||||
Model: gorm.Model{
|
Model: gorm.Model{
|
||||||
@@ -479,6 +488,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[2],
|
MachineKey: machineKeys[2],
|
||||||
},
|
},
|
||||||
IsPrimary: false,
|
IsPrimary: false,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: []key.MachinePublic{
|
want: []key.MachinePublic{
|
||||||
@@ -498,6 +508,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
routes: types.Routes{
|
routes: types.Routes{
|
||||||
types.Route{
|
types.Route{
|
||||||
@@ -509,6 +520,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
// Offline
|
// Offline
|
||||||
types.Route{
|
types.Route{
|
||||||
@@ -520,6 +532,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[3],
|
MachineKey: machineKeys[3],
|
||||||
},
|
},
|
||||||
IsPrimary: false,
|
IsPrimary: false,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: nil,
|
want: nil,
|
||||||
@@ -536,6 +549,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
routes: types.Routes{
|
routes: types.Routes{
|
||||||
types.Route{
|
types.Route{
|
||||||
@@ -547,6 +561,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[0],
|
MachineKey: machineKeys[0],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
// Offline
|
// Offline
|
||||||
types.Route{
|
types.Route{
|
||||||
@@ -558,6 +573,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[3],
|
MachineKey: machineKeys[3],
|
||||||
},
|
},
|
||||||
IsPrimary: false,
|
IsPrimary: false,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
types.Route{
|
types.Route{
|
||||||
Model: gorm.Model{
|
Model: gorm.Model{
|
||||||
@@ -568,6 +584,7 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
MachineKey: machineKeys[1],
|
MachineKey: machineKeys[1],
|
||||||
},
|
},
|
||||||
IsPrimary: true,
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: []key.MachinePublic{
|
want: []key.MachinePublic{
|
||||||
@@ -576,6 +593,47 @@ func TestFailoverRoute(t *testing.T) {
|
|||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "failover-primary-none-enabled",
|
||||||
|
failingRoute: types.Route{
|
||||||
|
Model: gorm.Model{
|
||||||
|
ID: 1,
|
||||||
|
},
|
||||||
|
Prefix: ipp("10.0.0.0/24"),
|
||||||
|
Node: types.Node{
|
||||||
|
MachineKey: machineKeys[0],
|
||||||
|
},
|
||||||
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
|
routes: types.Routes{
|
||||||
|
types.Route{
|
||||||
|
Model: gorm.Model{
|
||||||
|
ID: 1,
|
||||||
|
},
|
||||||
|
Prefix: ipp("10.0.0.0/24"),
|
||||||
|
Node: types.Node{
|
||||||
|
MachineKey: machineKeys[0],
|
||||||
|
},
|
||||||
|
IsPrimary: true,
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
|
// not enabled
|
||||||
|
types.Route{
|
||||||
|
Model: gorm.Model{
|
||||||
|
ID: 2,
|
||||||
|
},
|
||||||
|
Prefix: ipp("10.0.0.0/24"),
|
||||||
|
Node: types.Node{
|
||||||
|
MachineKey: machineKeys[1],
|
||||||
|
},
|
||||||
|
IsPrimary: false,
|
||||||
|
Enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: nil,
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ func GetHeadscaleConfig() (*Config, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
oidcClientSecret = string(secretBytes)
|
oidcClientSecret = strings.TrimSpace(string(secretBytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Config{
|
return &Config{
|
||||||
|
|||||||
Reference in New Issue
Block a user