2025-05-09 14:50:01 -07:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
package magicsock
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/netip"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"tailscale.com/disco"
|
2025-05-16 13:51:40 -07:00
|
|
|
"tailscale.com/types/key"
|
2025-05-09 14:50:01 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestRelayManagerInitAndIdle(t *testing.T) {
|
|
|
|
rm := relayManager{}
|
|
|
|
rm.allocateAndHandshakeAllServers(&endpoint{})
|
|
|
|
<-rm.runLoopStoppedCh
|
|
|
|
|
|
|
|
rm = relayManager{}
|
2025-05-16 13:51:40 -07:00
|
|
|
rm.stopWork(&endpoint{})
|
2025-05-09 14:50:01 -07:00
|
|
|
<-rm.runLoopStoppedCh
|
|
|
|
|
|
|
|
rm = relayManager{}
|
2025-05-16 13:51:40 -07:00
|
|
|
rm.handleCallMeMaybeVia(&endpoint{c: &Conn{discoPrivate: key.NewDisco()}}, &disco.CallMeMaybeVia{ServerDisco: key.NewDisco().Public()})
|
2025-05-09 14:50:01 -07:00
|
|
|
<-rm.runLoopStoppedCh
|
|
|
|
|
|
|
|
rm = relayManager{}
|
2025-05-28 10:45:59 -07:00
|
|
|
rm.handleGeneveEncapDiscoMsgNotBestAddr(&disco.BindUDPRelayEndpointChallenge{}, &discoInfo{}, netip.AddrPort{}, 0)
|
2025-05-09 14:50:01 -07:00
|
|
|
<-rm.runLoopStoppedCh
|
|
|
|
}
|