mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-04 13:07:46 +08:00

Updates: * go-kad-dht: Query performance improvements, DHT client fixes, validates records on *local* put. * go-libp2p-swarm/go-libp2p-transport: Timeout improvements. * go-multiaddr-net: Exposes useful Conn methods (CloseWrite, CloseRead, etc.) * go-log: fixes possible panic when enabling/disabling events. * go-multiaddr: fixes possible panic when stringifying malformed multiaddrs, adds support for consuming /p2p/ multiaddrs. fixes #5113 unblocks #4895 License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
35 lines
650 B
Go
35 lines
650 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ipfs/go-ipfs/namesys"
|
|
|
|
tu "gx/ipfs/QmcW4FGAt24fdK1jBgWQn3yP4R9ZLyWQqjozv9QK7epRhL/go-testutil"
|
|
ipns "gx/ipfs/Qmdue1XShFNi3mpizGx9NR9hyNEj6U2wEW93yGhKqKCFGN/go-ipns"
|
|
)
|
|
|
|
func TestKeyTranslation(t *testing.T) {
|
|
pid := tu.RandPeerIDFatal(t)
|
|
pkname := namesys.PkKeyForID(pid)
|
|
ipnsname := ipns.RecordKey(pid)
|
|
|
|
pkk, err := escapeDhtKey("/pk/" + pid.Pretty())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
ipnsk, err := escapeDhtKey("/ipns/" + pid.Pretty())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if pkk != pkname {
|
|
t.Fatal("keys didnt match!")
|
|
}
|
|
|
|
if ipnsk != ipnsname {
|
|
t.Fatal("keys didnt match!")
|
|
}
|
|
}
|