mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-08 22:12:21 +00:00
wgengine/magicsock: fix data race from undocumented wireguard-go requirement
Endpoints need to be Stringers apparently. Fixes tailscale/corp#422
This commit is contained in:
@@ -2750,6 +2750,13 @@ func (de *discoEndpoint) initFakeUDPAddr() {
|
||||
de.fakeWGAddrStd = de.fakeWGAddr.UDPAddr()
|
||||
}
|
||||
|
||||
// String exists purely so wireguard-go internals can log.Printf("%v")
|
||||
// its internal conn.Endpoints and we don't end up with data races
|
||||
// from fmt (via log) reading mutex fields and such.
|
||||
func (de *discoEndpoint) String() string {
|
||||
return fmt.Sprintf("magicsock.discoEndpoint{%v, %v}", de.publicKey.ShortString(), de.discoShort)
|
||||
}
|
||||
|
||||
func (de *discoEndpoint) Addrs() []wgcfg.Endpoint {
|
||||
// This has to be the same string that was passed to
|
||||
// CreateEndpoint, otherwise Reconfig will end up recreating
|
||||
|
||||
Reference in New Issue
Block a user