Browse Source

wgengine: remove use of legacy key parsing helper.

Updates #3206

Signed-off-by: David Anderson <[email protected]>
David Anderson 4 years ago
parent
commit
ccd36cb5b1
2 changed files with 4 additions and 4 deletions
  1. 2 2
      wgengine/userspace.go
  2. 2 2
      wgengine/userspace_test.go

+ 2 - 2
wgengine/userspace.go

@@ -1007,14 +1007,14 @@ func (e *userspaceEngine) getStatus() (*Status, error) {
 		}
 		switch string(k) {
 		case "public_key":
-			pk, err := key.NewPublicFromHexMem(v)
+			pk, err := key.ParseNodePublicUntyped(v)
 			if err != nil {
 				return nil, fmt.Errorf("IpcGetOperation: invalid key in line %q", line)
 			}
 			if !p.NodeKey.IsZero() {
 				pp[p.NodeKey] = p
 			}
-			p = ipnstate.PeerStatusLite{NodeKey: tailcfg.NodeKey(pk)}
+			p = ipnstate.PeerStatusLite{NodeKey: tailcfg.NodeKeyFromNodePublic(pk)}
 		case "rx_bytes":
 			n, err = mem.ParseInt(v, 10, 64)
 			p.RxBytes = n

+ 2 - 2
wgengine/userspace_test.go

@@ -213,11 +213,11 @@ func nkFromHex(hex string) tailcfg.NodeKey {
 	if len(hex) != 64 {
 		panic(fmt.Sprintf("%q is len %d; want 64", hex, len(hex)))
 	}
-	k, err := key.NewPublicFromHexMem(mem.S(hex[:64]))
+	k, err := key.ParseNodePublicUntyped(mem.S(hex[:64]))
 	if err != nil {
 		panic(fmt.Sprintf("%q is not hex: %v", hex, err))
 	}
-	return tailcfg.NodeKey(k)
+	return tailcfg.NodeKeyFromNodePublic(k)
 }
 
 // an experiment to see if genLocalAddrFunc was worth it. As of Go