mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
15 lines
253 B
Go
15 lines
253 B
Go
package testutil
|
|
|
|
import (
|
|
crand "crypto/rand"
|
|
peer "github.com/jbenet/go-ipfs/peer"
|
|
u "github.com/jbenet/go-ipfs/util"
|
|
)
|
|
|
|
func RandPeer() peer.Peer {
|
|
id := make([]byte, 16)
|
|
crand.Read(id)
|
|
mhid := u.Hash(id)
|
|
return NewPeerWithID(peer.ID(mhid))
|
|
}
|