Skip to content

Commit e2d5ee0

Browse files
authored
cleanup linter warnings (#2206)
Signed-off-by: Kristoffer Dalby <[email protected]>
1 parent 028d9aa commit e2d5ee0

File tree

4 files changed

+8
-32
lines changed

4 files changed

+8
-32
lines changed

hscontrol/mapper/mapper.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ func generateUserProfiles(
111111

112112
func generateDNSConfig(
113113
cfg *types.Config,
114-
baseDomain string,
115114
node *types.Node,
116-
peers types.Nodes,
117115
) *tailcfg.DNSConfig {
118116
if cfg.DNSConfig == nil {
119117
return nil
@@ -532,12 +530,7 @@ func appendPeerChanges(
532530

533531
profiles := generateUserProfiles(node, changed)
534532

535-
dnsConfig := generateDNSConfig(
536-
cfg,
537-
cfg.BaseDomain,
538-
node,
539-
peers,
540-
)
533+
dnsConfig := generateDNSConfig(cfg, node)
541534

542535
tailPeers, err := tailNodes(changed, capVer, pol, cfg)
543536
if err != nil {

hscontrol/mapper/mapper_test.go

-12
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,12 @@ func TestDNSConfigMapResponse(t *testing.T) {
114114
}
115115

116116
nodeInShared1 := mach("test_get_shared_nodes_1", "shared1", 1)
117-
nodeInShared2 := mach("test_get_shared_nodes_2", "shared2", 2)
118-
nodeInShared3 := mach("test_get_shared_nodes_3", "shared3", 3)
119-
node2InShared1 := mach("test_get_shared_nodes_4", "shared1", 1)
120-
121-
peersOfNodeInShared1 := types.Nodes{
122-
nodeInShared1,
123-
nodeInShared2,
124-
nodeInShared3,
125-
node2InShared1,
126-
}
127117

128118
got := generateDNSConfig(
129119
&types.Config{
130120
DNSConfig: &dnsConfigOrig,
131121
},
132-
baseDomain,
133122
nodeInShared1,
134-
peersOfNodeInShared1,
135123
)
136124

137125
if diff := cmp.Diff(tt.want, got, cmpopts.EquateEmpty()); diff != "" {

hscontrol/noise.go

-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/juanfont/headscale/hscontrol/types"
1111
"github.com/rs/zerolog/log"
1212
"golang.org/x/net/http2"
13-
"golang.org/x/net/http2/h2c"
1413
"tailscale.com/control/controlbase"
1514
"tailscale.com/control/controlhttp"
1615
"tailscale.com/tailcfg"
@@ -101,18 +100,12 @@ func (h *Headscale) NoiseUpgradeHandler(
101100
Methods(http.MethodPost)
102101
router.HandleFunc("/machine/map", noiseServer.NoisePollNetMapHandler)
103102

104-
server := http.Server{
105-
ReadTimeout: types.HTTPTimeout,
106-
}
107-
108103
noiseServer.httpBaseConfig = &http.Server{
109104
Handler: router,
110105
ReadHeaderTimeout: types.HTTPTimeout,
111106
}
112107
noiseServer.http2Server = &http2.Server{}
113108

114-
server.Handler = h2c.NewHandler(router, noiseServer.http2Server)
115-
116109
noiseServer.http2Server.ServeConn(
117110
noiseConn,
118111
&http2.ServeConnOpts{

integration/route_test.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"tailscale.com/wgengine/filter"
2323
)
2424

25+
var allPorts = filter.PortRange{First: 0, Last: 0xffff}
26+
2527
// This test is both testing the routes command and the propagation of
2628
// routes.
2729
func TestEnablingRoutes(t *testing.T) {
@@ -1249,11 +1251,11 @@ func TestSubnetRouteACL(t *testing.T) {
12491251
Dsts: []filter.NetPortRange{
12501252
{
12511253
Net: netip.MustParsePrefix("100.64.0.2/32"),
1252-
Ports: filter.PortRange{0, 0xffff},
1254+
Ports: allPorts,
12531255
},
12541256
{
12551257
Net: netip.MustParsePrefix("fd7a:115c:a1e0::2/128"),
1256-
Ports: filter.PortRange{0, 0xffff},
1258+
Ports: allPorts,
12571259
},
12581260
},
12591261
Caps: []filter.CapMatch{},
@@ -1281,11 +1283,11 @@ func TestSubnetRouteACL(t *testing.T) {
12811283
Dsts: []filter.NetPortRange{
12821284
{
12831285
Net: netip.MustParsePrefix("100.64.0.1/32"),
1284-
Ports: filter.PortRange{0, 0xffff},
1286+
Ports: allPorts,
12851287
},
12861288
{
12871289
Net: netip.MustParsePrefix("fd7a:115c:a1e0::1/128"),
1288-
Ports: filter.PortRange{0, 0xffff},
1290+
Ports: allPorts,
12891291
},
12901292
},
12911293
Caps: []filter.CapMatch{},
@@ -1303,7 +1305,7 @@ func TestSubnetRouteACL(t *testing.T) {
13031305
Dsts: []filter.NetPortRange{
13041306
{
13051307
Net: netip.MustParsePrefix("10.33.0.0/16"),
1306-
Ports: filter.PortRange{0, 0xffff},
1308+
Ports: allPorts,
13071309
},
13081310
},
13091311
Caps: []filter.CapMatch{},

0 commit comments

Comments
 (0)