Files
tailscale/derp/derp_server_linux.go
T
Brad Fitzpatrick bca75cc9e4 lanscaping: remove sockstats from deps
-rwxr-xr-x@ 1 bradfitz  staff  10243186 Jan 11 10:58 /Users/bradfitz/bin/tailscaled.min
-rwxr-xr-x@ 1 bradfitz  staff  10682520 Jan 11 10:58 /Users/bradfitz/bin/tailscaled.minlinux

Change-Id: I6bf462a9d63400f48193f830d6ac9bc8620cbd8f
Signed-off-by: Brad Fitzpatrick <[email protected]>
2025-01-11 10:58:23 -08:00

52 lines
971 B
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package derp
import (
"context"
"crypto/tls"
"net"
"time"
)
func (c *sclient) startStatsLoop(ctx context.Context) {
}
// tcpConn attempts to get the underlying *net.TCPConn from this client's
// Conn; if it cannot, then it will return nil.
func (c *sclient) tcpConn() *net.TCPConn {
nc := c.nc
for {
switch v := nc.(type) {
case *net.TCPConn:
return v
case *tls.Conn:
nc = v.NetConn()
default:
return nil
}
}
}
func durationToLabel(dur time.Duration) string {
switch {
case dur <= 10*time.Millisecond:
return "10ms"
case dur <= 20*time.Millisecond:
return "20ms"
case dur <= 50*time.Millisecond:
return "50ms"
case dur <= 100*time.Millisecond:
return "100ms"
case dur <= 150*time.Millisecond:
return "150ms"
case dur <= 250*time.Millisecond:
return "250ms"
case dur <= 500*time.Millisecond:
return "500ms"
default:
return "inf"
}
}