mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
wgengine, controlclient: fewer pointers in wgcfg key types
Signed-off-by: David Crawshaw <david@zentus.com>
This commit is contained in:
@@ -667,6 +667,26 @@ func (a *AddrSet) String() string {
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (a *AddrSet) Addrs() []wgcfg.Endpoint {
|
||||
var eps []wgcfg.Endpoint
|
||||
for _, addr := range a.addrs {
|
||||
eps = append(eps, wgcfg.Endpoint{
|
||||
Host: addr.IP.String(),
|
||||
Port: uint16(addr.Port),
|
||||
})
|
||||
}
|
||||
|
||||
a.mu.Lock()
|
||||
defer a.mu.Unlock()
|
||||
if a.roamAddr != nil {
|
||||
eps = append(eps, wgcfg.Endpoint{
|
||||
Host: a.roamAddr.IP.String(),
|
||||
Port: uint16(a.roamAddr.Port),
|
||||
})
|
||||
}
|
||||
return eps
|
||||
}
|
||||
|
||||
func (c *Conn) CreateEndpoint(key [32]byte, s string) (device.Endpoint, error) {
|
||||
pk := wgcfg.Key(key)
|
||||
log.Printf("magicsock: CreateEndpoint: key=%s: %s", pk.ShortString(), s)
|
||||
@@ -723,6 +743,12 @@ func (e *singleEndpoint) DstToBytes() []byte {
|
||||
func (e *singleEndpoint) UpdateDst(dst *net.UDPAddr) error {
|
||||
return fmt.Errorf("magicsock.singleEndpoint(%s).UpdateDst(%s): should never be called", (*net.UDPAddr)(e), dst)
|
||||
}
|
||||
func (e *singleEndpoint) Addrs() []wgcfg.Endpoint {
|
||||
return []wgcfg.Endpoint{{
|
||||
Host: e.IP.String(),
|
||||
Port: uint16(e.Port),
|
||||
}}
|
||||
}
|
||||
|
||||
// RebindingUDPConn is a UDP socket that can be re-bound.
|
||||
// Unix has no notion of re-binding a socket, so we swap it out for a new one.
|
||||
|
@@ -356,9 +356,9 @@ func (e *userspaceEngine) getStatus() (*Status, error) {
|
||||
log.Fatalf("IpcGetOperation: invalid key %#v\n", v)
|
||||
}
|
||||
p = &PeerStatus{}
|
||||
pp[*pk] = p
|
||||
pp[pk] = p
|
||||
|
||||
key := tailcfg.NodeKey(*pk)
|
||||
key := tailcfg.NodeKey(pk)
|
||||
p.NodeKey = key
|
||||
case "rx_bytes":
|
||||
n, err = strconv.ParseInt(v, 10, 64)
|
||||
|
Reference in New Issue
Block a user