wgengine/wgcfg: remove two unused Config fields

They distracted me in some refactoring. They're set but never used.

Updates #17858

Change-Id: I6ec7d6841ab684a55bccca7b7cbf7da9c782694f
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/17868/head
Brad Fitzpatrick 3 weeks ago committed by Brad Fitzpatrick
parent 27a0168cdc
commit f387b1010e

@ -1243,8 +1243,6 @@ func TestEngineReconfigOnStateChange(t *testing.T) {
// After the auth is completed, the configs must be updated to reflect the node's netmap. // After the auth is completed, the configs must be updated to reflect the node's netmap.
wantState: ipn.Starting, wantState: ipn.Starting,
wantCfg: &wgcfg.Config{ wantCfg: &wgcfg.Config{
Name: "tailscale",
NodeID: node1.SelfNode.StableID(),
Peers: []wgcfg.Peer{}, Peers: []wgcfg.Peer{},
Addresses: node1.SelfNode.Addresses().AsSlice(), Addresses: node1.SelfNode.Addresses().AsSlice(),
}, },
@ -1301,8 +1299,6 @@ func TestEngineReconfigOnStateChange(t *testing.T) {
// Once the auth is completed, the configs must be updated to reflect the node's netmap. // Once the auth is completed, the configs must be updated to reflect the node's netmap.
wantState: ipn.Starting, wantState: ipn.Starting,
wantCfg: &wgcfg.Config{ wantCfg: &wgcfg.Config{
Name: "tailscale",
NodeID: node2.SelfNode.StableID(),
Peers: []wgcfg.Peer{}, Peers: []wgcfg.Peer{},
Addresses: node2.SelfNode.Addresses().AsSlice(), Addresses: node2.SelfNode.Addresses().AsSlice(),
}, },
@ -1351,8 +1347,6 @@ func TestEngineReconfigOnStateChange(t *testing.T) {
// must be updated to reflect the node's netmap. // must be updated to reflect the node's netmap.
wantState: ipn.Starting, wantState: ipn.Starting,
wantCfg: &wgcfg.Config{ wantCfg: &wgcfg.Config{
Name: "tailscale",
NodeID: node1.SelfNode.StableID(),
Peers: []wgcfg.Peer{}, Peers: []wgcfg.Peer{},
Addresses: node1.SelfNode.Addresses().AsSlice(), Addresses: node1.SelfNode.Addresses().AsSlice(),
}, },
@ -1376,8 +1370,6 @@ func TestEngineReconfigOnStateChange(t *testing.T) {
}, },
wantState: ipn.Starting, wantState: ipn.Starting,
wantCfg: &wgcfg.Config{ wantCfg: &wgcfg.Config{
Name: "tailscale",
NodeID: node3.SelfNode.StableID(),
Peers: []wgcfg.Peer{ Peers: []wgcfg.Peer{
{ {
PublicKey: node1.SelfNode.Key(), PublicKey: node1.SelfNode.Key(),
@ -1449,8 +1441,6 @@ func TestEngineReconfigOnStateChange(t *testing.T) {
}, },
wantState: ipn.Starting, wantState: ipn.Starting,
wantCfg: &wgcfg.Config{ wantCfg: &wgcfg.Config{
Name: "tailscale",
NodeID: node1.SelfNode.StableID(),
Peers: []wgcfg.Peer{}, Peers: []wgcfg.Peer{},
Addresses: node1.SelfNode.Addresses().AsSlice(), Addresses: node1.SelfNode.Addresses().AsSlice(),
}, },
@ -1480,8 +1470,6 @@ func TestEngineReconfigOnStateChange(t *testing.T) {
// With seamless renewal, starting a reauth should leave everything up: // With seamless renewal, starting a reauth should leave everything up:
wantState: ipn.Starting, wantState: ipn.Starting,
wantCfg: &wgcfg.Config{ wantCfg: &wgcfg.Config{
Name: "tailscale",
NodeID: node1.SelfNode.StableID(),
Peers: []wgcfg.Peer{}, Peers: []wgcfg.Peer{},
Addresses: node1.SelfNode.Addresses().AsSlice(), Addresses: node1.SelfNode.Addresses().AsSlice(),
}, },
@ -1513,8 +1501,6 @@ func TestEngineReconfigOnStateChange(t *testing.T) {
}, },
wantState: ipn.Starting, wantState: ipn.Starting,
wantCfg: &wgcfg.Config{ wantCfg: &wgcfg.Config{
Name: "tailscale",
NodeID: node1.SelfNode.StableID(),
Peers: []wgcfg.Peer{}, Peers: []wgcfg.Peer{},
Addresses: node1.SelfNode.Addresses().AsSlice(), Addresses: node1.SelfNode.Addresses().AsSlice(),
}, },

@ -85,7 +85,6 @@ type tailscaleTypes struct {
func getVal() *tailscaleTypes { func getVal() *tailscaleTypes {
return &tailscaleTypes{ return &tailscaleTypes{
&wgcfg.Config{ &wgcfg.Config{
Name: "foo",
Addresses: []netip.Prefix{netip.PrefixFrom(netip.AddrFrom16([16]byte{3: 3}).Unmap(), 5)}, Addresses: []netip.Prefix{netip.PrefixFrom(netip.AddrFrom16([16]byte{3: 3}).Unmap(), 5)},
Peers: []wgcfg.Peer{ Peers: []wgcfg.Peer{
{ {

@ -38,7 +38,6 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.
k1 := key.NewNode() k1 := key.NewNode()
c1 := wgcfg.Config{ c1 := wgcfg.Config{
Name: "e1",
PrivateKey: k1, PrivateKey: k1,
Addresses: []netip.Prefix{a1}, Addresses: []netip.Prefix{a1},
} }
@ -65,7 +64,6 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.
l2 := logger.WithPrefix(logf, "e2: ") l2 := logger.WithPrefix(logf, "e2: ")
k2 := key.NewNode() k2 := key.NewNode()
c2 := wgcfg.Config{ c2 := wgcfg.Config{
Name: "e2",
PrivateKey: k2, PrivateKey: k2,
Addresses: []netip.Prefix{a2}, Addresses: []netip.Prefix{a2},
} }

@ -1059,7 +1059,6 @@ func testTwoDevicePing(t *testing.T, d *devices) {
}) })
m1cfg := &wgcfg.Config{ m1cfg := &wgcfg.Config{
Name: "peer1",
PrivateKey: m1.privateKey, PrivateKey: m1.privateKey,
Addresses: []netip.Prefix{netip.MustParsePrefix("1.0.0.1/32")}, Addresses: []netip.Prefix{netip.MustParsePrefix("1.0.0.1/32")},
Peers: []wgcfg.Peer{ Peers: []wgcfg.Peer{
@ -1071,7 +1070,6 @@ func testTwoDevicePing(t *testing.T, d *devices) {
}, },
} }
m2cfg := &wgcfg.Config{ m2cfg := &wgcfg.Config{
Name: "peer2",
PrivateKey: m2.privateKey, PrivateKey: m2.privateKey,
Addresses: []netip.Prefix{netip.MustParsePrefix("1.0.0.2/32")}, Addresses: []netip.Prefix{netip.MustParsePrefix("1.0.0.2/32")},
Peers: []wgcfg.Peer{ Peers: []wgcfg.Peer{

@ -8,7 +8,6 @@ import (
"net/netip" "net/netip"
"slices" "slices"
"tailscale.com/tailcfg"
"tailscale.com/types/key" "tailscale.com/types/key"
"tailscale.com/types/logid" "tailscale.com/types/logid"
) )
@ -18,8 +17,6 @@ import (
// Config is a WireGuard configuration. // Config is a WireGuard configuration.
// It only supports the set of things Tailscale uses. // It only supports the set of things Tailscale uses.
type Config struct { type Config struct {
Name string
NodeID tailcfg.StableNodeID
PrivateKey key.NodePrivate PrivateKey key.NodePrivate
Addresses []netip.Prefix Addresses []netip.Prefix
MTU uint16 MTU uint16
@ -40,9 +37,7 @@ func (c *Config) Equal(o *Config) bool {
if c == nil || o == nil { if c == nil || o == nil {
return c == o return c == o
} }
return c.Name == o.Name && return c.PrivateKey.Equal(o.PrivateKey) &&
c.NodeID == o.NodeID &&
c.PrivateKey.Equal(o.PrivateKey) &&
c.MTU == o.MTU && c.MTU == o.MTU &&
c.NetworkLogging == o.NetworkLogging && c.NetworkLogging == o.NetworkLogging &&
slices.Equal(c.Addresses, o.Addresses) && slices.Equal(c.Addresses, o.Addresses) &&

@ -51,7 +51,6 @@ func cidrIsSubnet(node tailcfg.NodeView, cidr netip.Prefix) bool {
// WGCfg returns the NetworkMaps's WireGuard configuration. // WGCfg returns the NetworkMaps's WireGuard configuration.
func WGCfg(nm *netmap.NetworkMap, logf logger.Logf, flags netmap.WGConfigFlags, exitNode tailcfg.StableNodeID) (*wgcfg.Config, error) { func WGCfg(nm *netmap.NetworkMap, logf logger.Logf, flags netmap.WGConfigFlags, exitNode tailcfg.StableNodeID) (*wgcfg.Config, error) {
cfg := &wgcfg.Config{ cfg := &wgcfg.Config{
Name: "tailscale",
PrivateKey: nm.PrivateKey, PrivateKey: nm.PrivateKey,
Addresses: nm.GetAddresses().AsSlice(), Addresses: nm.GetAddresses().AsSlice(),
Peers: make([]wgcfg.Peer, 0, len(nm.Peers)), Peers: make([]wgcfg.Peer, 0, len(nm.Peers)),
@ -59,7 +58,6 @@ func WGCfg(nm *netmap.NetworkMap, logf logger.Logf, flags netmap.WGConfigFlags,
// Setup log IDs for data plane audit logging. // Setup log IDs for data plane audit logging.
if nm.SelfNode.Valid() { if nm.SelfNode.Valid() {
cfg.NodeID = nm.SelfNode.StableID()
canNetworkLog := nm.SelfNode.HasCap(tailcfg.CapabilityDataPlaneAuditLogs) canNetworkLog := nm.SelfNode.HasCap(tailcfg.CapabilityDataPlaneAuditLogs)
logExitFlowEnabled := nm.SelfNode.HasCap(tailcfg.NodeAttrLogExitFlows) logExitFlowEnabled := nm.SelfNode.HasCap(tailcfg.NodeAttrLogExitFlows)
if canNetworkLog && nm.SelfNode.DataPlaneAuditLogID() != "" && nm.DomainAuditLogID != "" { if canNetworkLog && nm.SelfNode.DataPlaneAuditLogID() != "" && nm.DomainAuditLogID != "" {

@ -8,7 +8,6 @@ package wgcfg
import ( import (
"net/netip" "net/netip"
"tailscale.com/tailcfg"
"tailscale.com/types/key" "tailscale.com/types/key"
"tailscale.com/types/logid" "tailscale.com/types/logid"
"tailscale.com/types/ptr" "tailscale.com/types/ptr"
@ -35,8 +34,6 @@ func (src *Config) Clone() *Config {
// A compilation failure here means this code must be regenerated, with the command at the top of this file. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _ConfigCloneNeedsRegeneration = Config(struct { var _ConfigCloneNeedsRegeneration = Config(struct {
Name string
NodeID tailcfg.StableNodeID
PrivateKey key.NodePrivate PrivateKey key.NodePrivate
Addresses []netip.Prefix Addresses []netip.Prefix
MTU uint16 MTU uint16

Loading…
Cancel
Save