control/controlclient: add temporary mechanism to force derp on

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-02-21 14:01:51 -08:00
parent 525bf1f3d2
commit c02f4b5a1f
2 changed files with 16 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ import (
"fmt"
"log"
"net"
"os"
"strconv"
"strings"
"sync"
"sync/atomic"
@@ -376,6 +378,8 @@ func shouldSprayPacket(b []byte) bool {
return false
}
var logPacketDests, _ = strconv.ParseBool(os.Getenv("DEBUG_LOG_PACKET_DESTS"))
// appendDests appends to dsts the destinations that b should be
// written to in order to reach as. Some of the returned UDPAddrs may
// be fake addrs representing DERP servers.
@@ -403,6 +407,9 @@ func appendDests(dsts []*net.UDPAddr, as *AddrSet, b []byte) (_ []*net.UDPAddr,
break
}
}
if logPacketDests {
log.Printf("spray=%v; roam=%v; dests=%v", spray, roamAddr, dsts)
}
return dsts, roamAddr
}