mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
types/key: update some doc strings for public key serialization
Updates #cleanup Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
80206b5323
commit
ca4396107e
@ -310,7 +310,7 @@ func (k NodePublic) UntypedHexString() string {
|
||||
return hex.EncodeToString(k.k[:])
|
||||
}
|
||||
|
||||
// String returns the output of MarshalText as a string.
|
||||
// String returns k as a hex-encoded string with a type prefix.
|
||||
func (k NodePublic) String() string {
|
||||
bs, err := k.MarshalText()
|
||||
if err != nil {
|
||||
@ -319,17 +319,20 @@ func (k NodePublic) String() string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
// AppendText implements encoding.TextAppender.
|
||||
// AppendText implements encoding.TextAppender. It appends a typed prefix
|
||||
// followed by hex encoded represtation of k to b.
|
||||
func (k NodePublic) AppendText(b []byte) ([]byte, error) {
|
||||
return appendHexKey(b, nodePublicHexPrefix, k.k[:]), nil
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
// MarshalText implements encoding.TextMarshaler. It returns a typed prefix
|
||||
// followed by a hex encoded representation of k.
|
||||
func (k NodePublic) MarshalText() ([]byte, error) {
|
||||
return k.AppendText(nil)
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextUnmarshaler.
|
||||
// UnmarshalText implements encoding.TextUnmarshaler. It expects a typed prefix
|
||||
// followed by a hex encoded representation of k.
|
||||
func (k *NodePublic) UnmarshalText(b []byte) error {
|
||||
return parseHex(k.k[:], mem.B(b), mem.S(nodePublicHexPrefix))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user