all: delete wgcfg.Key and wgcfg.PrivateKey

For historical reasons, we ended up with two near-duplicate
copies of curve25519 key types, one in the wireguard-go module
(wgcfg) and one in the tailscale module (types/wgkey).
Then we moved wgcfg to the tailscale module.
We can now remove the wgcfg key type in favor of wgkey.

Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Josh Bleecher Snyder
2021-04-29 13:52:20 -07:00
parent bf9ef1ca27
commit 7ee891f5fd
13 changed files with 29 additions and 375 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/tailscale/wireguard-go/device"
"tailscale.com/types/logger"
"tailscale.com/types/wgkey"
"tailscale.com/wgengine/wgcfg"
)
@@ -86,7 +87,7 @@ func (x *Logger) SetPeers(peers []wgcfg.Peer) {
}
// wireguardGoString prints p in the same format used by wireguard-go.
func wireguardGoString(k wgcfg.Key) string {
func wireguardGoString(k wgkey.Key) string {
base64Key := base64.StdEncoding.EncodeToString(k[:])
abbreviatedKey := "invalid"
if len(base64Key) == 44 {

View File

@@ -8,6 +8,7 @@ import (
"fmt"
"testing"
"tailscale.com/types/wgkey"
"tailscale.com/wgengine/wgcfg"
"tailscale.com/wgengine/wglog"
)
@@ -34,7 +35,7 @@ func TestLogger(t *testing.T) {
}
x := wglog.NewLogger(logf)
key, err := wgcfg.ParseHexKey("20c4c1ae54e1fd37cab6e9a532ca20646aff496796cc41d4519560e5e82bee53")
key, err := wgkey.ParseHex("20c4c1ae54e1fd37cab6e9a532ca20646aff496796cc41d4519560e5e82bee53")
if err != nil {
t.Fatal(err)
}