wgengine/magicsock: rename discoEndpoint.wgEndpointHostPort to wgEndpoint

Fields rename only.

Part of the general effort to make our code agnostic about endpoint formatting.
It's just a name, but it will soon be a misleading one; be more generic.
Do this as a separate commit because it generates a lot of whitespace changes.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2021-04-30 16:43:26 -07:00
parent e0bd3cc70c
commit ddd85b9d91

View File

@ -2767,13 +2767,13 @@ func (c *Conn) ParseEndpoint(keyAddrs string) (conn.Endpoint, error) {
return nil, fmt.Errorf("magicsock: invalid discokey endpoint %q for %v: %w", addrs, pk.ShortString(), err) return nil, fmt.Errorf("magicsock: invalid discokey endpoint %q for %v: %w", addrs, pk.ShortString(), err)
} }
de := &discoEndpoint{ de := &discoEndpoint{
c: c, c: c,
publicKey: tailcfg.NodeKey(pk), // peer public key (for WireGuard + DERP) publicKey: tailcfg.NodeKey(pk), // peer public key (for WireGuard + DERP)
discoKey: tailcfg.DiscoKey(discoKey), // for discovery mesages discoKey: tailcfg.DiscoKey(discoKey), // for discovery mesages
discoShort: tailcfg.DiscoKey(discoKey).ShortString(), discoShort: tailcfg.DiscoKey(discoKey).ShortString(),
wgEndpointHostPort: addrs, wgEndpoint: addrs,
sentPing: map[stun.TxID]sentPing{}, sentPing: map[stun.TxID]sentPing{},
endpointState: map[netaddr.IPPort]*endpointState{}, endpointState: map[netaddr.IPPort]*endpointState{},
} }
de.initFakeUDPAddr() de.initFakeUDPAddr()
de.updateFromNode(c.nodeOfDisco[de.discoKey]) de.updateFromNode(c.nodeOfDisco[de.discoKey])
@ -3110,12 +3110,12 @@ type discoEndpoint struct {
numStopAndResetAtomic int64 numStopAndResetAtomic int64
// These fields are initialized once and never modified. // These fields are initialized once and never modified.
c *Conn c *Conn
publicKey tailcfg.NodeKey // peer public key (for WireGuard + DERP) publicKey tailcfg.NodeKey // peer public key (for WireGuard + DERP)
discoKey tailcfg.DiscoKey // for discovery mesages discoKey tailcfg.DiscoKey // for discovery mesages
discoShort string // ShortString of discoKey discoShort string // ShortString of discoKey
fakeWGAddr netaddr.IPPort // the UDP address we tell wireguard-go we're using fakeWGAddr netaddr.IPPort // the UDP address we tell wireguard-go we're using
wgEndpointHostPort string // string from ParseEndpoint: "<hex-discovery-key>.disco.tailscale:12345" wgEndpoint string // string from ParseEndpoint: "<hex-discovery-key>.disco.tailscale:12345"
// Owned by Conn.mu: // Owned by Conn.mu:
lastPingFrom netaddr.IPPort lastPingFrom netaddr.IPPort
@ -3295,7 +3295,7 @@ func (de *discoEndpoint) String() string {
func (de *discoEndpoint) ClearSrc() {} func (de *discoEndpoint) ClearSrc() {}
func (de *discoEndpoint) SrcToString() string { panic("unused") } // unused by wireguard-go func (de *discoEndpoint) SrcToString() string { panic("unused") } // unused by wireguard-go
func (de *discoEndpoint) SrcIP() net.IP { panic("unused") } // unused by wireguard-go func (de *discoEndpoint) SrcIP() net.IP { panic("unused") } // unused by wireguard-go
func (de *discoEndpoint) DstToString() string { return de.wgEndpointHostPort } func (de *discoEndpoint) DstToString() string { return de.wgEndpoint }
func (de *discoEndpoint) DstIP() net.IP { panic("unused") } func (de *discoEndpoint) DstIP() net.IP { panic("unused") }
func (de *discoEndpoint) DstToBytes() []byte { return packIPPort(de.fakeWGAddr) } func (de *discoEndpoint) DstToBytes() []byte { return packIPPort(de.fakeWGAddr) }