wgengine: remove use of legacy key parsing helper.

Updates #3206

Signed-off-by: David Anderson <danderson@tailscale.com>
danderson/nodekey-delete-old
David Anderson 3 years ago
parent 743293d473
commit ccd36cb5b1

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

@ -213,11 +213,11 @@ func nkFromHex(hex string) tailcfg.NodeKey {
if len(hex) != 64 { if len(hex) != 64 {
panic(fmt.Sprintf("%q is len %d; want 64", hex, len(hex))) 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 { if err != nil {
panic(fmt.Sprintf("%q is not hex: %v", hex, err)) 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 // an experiment to see if genLocalAddrFunc was worth it. As of Go

Loading…
Cancel
Save