mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Compare commits
3 commits
ecdaa34c32
...
3a82193c2a
Author | SHA1 | Date | |
---|---|---|---|
|
3a82193c2a | ||
|
e2d5ee0927 | ||
|
0058a90ae9 |
9 changed files with 14 additions and 32 deletions
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
|
@ -13,6 +13,7 @@ permissions:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
if: github.repository == 'juanfont/headscale'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -36,6 +37,7 @@ jobs:
|
||||||
path: ./site
|
path: ./site
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
if: github.repository == 'juanfont/headscale'
|
||||||
environment:
|
environment:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
1
.github/workflows/gh-actions-updater.yaml
vendored
1
.github/workflows/gh-actions-updater.yaml
vendored
|
@ -7,6 +7,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
if: github.repository == 'juanfont/headscale'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
|
@ -9,6 +9,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
|
if: github.repository == 'juanfont/headscale'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
1
.github/workflows/stale.yml
vendored
1
.github/workflows/stale.yml
vendored
|
@ -6,6 +6,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
close-issues:
|
close-issues:
|
||||||
|
if: github.repository == 'juanfont/headscale'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
|
|
1
.github/workflows/update-flake.yml
vendored
1
.github/workflows/update-flake.yml
vendored
|
@ -6,6 +6,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lockfile:
|
lockfile:
|
||||||
|
if: github.repository == 'juanfont/headscale'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
|
@ -111,9 +111,7 @@ func generateUserProfiles(
|
||||||
|
|
||||||
func generateDNSConfig(
|
func generateDNSConfig(
|
||||||
cfg *types.Config,
|
cfg *types.Config,
|
||||||
baseDomain string,
|
|
||||||
node *types.Node,
|
node *types.Node,
|
||||||
peers types.Nodes,
|
|
||||||
) *tailcfg.DNSConfig {
|
) *tailcfg.DNSConfig {
|
||||||
if cfg.DNSConfig == nil {
|
if cfg.DNSConfig == nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -532,12 +530,7 @@ func appendPeerChanges(
|
||||||
|
|
||||||
profiles := generateUserProfiles(node, changed)
|
profiles := generateUserProfiles(node, changed)
|
||||||
|
|
||||||
dnsConfig := generateDNSConfig(
|
dnsConfig := generateDNSConfig(cfg, node)
|
||||||
cfg,
|
|
||||||
cfg.BaseDomain,
|
|
||||||
node,
|
|
||||||
peers,
|
|
||||||
)
|
|
||||||
|
|
||||||
tailPeers, err := tailNodes(changed, capVer, pol, cfg)
|
tailPeers, err := tailNodes(changed, capVer, pol, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -114,24 +114,12 @@ func TestDNSConfigMapResponse(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeInShared1 := mach("test_get_shared_nodes_1", "shared1", 1)
|
nodeInShared1 := mach("test_get_shared_nodes_1", "shared1", 1)
|
||||||
nodeInShared2 := mach("test_get_shared_nodes_2", "shared2", 2)
|
|
||||||
nodeInShared3 := mach("test_get_shared_nodes_3", "shared3", 3)
|
|
||||||
node2InShared1 := mach("test_get_shared_nodes_4", "shared1", 1)
|
|
||||||
|
|
||||||
peersOfNodeInShared1 := types.Nodes{
|
|
||||||
nodeInShared1,
|
|
||||||
nodeInShared2,
|
|
||||||
nodeInShared3,
|
|
||||||
node2InShared1,
|
|
||||||
}
|
|
||||||
|
|
||||||
got := generateDNSConfig(
|
got := generateDNSConfig(
|
||||||
&types.Config{
|
&types.Config{
|
||||||
DNSConfig: &dnsConfigOrig,
|
DNSConfig: &dnsConfigOrig,
|
||||||
},
|
},
|
||||||
baseDomain,
|
|
||||||
nodeInShared1,
|
nodeInShared1,
|
||||||
peersOfNodeInShared1,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if diff := cmp.Diff(tt.want, got, cmpopts.EquateEmpty()); diff != "" {
|
if diff := cmp.Diff(tt.want, got, cmpopts.EquateEmpty()); diff != "" {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"github.com/juanfont/headscale/hscontrol/types"
|
"github.com/juanfont/headscale/hscontrol/types"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
"golang.org/x/net/http2/h2c"
|
|
||||||
"tailscale.com/control/controlbase"
|
"tailscale.com/control/controlbase"
|
||||||
"tailscale.com/control/controlhttp"
|
"tailscale.com/control/controlhttp"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
|
@ -101,18 +100,12 @@ func (h *Headscale) NoiseUpgradeHandler(
|
||||||
Methods(http.MethodPost)
|
Methods(http.MethodPost)
|
||||||
router.HandleFunc("/machine/map", noiseServer.NoisePollNetMapHandler)
|
router.HandleFunc("/machine/map", noiseServer.NoisePollNetMapHandler)
|
||||||
|
|
||||||
server := http.Server{
|
|
||||||
ReadTimeout: types.HTTPTimeout,
|
|
||||||
}
|
|
||||||
|
|
||||||
noiseServer.httpBaseConfig = &http.Server{
|
noiseServer.httpBaseConfig = &http.Server{
|
||||||
Handler: router,
|
Handler: router,
|
||||||
ReadHeaderTimeout: types.HTTPTimeout,
|
ReadHeaderTimeout: types.HTTPTimeout,
|
||||||
}
|
}
|
||||||
noiseServer.http2Server = &http2.Server{}
|
noiseServer.http2Server = &http2.Server{}
|
||||||
|
|
||||||
server.Handler = h2c.NewHandler(router, noiseServer.http2Server)
|
|
||||||
|
|
||||||
noiseServer.http2Server.ServeConn(
|
noiseServer.http2Server.ServeConn(
|
||||||
noiseConn,
|
noiseConn,
|
||||||
&http2.ServeConnOpts{
|
&http2.ServeConnOpts{
|
||||||
|
|
|
@ -22,6 +22,8 @@ import (
|
||||||
"tailscale.com/wgengine/filter"
|
"tailscale.com/wgengine/filter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var allPorts = filter.PortRange{First: 0, Last: 0xffff}
|
||||||
|
|
||||||
// This test is both testing the routes command and the propagation of
|
// This test is both testing the routes command and the propagation of
|
||||||
// routes.
|
// routes.
|
||||||
func TestEnablingRoutes(t *testing.T) {
|
func TestEnablingRoutes(t *testing.T) {
|
||||||
|
@ -1249,11 +1251,11 @@ func TestSubnetRouteACL(t *testing.T) {
|
||||||
Dsts: []filter.NetPortRange{
|
Dsts: []filter.NetPortRange{
|
||||||
{
|
{
|
||||||
Net: netip.MustParsePrefix("100.64.0.2/32"),
|
Net: netip.MustParsePrefix("100.64.0.2/32"),
|
||||||
Ports: filter.PortRange{0, 0xffff},
|
Ports: allPorts,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Net: netip.MustParsePrefix("fd7a:115c:a1e0::2/128"),
|
Net: netip.MustParsePrefix("fd7a:115c:a1e0::2/128"),
|
||||||
Ports: filter.PortRange{0, 0xffff},
|
Ports: allPorts,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Caps: []filter.CapMatch{},
|
Caps: []filter.CapMatch{},
|
||||||
|
@ -1281,11 +1283,11 @@ func TestSubnetRouteACL(t *testing.T) {
|
||||||
Dsts: []filter.NetPortRange{
|
Dsts: []filter.NetPortRange{
|
||||||
{
|
{
|
||||||
Net: netip.MustParsePrefix("100.64.0.1/32"),
|
Net: netip.MustParsePrefix("100.64.0.1/32"),
|
||||||
Ports: filter.PortRange{0, 0xffff},
|
Ports: allPorts,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Net: netip.MustParsePrefix("fd7a:115c:a1e0::1/128"),
|
Net: netip.MustParsePrefix("fd7a:115c:a1e0::1/128"),
|
||||||
Ports: filter.PortRange{0, 0xffff},
|
Ports: allPorts,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Caps: []filter.CapMatch{},
|
Caps: []filter.CapMatch{},
|
||||||
|
@ -1303,7 +1305,7 @@ func TestSubnetRouteACL(t *testing.T) {
|
||||||
Dsts: []filter.NetPortRange{
|
Dsts: []filter.NetPortRange{
|
||||||
{
|
{
|
||||||
Net: netip.MustParsePrefix("10.33.0.0/16"),
|
Net: netip.MustParsePrefix("10.33.0.0/16"),
|
||||||
Ports: filter.PortRange{0, 0xffff},
|
Ports: allPorts,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Caps: []filter.CapMatch{},
|
Caps: []filter.CapMatch{},
|
||||||
|
|
Loading…
Reference in a new issue