derp, netcheck: make tests listen on localhost only

avoid macOS firewall pop-ups
This commit is contained in:
Brad Fitzpatrick 2020-03-30 11:29:08 -07:00
parent 5362e952e1
commit 1df3c8d02a
2 changed files with 2 additions and 4 deletions

View File

@ -42,7 +42,7 @@ func TestSendRecv(t *testing.T) {
clientKeys = append(clientKeys, priv.Public())
}
ln, err := net.Listen("tcp", ":0")
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatal(err)
}

View File

@ -9,7 +9,6 @@
"fmt"
"net"
"reflect"
"strings"
"testing"
"time"
@ -71,14 +70,13 @@ func TestBasic(t *testing.T) {
}
func TestWorksWhenUDPBlocked(t *testing.T) {
blackhole, err := net.ListenPacket("udp4", ":0")
blackhole, err := net.ListenPacket("udp4", "127.0.0.1:0")
if err != nil {
t.Fatalf("failed to open blackhole STUN listener: %v", err)
}
defer blackhole.Close()
stunAddr := blackhole.LocalAddr().String()
stunAddr = strings.Replace(stunAddr, "0.0.0.0:", "127.0.0.1:", 1)
c := &Client{
DERP: derpmap.NewTestWorld(stunAddr),