net/interfaces: remove IsTailscaleIP, make callers use tsaddr.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2021-01-26 15:00:05 -08:00
committed by Dave Anderson
parent e970ed0995
commit 692a011b54
4 changed files with 21 additions and 34 deletions

View File

@@ -23,8 +23,9 @@ import (
"strings"
"time"
"inet.af/netaddr"
"tailscale.com/metrics"
"tailscale.com/net/interfaces"
"tailscale.com/net/tsaddr"
"tailscale.com/types/logger"
)
@@ -81,8 +82,11 @@ func AllowDebugAccess(r *http.Request) bool {
if err != nil {
return false
}
ip := net.ParseIP(ipStr)
if interfaces.IsTailscaleIP(ip) || ip.IsLoopback() || ipStr == os.Getenv("TS_ALLOW_DEBUG_IP") {
ip, err := netaddr.ParseIP(ipStr)
if err != nil {
return false
}
if tsaddr.IsTailscaleIP(ip) || ip.IsLoopback() || ipStr == os.Getenv("TS_ALLOW_DEBUG_IP") {
return true
}
if r.Method == "GET" {