mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-12 08:41:22 +00:00
chore: transform libp2p into monorepo
This commit is contained in:
18
packages/libp2p/src/ping/util.js
Normal file
18
packages/libp2p/src/ping/util.js
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
const crypto = require('libp2p-crypto')
|
||||
const constants = require('./constants')
|
||||
|
||||
/**
|
||||
* @param {number} length
|
||||
*/
|
||||
function rnd (length) {
|
||||
if (!length) {
|
||||
length = constants.PING_LENGTH
|
||||
}
|
||||
return crypto.randomBytes(length)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
rnd
|
||||
}
|
Reference in New Issue
Block a user