Skip to content

Commit

Permalink
cleanup linter varnings
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby committed Oct 21, 2024
1 parent 028d9aa commit f6c3c7b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
9 changes: 1 addition & 8 deletions hscontrol/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ func generateUserProfiles(

func generateDNSConfig(
cfg *types.Config,
baseDomain string,
node *types.Node,
peers types.Nodes,
) *tailcfg.DNSConfig {
if cfg.DNSConfig == nil {
return nil
Expand Down Expand Up @@ -532,12 +530,7 @@ func appendPeerChanges(

profiles := generateUserProfiles(node, changed)

dnsConfig := generateDNSConfig(
cfg,
cfg.BaseDomain,
node,
peers,
)
dnsConfig := generateDNSConfig(cfg, node)

tailPeers, err := tailNodes(changed, capVer, pol, cfg)
if err != nil {
Expand Down
12 changes: 0 additions & 12 deletions hscontrol/mapper/mapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,12 @@ 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 != "" {
Expand Down
7 changes: 0 additions & 7 deletions hscontrol/noise.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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"
Expand Down Expand Up @@ -101,18 +100,12 @@ 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{
Expand Down
12 changes: 7 additions & 5 deletions integration/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ 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) {
Expand Down Expand Up @@ -1249,11 +1251,11 @@ func TestSubnetRouteACL(t *testing.T) {
Dsts: []filter.NetPortRange{
{
Net: netip.MustParsePrefix("100.64.0.2/32"),
Ports: filter.PortRange{0, 0xffff},
Ports: allPorts,
},
{
Net: netip.MustParsePrefix("fd7a:115c:a1e0::2/128"),
Ports: filter.PortRange{0, 0xffff},
Ports: allPorts,
},
},
Caps: []filter.CapMatch{},
Expand Down Expand Up @@ -1281,11 +1283,11 @@ func TestSubnetRouteACL(t *testing.T) {
Dsts: []filter.NetPortRange{
{
Net: netip.MustParsePrefix("100.64.0.1/32"),
Ports: filter.PortRange{0, 0xffff},
Ports: allPorts,
},
{
Net: netip.MustParsePrefix("fd7a:115c:a1e0::1/128"),
Ports: filter.PortRange{0, 0xffff},
Ports: allPorts,
},
},
Caps: []filter.CapMatch{},
Expand All @@ -1303,7 +1305,7 @@ func TestSubnetRouteACL(t *testing.T) {
Dsts: []filter.NetPortRange{
{
Net: netip.MustParsePrefix("10.33.0.0/16"),
Ports: filter.PortRange{0, 0xffff},
Ports: allPorts,
},
},
Caps: []filter.CapMatch{},
Expand Down

0 comments on commit f6c3c7b

Please sign in to comment.