mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
Compare commits
1 commit
16ee1d7262
...
96a0b1ee0d
Author | SHA1 | Date | |
---|---|---|---|
|
96a0b1ee0d |
4 changed files with 32 additions and 8 deletions
|
@ -111,7 +111,9 @@ func generateUserProfiles(
|
|||
|
||||
func generateDNSConfig(
|
||||
cfg *types.Config,
|
||||
baseDomain string,
|
||||
node *types.Node,
|
||||
peers types.Nodes,
|
||||
) *tailcfg.DNSConfig {
|
||||
if cfg.DNSConfig == nil {
|
||||
return nil
|
||||
|
@ -530,7 +532,12 @@ func appendPeerChanges(
|
|||
|
||||
profiles := generateUserProfiles(node, changed)
|
||||
|
||||
dnsConfig := generateDNSConfig(cfg, node)
|
||||
dnsConfig := generateDNSConfig(
|
||||
cfg,
|
||||
cfg.BaseDomain,
|
||||
node,
|
||||
peers,
|
||||
)
|
||||
|
||||
tailPeers, err := tailNodes(changed, capVer, pol, cfg)
|
||||
if err != nil {
|
||||
|
|
|
@ -114,12 +114,24 @@ func TestDNSConfigMapResponse(t *testing.T) {
|
|||
}
|
||||
|
||||
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(
|
||||
&types.Config{
|
||||
DNSConfig: &dnsConfigOrig,
|
||||
},
|
||||
baseDomain,
|
||||
nodeInShared1,
|
||||
peersOfNodeInShared1,
|
||||
)
|
||||
|
||||
if diff := cmp.Diff(tt.want, got, cmpopts.EquateEmpty()); diff != "" {
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/juanfont/headscale/hscontrol/types"
|
||||
"github.com/rs/zerolog/log"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
"tailscale.com/control/controlbase"
|
||||
"tailscale.com/control/controlhttp"
|
||||
"tailscale.com/tailcfg"
|
||||
|
@ -100,12 +101,18 @@ func (h *Headscale) NoiseUpgradeHandler(
|
|||
Methods(http.MethodPost)
|
||||
router.HandleFunc("/machine/map", noiseServer.NoisePollNetMapHandler)
|
||||
|
||||
server := http.Server{
|
||||
ReadTimeout: types.HTTPTimeout,
|
||||
}
|
||||
|
||||
noiseServer.httpBaseConfig = &http.Server{
|
||||
Handler: router,
|
||||
ReadHeaderTimeout: types.HTTPTimeout,
|
||||
}
|
||||
noiseServer.http2Server = &http2.Server{}
|
||||
|
||||
server.Handler = h2c.NewHandler(router, noiseServer.http2Server)
|
||||
|
||||
noiseServer.http2Server.ServeConn(
|
||||
noiseConn,
|
||||
&http2.ServeConnOpts{
|
||||
|
|
|
@ -22,8 +22,6 @@ import (
|
|||
"tailscale.com/wgengine/filter"
|
||||
)
|
||||
|
||||
var allPorts = filter.PortRange{First: 0, Last: 0xffff}
|
||||
|
||||
// This test is both testing the routes command and the propagation of
|
||||
// routes.
|
||||
func TestEnablingRoutes(t *testing.T) {
|
||||
|
@ -1251,11 +1249,11 @@ func TestSubnetRouteACL(t *testing.T) {
|
|||
Dsts: []filter.NetPortRange{
|
||||
{
|
||||
Net: netip.MustParsePrefix("100.64.0.2/32"),
|
||||
Ports: allPorts,
|
||||
Ports: filter.PortRange{0, 0xffff},
|
||||
},
|
||||
{
|
||||
Net: netip.MustParsePrefix("fd7a:115c:a1e0::2/128"),
|
||||
Ports: allPorts,
|
||||
Ports: filter.PortRange{0, 0xffff},
|
||||
},
|
||||
},
|
||||
Caps: []filter.CapMatch{},
|
||||
|
@ -1283,11 +1281,11 @@ func TestSubnetRouteACL(t *testing.T) {
|
|||
Dsts: []filter.NetPortRange{
|
||||
{
|
||||
Net: netip.MustParsePrefix("100.64.0.1/32"),
|
||||
Ports: allPorts,
|
||||
Ports: filter.PortRange{0, 0xffff},
|
||||
},
|
||||
{
|
||||
Net: netip.MustParsePrefix("fd7a:115c:a1e0::1/128"),
|
||||
Ports: allPorts,
|
||||
Ports: filter.PortRange{0, 0xffff},
|
||||
},
|
||||
},
|
||||
Caps: []filter.CapMatch{},
|
||||
|
@ -1305,7 +1303,7 @@ func TestSubnetRouteACL(t *testing.T) {
|
|||
Dsts: []filter.NetPortRange{
|
||||
{
|
||||
Net: netip.MustParsePrefix("10.33.0.0/16"),
|
||||
Ports: allPorts,
|
||||
Ports: filter.PortRange{0, 0xffff},
|
||||
},
|
||||
},
|
||||
Caps: []filter.CapMatch{},
|
||||
|
|
Loading…
Reference in a new issue