|
|
@ -18,6 +18,8 @@ import (
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"math/big"
|
|
|
|
"math/big"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"sync/atomic"
|
|
|
|
"sync/atomic"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
@ -28,6 +30,8 @@ import (
|
|
|
|
"tailscale.com/types/logger"
|
|
|
|
"tailscale.com/types/logger"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var debug, _ = strconv.ParseBool(os.Getenv("DERP_DEBUG_LOGS"))
|
|
|
|
|
|
|
|
|
|
|
|
// Server is a DERP server.
|
|
|
|
// Server is a DERP server.
|
|
|
|
type Server struct {
|
|
|
|
type Server struct {
|
|
|
|
// BytesPerSecond, if non-zero, specifies how many bytes per
|
|
|
|
// BytesPerSecond, if non-zero, specifies how many bytes per
|
|
|
@ -226,7 +230,9 @@ func (s *Server) accept(nc net.Conn, brw *bufio.ReadWriter) error {
|
|
|
|
|
|
|
|
|
|
|
|
if dst == nil {
|
|
|
|
if dst == nil {
|
|
|
|
atomic.AddInt64(&s.packetsDropped, 1)
|
|
|
|
atomic.AddInt64(&s.packetsDropped, 1)
|
|
|
|
s.logf("derp: %s: client %x: dropping packet for unknown %x", nc.RemoteAddr(), c.key, dstKey)
|
|
|
|
if debug {
|
|
|
|
|
|
|
|
s.logf("derp: %s: client %x: dropping packet for unknown %x", nc.RemoteAddr(), c.key, dstKey)
|
|
|
|
|
|
|
|
}
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|