mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-11 10:44:41 +00:00
69f4b4595a
This adds a method to wgengine.Engine and plumbed down into magicsock to add a way to get a type-safe Tailscale-safe wrapper around a wireguard-go device.Peer that only exposes methods that are safe for Tailscale to use internally. It also removes HandshakeAttempts from PeerStatusLite that was just added as it wasn't needed yet and is now accessible ala cart as needed from the Peer type accessor. None of this is used yet. Updates #7617 Change-Id: I07be0c4e6679883e6eeddf8dbed7394c9e79c5f4 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
27 lines
627 B
Go
27 lines
627 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package wgint
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/tailscale/wireguard-go/device"
|
|
)
|
|
|
|
func TestInternalOffsets(t *testing.T) {
|
|
peer := new(device.Peer)
|
|
if got := peerLastHandshakeNano(peer); got != 0 {
|
|
t.Errorf("PeerLastHandshakeNano = %v, want 0", got)
|
|
}
|
|
if got := peerRxBytes(peer); got != 0 {
|
|
t.Errorf("PeerRxBytes = %v, want 0", got)
|
|
}
|
|
if got := peerTxBytes(peer); got != 0 {
|
|
t.Errorf("PeerTxBytes = %v, want 0", got)
|
|
}
|
|
if got := peerHandshakeAttempts(peer); got != 0 {
|
|
t.Errorf("PeerHandshakeAttempts = %v, want 0", got)
|
|
}
|
|
}
|