diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-28 00:49:31 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-28 15:22:34 +0100 |
commit | 34c047c762c31911333833c56a6dc50c52c84f5f (patch) | |
tree | dca8ea6dc6fb03d939f0f012f6a61f44b6688a1e /device/noise-types.go | |
parent | device: the psk is not a chapoly key (diff) | |
download | wireguard-go-34c047c762c31911333833c56a6dc50c52c84f5f.tar.xz wireguard-go-34c047c762c31911333833c56a6dc50c52c84f5f.zip |
device: avoid hex allocations in IpcGet
benchmark old ns/op new ns/op delta
BenchmarkUAPIGet-16 2872 2157 -24.90%
benchmark old allocs new allocs delta
BenchmarkUAPIGet-16 30 18 -40.00%
benchmark old bytes new bytes delta
BenchmarkUAPIGet-16 737 256 -65.26%
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | device/noise-types.go | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/device/noise-types.go b/device/noise-types.go index 90108d4..3688f7d 100644 --- a/device/noise-types.go +++ b/device/noise-types.go @@ -60,18 +60,10 @@ func (key *NoisePrivateKey) FromMaybeZeroHex(src string) (err error) { return } -func (key NoisePrivateKey) ToHex() string { - return hex.EncodeToString(key[:]) -} - func (key *NoisePublicKey) FromHex(src string) error { return loadExactHex(key[:], src) } -func (key NoisePublicKey) ToHex() string { - return hex.EncodeToString(key[:]) -} - func (key NoisePublicKey) IsZero() bool { var zero NoisePublicKey return key.Equals(zero) @@ -84,7 +76,3 @@ func (key NoisePublicKey) Equals(tar NoisePublicKey) bool { func (key *NoisePresharedKey) FromHex(src string) error { return loadExactHex(key[:], src) } - -func (key NoisePresharedKey) ToHex() string { - return hex.EncodeToString(key[:]) -} |