mirror of https://github.com/vacp2p/nim-libp2p.git
Less warnings (#710)
This commit is contained in:
parent
e536d7cb1b
commit
d4ff1c88e9
|
@ -1,3 +1,6 @@
|
||||||
# to allow locking
|
# to allow locking
|
||||||
if dirExists("nimbledeps/pkgs"):
|
if dirExists("nimbledeps/pkgs"):
|
||||||
switch("NimblePath", "nimbledeps/pkgs")
|
switch("NimblePath", "nimbledeps/pkgs")
|
||||||
|
|
||||||
|
when (NimMajor, NimMinor) > (1, 2):
|
||||||
|
switch("hint", "XCannotRaiseY:off")
|
|
@ -81,8 +81,6 @@ export results
|
||||||
# This is workaround for Nim's `import` bug
|
# This is workaround for Nim's `import` bug
|
||||||
export rijndael, twofish, sha2, hash, hmac, ncrutils
|
export rijndael, twofish, sha2, hash, hmac, ncrutils
|
||||||
|
|
||||||
from strutils import split
|
|
||||||
|
|
||||||
type
|
type
|
||||||
DigestSheme* = enum
|
DigestSheme* = enum
|
||||||
Sha256,
|
Sha256,
|
||||||
|
|
|
@ -28,7 +28,7 @@ const
|
||||||
type
|
type
|
||||||
Curve25519* = object
|
Curve25519* = object
|
||||||
Curve25519Key* = array[Curve25519KeySize, byte]
|
Curve25519Key* = array[Curve25519KeySize, byte]
|
||||||
pcuchar = ptr cuchar
|
pcuchar = ptr char
|
||||||
Curve25519Error* = enum
|
Curve25519Error* = enum
|
||||||
Curver25519GenError
|
Curver25519GenError
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,8 @@ proc checkPublic(key: openArray[byte], curve: cint): uint32 =
|
||||||
var impl = brEcGetDefault()
|
var impl = brEcGetDefault()
|
||||||
var orderlen = 0
|
var orderlen = 0
|
||||||
discard impl.order(curve, addr orderlen)
|
discard impl.order(curve, addr orderlen)
|
||||||
result = impl.mul(cast[ptr cuchar](unsafeAddr ckey[0]), len(ckey),
|
result = impl.mul(cast[ptr char](unsafeAddr ckey[0]), len(ckey),
|
||||||
cast[ptr cuchar](addr x[0]), len(x), curve)
|
cast[ptr char](addr x[0]), len(x), curve)
|
||||||
|
|
||||||
proc getOffset(pubkey: EcPublicKey): int {.inline.} =
|
proc getOffset(pubkey: EcPublicKey): int {.inline.} =
|
||||||
let o = cast[uint](pubkey.key.q) - cast[uint](unsafeAddr pubkey.buffer[0])
|
let o = cast[uint](pubkey.key.q) - cast[uint](unsafeAddr pubkey.buffer[0])
|
||||||
|
@ -174,7 +174,7 @@ proc copy*[T: EcPKI](dst: var T, src: T): bool =
|
||||||
dst.buffer = src.buffer
|
dst.buffer = src.buffer
|
||||||
dst.key.curve = src.key.curve
|
dst.key.curve = src.key.curve
|
||||||
dst.key.xlen = length
|
dst.key.xlen = length
|
||||||
dst.key.x = cast[ptr cuchar](addr dst.buffer[offset])
|
dst.key.x = cast[ptr char](addr dst.buffer[offset])
|
||||||
result = true
|
result = true
|
||||||
elif T is EcPublicKey:
|
elif T is EcPublicKey:
|
||||||
let length = src.key.qlen
|
let length = src.key.qlen
|
||||||
|
@ -184,7 +184,7 @@ proc copy*[T: EcPKI](dst: var T, src: T): bool =
|
||||||
dst.buffer = src.buffer
|
dst.buffer = src.buffer
|
||||||
dst.key.curve = src.key.curve
|
dst.key.curve = src.key.curve
|
||||||
dst.key.qlen = length
|
dst.key.qlen = length
|
||||||
dst.key.q = cast[ptr cuchar](addr dst.buffer[offset])
|
dst.key.q = cast[ptr char](addr dst.buffer[offset])
|
||||||
result = true
|
result = true
|
||||||
else:
|
else:
|
||||||
let length = len(src.buffer)
|
let length = len(src.buffer)
|
||||||
|
@ -252,8 +252,8 @@ proc getPublicKey*(seckey: EcPrivateKey): EcResult[EcPublicKey] =
|
||||||
|
|
||||||
var ecimp = brEcGetDefault()
|
var ecimp = brEcGetDefault()
|
||||||
if seckey.key.curve in EcSupportedCurvesCint:
|
if seckey.key.curve in EcSupportedCurvesCint:
|
||||||
var length = getPublicKeyLength(cast[EcCurveKind](seckey.key.curve))
|
|
||||||
var res = new EcPublicKey
|
var res = new EcPublicKey
|
||||||
|
assert res.buffer.len > getPublicKeyLength(cast[EcCurveKind](seckey.key.curve))
|
||||||
if brEcComputePublicKey(ecimp, addr res.key,
|
if brEcComputePublicKey(ecimp, addr res.key,
|
||||||
addr res.buffer[0], unsafeAddr seckey.key) == 0:
|
addr res.buffer[0], unsafeAddr seckey.key) == 0:
|
||||||
err(EcKeyIncorrectError)
|
err(EcKeyIncorrectError)
|
||||||
|
@ -638,7 +638,7 @@ proc init*(key: var EcPrivateKey, data: openArray[byte]): Result[void, Asn1Error
|
||||||
if checkScalar(raw.toOpenArray(), curve) == 1'u32:
|
if checkScalar(raw.toOpenArray(), curve) == 1'u32:
|
||||||
key = new EcPrivateKey
|
key = new EcPrivateKey
|
||||||
copyMem(addr key.buffer[0], addr raw.buffer[raw.offset], raw.length)
|
copyMem(addr key.buffer[0], addr raw.buffer[raw.offset], raw.length)
|
||||||
key.key.x = cast[ptr cuchar](addr key.buffer[0])
|
key.key.x = cast[ptr char](addr key.buffer[0])
|
||||||
key.key.xlen = raw.length
|
key.key.xlen = raw.length
|
||||||
key.key.curve = curve
|
key.key.curve = curve
|
||||||
ok()
|
ok()
|
||||||
|
@ -697,7 +697,7 @@ proc init*(pubkey: var EcPublicKey, data: openArray[byte]): Result[void, Asn1Err
|
||||||
if checkPublic(raw.toOpenArray(), curve) != 0:
|
if checkPublic(raw.toOpenArray(), curve) != 0:
|
||||||
pubkey = new EcPublicKey
|
pubkey = new EcPublicKey
|
||||||
copyMem(addr pubkey.buffer[0], addr raw.buffer[raw.offset], raw.length)
|
copyMem(addr pubkey.buffer[0], addr raw.buffer[raw.offset], raw.length)
|
||||||
pubkey.key.q = cast[ptr cuchar](addr pubkey.buffer[0])
|
pubkey.key.q = cast[ptr char](addr pubkey.buffer[0])
|
||||||
pubkey.key.qlen = raw.length
|
pubkey.key.qlen = raw.length
|
||||||
pubkey.key.curve = curve
|
pubkey.key.curve = curve
|
||||||
ok()
|
ok()
|
||||||
|
@ -785,7 +785,7 @@ proc initRaw*(key: var EcPrivateKey, data: openArray[byte]): bool =
|
||||||
let length = len(data)
|
let length = len(data)
|
||||||
key = new EcPrivateKey
|
key = new EcPrivateKey
|
||||||
copyMem(addr key.buffer[0], unsafeAddr data[0], length)
|
copyMem(addr key.buffer[0], unsafeAddr data[0], length)
|
||||||
key.key.x = cast[ptr cuchar](addr key.buffer[0])
|
key.key.x = cast[ptr char](addr key.buffer[0])
|
||||||
key.key.xlen = length
|
key.key.xlen = length
|
||||||
key.key.curve = curve
|
key.key.curve = curve
|
||||||
result = true
|
result = true
|
||||||
|
@ -816,7 +816,7 @@ proc initRaw*(pubkey: var EcPublicKey, data: openArray[byte]): bool =
|
||||||
let length = len(data)
|
let length = len(data)
|
||||||
pubkey = new EcPublicKey
|
pubkey = new EcPublicKey
|
||||||
copyMem(addr pubkey.buffer[0], unsafeAddr data[0], length)
|
copyMem(addr pubkey.buffer[0], unsafeAddr data[0], length)
|
||||||
pubkey.key.q = cast[ptr cuchar](addr pubkey.buffer[0])
|
pubkey.key.q = cast[ptr char](addr pubkey.buffer[0])
|
||||||
pubkey.key.qlen = length
|
pubkey.key.qlen = length
|
||||||
pubkey.key.curve = curve
|
pubkey.key.curve = curve
|
||||||
result = true
|
result = true
|
||||||
|
@ -891,9 +891,9 @@ proc scalarMul*(pub: EcPublicKey, sec: EcPrivateKey): EcPublicKey =
|
||||||
let poffset = key.getOffset()
|
let poffset = key.getOffset()
|
||||||
let soffset = sec.getOffset()
|
let soffset = sec.getOffset()
|
||||||
if poffset >= 0 and soffset >= 0:
|
if poffset >= 0 and soffset >= 0:
|
||||||
let res = impl.mul(cast[ptr cuchar](addr key.buffer[poffset]),
|
let res = impl.mul(cast[ptr char](addr key.buffer[poffset]),
|
||||||
key.key.qlen,
|
key.key.qlen,
|
||||||
cast[ptr cuchar](unsafeAddr sec.buffer[soffset]),
|
cast[ptr char](unsafeAddr sec.buffer[soffset]),
|
||||||
sec.key.xlen,
|
sec.key.xlen,
|
||||||
key.key.curve)
|
key.key.curve)
|
||||||
if res != 0:
|
if res != 0:
|
||||||
|
|
|
@ -62,7 +62,7 @@ type
|
||||||
buffer*: seq[byte]
|
buffer*: seq[byte]
|
||||||
seck*: BrRsaPrivateKey
|
seck*: BrRsaPrivateKey
|
||||||
pubk*: BrRsaPublicKey
|
pubk*: BrRsaPublicKey
|
||||||
pexp*: ptr cuchar
|
pexp*: ptr char
|
||||||
pexplen*: int
|
pexplen*: int
|
||||||
|
|
||||||
RsaPublicKey* = ref object
|
RsaPublicKey* = ref object
|
||||||
|
@ -109,9 +109,9 @@ template getArray*(bs, os, ls: untyped): untyped =
|
||||||
template trimZeroes(b: seq[byte], pt, ptlen: untyped) =
|
template trimZeroes(b: seq[byte], pt, ptlen: untyped) =
|
||||||
var length = ptlen
|
var length = ptlen
|
||||||
for i in 0..<length:
|
for i in 0..<length:
|
||||||
if pt[] != cast[cuchar](0x00'u8):
|
if pt[] != cast[char](0x00'u8):
|
||||||
break
|
break
|
||||||
pt = cast[ptr cuchar](cast[uint](pt) + 1)
|
pt = cast[ptr char](cast[uint](pt) + 1)
|
||||||
ptlen -= 1
|
ptlen -= 1
|
||||||
|
|
||||||
proc random*[T: RsaKP](t: typedesc[T], rng: var BrHmacDrbgContext,
|
proc random*[T: RsaKP](t: typedesc[T], rng: var BrHmacDrbgContext,
|
||||||
|
@ -150,7 +150,7 @@ proc random*[T: RsaKP](t: typedesc[T], rng: var BrHmacDrbgContext,
|
||||||
if computed == 0:
|
if computed == 0:
|
||||||
return err(RsaGenError)
|
return err(RsaGenError)
|
||||||
|
|
||||||
res.pexp = cast[ptr cuchar](addr res.buffer[eko])
|
res.pexp = cast[ptr char](addr res.buffer[eko])
|
||||||
res.pexplen = computed
|
res.pexplen = computed
|
||||||
|
|
||||||
trimZeroes(res.buffer, res.seck.p, res.seck.plen)
|
trimZeroes(res.buffer, res.seck.p, res.seck.plen)
|
||||||
|
@ -190,14 +190,14 @@ proc copy*[T: RsaPKI](key: T): T =
|
||||||
copyMem(addr result.buffer[no], key.pubk.n, key.pubk.nlen)
|
copyMem(addr result.buffer[no], key.pubk.n, key.pubk.nlen)
|
||||||
copyMem(addr result.buffer[eo], key.pubk.e, key.pubk.elen)
|
copyMem(addr result.buffer[eo], key.pubk.e, key.pubk.elen)
|
||||||
copyMem(addr result.buffer[peo], key.pexp, key.pexplen)
|
copyMem(addr result.buffer[peo], key.pexp, key.pexplen)
|
||||||
result.seck.p = cast[ptr cuchar](addr result.buffer[po])
|
result.seck.p = cast[ptr char](addr result.buffer[po])
|
||||||
result.seck.q = cast[ptr cuchar](addr result.buffer[qo])
|
result.seck.q = cast[ptr char](addr result.buffer[qo])
|
||||||
result.seck.dp = cast[ptr cuchar](addr result.buffer[dpo])
|
result.seck.dp = cast[ptr char](addr result.buffer[dpo])
|
||||||
result.seck.dq = cast[ptr cuchar](addr result.buffer[dqo])
|
result.seck.dq = cast[ptr char](addr result.buffer[dqo])
|
||||||
result.seck.iq = cast[ptr cuchar](addr result.buffer[iqo])
|
result.seck.iq = cast[ptr char](addr result.buffer[iqo])
|
||||||
result.pubk.n = cast[ptr cuchar](addr result.buffer[no])
|
result.pubk.n = cast[ptr char](addr result.buffer[no])
|
||||||
result.pubk.e = cast[ptr cuchar](addr result.buffer[eo])
|
result.pubk.e = cast[ptr char](addr result.buffer[eo])
|
||||||
result.pexp = cast[ptr cuchar](addr result.buffer[peo])
|
result.pexp = cast[ptr char](addr result.buffer[peo])
|
||||||
result.seck.plen = key.seck.plen
|
result.seck.plen = key.seck.plen
|
||||||
result.seck.qlen = key.seck.qlen
|
result.seck.qlen = key.seck.qlen
|
||||||
result.seck.dplen = key.seck.dplen
|
result.seck.dplen = key.seck.dplen
|
||||||
|
@ -216,8 +216,8 @@ proc copy*[T: RsaPKI](key: T): T =
|
||||||
let eo = no + key.key.nlen
|
let eo = no + key.key.nlen
|
||||||
copyMem(addr result.buffer[no], key.key.n, key.key.nlen)
|
copyMem(addr result.buffer[no], key.key.n, key.key.nlen)
|
||||||
copyMem(addr result.buffer[eo], key.key.e, key.key.elen)
|
copyMem(addr result.buffer[eo], key.key.e, key.key.elen)
|
||||||
result.key.n = cast[ptr cuchar](addr result.buffer[no])
|
result.key.n = cast[ptr char](addr result.buffer[no])
|
||||||
result.key.e = cast[ptr cuchar](addr result.buffer[eo])
|
result.key.e = cast[ptr char](addr result.buffer[eo])
|
||||||
result.key.nlen = key.key.nlen
|
result.key.nlen = key.key.nlen
|
||||||
result.key.elen = key.key.elen
|
result.key.elen = key.key.elen
|
||||||
elif T is RsaSignature:
|
elif T is RsaSignature:
|
||||||
|
@ -231,8 +231,8 @@ proc getPublicKey*(key: RsaPrivateKey): RsaPublicKey =
|
||||||
let length = key.pubk.nlen + key.pubk.elen
|
let length = key.pubk.nlen + key.pubk.elen
|
||||||
result = new RsaPublicKey
|
result = new RsaPublicKey
|
||||||
result.buffer = newSeq[byte](length)
|
result.buffer = newSeq[byte](length)
|
||||||
result.key.n = cast[ptr cuchar](addr result.buffer[0])
|
result.key.n = cast[ptr char](addr result.buffer[0])
|
||||||
result.key.e = cast[ptr cuchar](addr result.buffer[key.pubk.nlen])
|
result.key.e = cast[ptr char](addr result.buffer[key.pubk.nlen])
|
||||||
copyMem(addr result.buffer[0], cast[pointer](key.pubk.n), key.pubk.nlen)
|
copyMem(addr result.buffer[0], cast[pointer](key.pubk.n), key.pubk.nlen)
|
||||||
copyMem(addr result.buffer[key.pubk.nlen], cast[pointer](key.pubk.e),
|
copyMem(addr result.buffer[key.pubk.nlen], cast[pointer](key.pubk.e),
|
||||||
key.pubk.elen)
|
key.pubk.elen)
|
||||||
|
@ -472,14 +472,14 @@ proc init*(key: var RsaPrivateKey, data: openArray[byte]): Result[void, Asn1Erro
|
||||||
len(rawdp) > 0 and len(rawdq) > 0 and len(rawiq) > 0:
|
len(rawdp) > 0 and len(rawdq) > 0 and len(rawiq) > 0:
|
||||||
key = new RsaPrivateKey
|
key = new RsaPrivateKey
|
||||||
key.buffer = @data
|
key.buffer = @data
|
||||||
key.pubk.n = cast[ptr cuchar](addr key.buffer[rawn.offset])
|
key.pubk.n = cast[ptr char](addr key.buffer[rawn.offset])
|
||||||
key.pubk.e = cast[ptr cuchar](addr key.buffer[rawpube.offset])
|
key.pubk.e = cast[ptr char](addr key.buffer[rawpube.offset])
|
||||||
key.seck.p = cast[ptr cuchar](addr key.buffer[rawp.offset])
|
key.seck.p = cast[ptr char](addr key.buffer[rawp.offset])
|
||||||
key.seck.q = cast[ptr cuchar](addr key.buffer[rawq.offset])
|
key.seck.q = cast[ptr char](addr key.buffer[rawq.offset])
|
||||||
key.seck.dp = cast[ptr cuchar](addr key.buffer[rawdp.offset])
|
key.seck.dp = cast[ptr char](addr key.buffer[rawdp.offset])
|
||||||
key.seck.dq = cast[ptr cuchar](addr key.buffer[rawdq.offset])
|
key.seck.dq = cast[ptr char](addr key.buffer[rawdq.offset])
|
||||||
key.seck.iq = cast[ptr cuchar](addr key.buffer[rawiq.offset])
|
key.seck.iq = cast[ptr char](addr key.buffer[rawiq.offset])
|
||||||
key.pexp = cast[ptr cuchar](addr key.buffer[rawprie.offset])
|
key.pexp = cast[ptr char](addr key.buffer[rawprie.offset])
|
||||||
key.pubk.nlen = len(rawn)
|
key.pubk.nlen = len(rawn)
|
||||||
key.pubk.elen = len(rawpube)
|
key.pubk.elen = len(rawpube)
|
||||||
key.seck.plen = len(rawp)
|
key.seck.plen = len(rawp)
|
||||||
|
@ -554,8 +554,8 @@ proc init*(key: var RsaPublicKey, data: openArray[byte]): Result[void, Asn1Error
|
||||||
if len(rawn) >= (MinKeySize shr 3) and len(rawe) > 0:
|
if len(rawn) >= (MinKeySize shr 3) and len(rawe) > 0:
|
||||||
key = new RsaPublicKey
|
key = new RsaPublicKey
|
||||||
key.buffer = @data
|
key.buffer = @data
|
||||||
key.key.n = cast[ptr cuchar](addr key.buffer[rawn.offset])
|
key.key.n = cast[ptr char](addr key.buffer[rawn.offset])
|
||||||
key.key.e = cast[ptr cuchar](addr key.buffer[rawe.offset])
|
key.key.e = cast[ptr char](addr key.buffer[rawe.offset])
|
||||||
key.key.nlen = len(rawn)
|
key.key.nlen = len(rawn)
|
||||||
key.key.elen = len(rawe)
|
key.key.elen = len(rawe)
|
||||||
ok()
|
ok()
|
||||||
|
@ -762,9 +762,9 @@ proc sign*[T: byte|char](key: RsaPrivateKey,
|
||||||
kv.update(addr hc.vtable, nil, 0)
|
kv.update(addr hc.vtable, nil, 0)
|
||||||
kv.output(addr hc.vtable, addr hash[0])
|
kv.output(addr hc.vtable, addr hash[0])
|
||||||
var oid = RsaOidSha256
|
var oid = RsaOidSha256
|
||||||
let implRes = impl(cast[ptr cuchar](addr oid[0]),
|
let implRes = impl(cast[ptr char](addr oid[0]),
|
||||||
cast[ptr cuchar](addr hash[0]), len(hash),
|
cast[ptr char](addr hash[0]), len(hash),
|
||||||
addr key.seck, cast[ptr cuchar](addr res.buffer[0]))
|
addr key.seck, cast[ptr char](addr res.buffer[0]))
|
||||||
if implRes == 0:
|
if implRes == 0:
|
||||||
err(RsaSignatureError)
|
err(RsaSignatureError)
|
||||||
else:
|
else:
|
||||||
|
@ -791,8 +791,8 @@ proc verify*[T: byte|char](sig: RsaSignature, message: openArray[T],
|
||||||
kv.update(addr hc.vtable, nil, 0)
|
kv.update(addr hc.vtable, nil, 0)
|
||||||
kv.output(addr hc.vtable, addr hash[0])
|
kv.output(addr hc.vtable, addr hash[0])
|
||||||
var oid = RsaOidSha256
|
var oid = RsaOidSha256
|
||||||
let res = impl(cast[ptr cuchar](addr sig.buffer[0]), len(sig.buffer),
|
let res = impl(cast[ptr char](addr sig.buffer[0]), len(sig.buffer),
|
||||||
cast[ptr cuchar](addr oid[0]),
|
cast[ptr char](addr oid[0]),
|
||||||
len(check), addr pubkey.key, cast[ptr cuchar](addr check[0]))
|
len(check), addr pubkey.key, cast[ptr char](addr check[0]))
|
||||||
if res == 1:
|
if res == 1:
|
||||||
result = equalMem(addr check[0], addr hash[0], len(hash))
|
result = equalMem(addr check[0], addr hash[0], len(hash))
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
import std/[strutils]
|
import std/[strutils]
|
||||||
import chronos, chronicles, stew/byteutils
|
import chronos, chronicles, stew/byteutils
|
||||||
import stream/connection,
|
import stream/connection,
|
||||||
vbuffer,
|
|
||||||
protocols/protocol
|
protocols/protocol
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
|
|
|
@ -62,7 +62,6 @@ proc resolveDnsAddress(
|
||||||
port = Port(fromBytesBE(uint16, pbuf))
|
port = Port(fromBytesBE(uint16, pbuf))
|
||||||
resolvedAddresses = await self.resolveIp(prefix & dnsval, port, domain)
|
resolvedAddresses = await self.resolveIp(prefix & dnsval, port, domain)
|
||||||
|
|
||||||
var addressSuffix = ma
|
|
||||||
return collect(newSeqOfCap(4)):
|
return collect(newSeqOfCap(4)):
|
||||||
for address in resolvedAddresses:
|
for address in resolvedAddresses:
|
||||||
var createdAddress = MultiAddress.init(address).tryGet()[0].tryGet()
|
var createdAddress = MultiAddress.init(address).tryGet()[0].tryGet()
|
||||||
|
|
|
@ -38,7 +38,12 @@ func shortLog*(pid: PeerId): string =
|
||||||
var spid = $pid
|
var spid = $pid
|
||||||
if len(spid) > 10:
|
if len(spid) > 10:
|
||||||
spid[3] = '*'
|
spid[3] = '*'
|
||||||
spid.delete(4, spid.high - 6)
|
|
||||||
|
# reminder to remove this once we stop supporting 1.2
|
||||||
|
when (NimMajor, NimMinor) > (1, 2):
|
||||||
|
spid.delete(4 .. spid.high - 6)
|
||||||
|
else:
|
||||||
|
spid.delete(4, spid.high - 6)
|
||||||
|
|
||||||
spid
|
spid
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
import std/[options, sequtils, hashes]
|
import std/[options, sequtils]
|
||||||
import pkg/[chronos, chronicles, stew/results]
|
import pkg/[chronos, chronicles, stew/results]
|
||||||
import peerid, multiaddress, crypto/crypto, routing_record, errors
|
import peerid, multiaddress, crypto/crypto, routing_record, errors
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[tables, sets, sequtils, options],
|
std/[tables, sets, options],
|
||||||
./crypto/crypto,
|
./crypto/crypto,
|
||||||
./protocols/identify,
|
./protocols/identify,
|
||||||
./peerid, ./peerinfo,
|
./peerid, ./peerinfo,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
import std/[options, strformat]
|
import std/[strformat]
|
||||||
import chronos, chronicles, bearssl
|
import chronos, chronicles, bearssl
|
||||||
import ../protocol,
|
import ../protocol,
|
||||||
../../stream/streamseq,
|
../../stream/streamseq,
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
import std/[sequtils, times, sugar]
|
import std/[sequtils, times]
|
||||||
import pkg/stew/[results, byteutils]
|
import pkg/stew/results
|
||||||
import
|
import
|
||||||
multiaddress,
|
multiaddress,
|
||||||
multicodec,
|
multicodec,
|
||||||
|
|
|
@ -228,7 +228,9 @@ suite "BufferStream":
|
||||||
await stream.pushData("123".toBytes())
|
await stream.pushData("123".toBytes())
|
||||||
let push = stream.pushData("123".toBytes())
|
let push = stream.pushData("123".toBytes())
|
||||||
|
|
||||||
expect AssertionError:
|
when (NimMajor, NimMinor) < (1, 4):
|
||||||
|
type AssertionDefect = AssertionError
|
||||||
|
expect AssertionDefect:
|
||||||
await stream.pushData("123".toBytes())
|
await stream.pushData("123".toBytes())
|
||||||
|
|
||||||
await stream.closeWithEOF()
|
await stream.closeWithEOF()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import strformat, strformat, random, oids, sequtils
|
import strformat, random, oids, sequtils
|
||||||
import chronos, nimcrypto/utils, chronicles, stew/byteutils
|
import chronos, nimcrypto/utils, chronicles, stew/byteutils
|
||||||
import ../libp2p/[errors,
|
import ../libp2p/[errors,
|
||||||
stream/connection,
|
stream/connection,
|
||||||
|
|
|
@ -278,9 +278,6 @@ suite "Multistream select":
|
||||||
asyncTest "e2e - ls":
|
asyncTest "e2e - ls":
|
||||||
let ma = @[MultiAddress.init("/ip4/0.0.0.0/tcp/0").tryGet()]
|
let ma = @[MultiAddress.init("/ip4/0.0.0.0/tcp/0").tryGet()]
|
||||||
|
|
||||||
let
|
|
||||||
handlerWait = newFuture[void]()
|
|
||||||
|
|
||||||
let msListen = MultistreamSelect.new()
|
let msListen = MultistreamSelect.new()
|
||||||
var protocol: LPProtocol = new LPProtocol
|
var protocol: LPProtocol = new LPProtocol
|
||||||
protocol.handler = proc(conn: Connection, proto: string) {.async, gcsafe.} =
|
protocol.handler = proc(conn: Connection, proto: string) {.async, gcsafe.} =
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
import tables, bearssl
|
import tables, bearssl
|
||||||
import chronos, stew/byteutils
|
import chronos, stew/byteutils
|
||||||
import chronicles
|
import chronicles
|
||||||
import ../libp2p/crypto/crypto
|
|
||||||
import ../libp2p/[switch,
|
import ../libp2p/[switch,
|
||||||
errors,
|
errors,
|
||||||
multistream,
|
multistream,
|
||||||
|
|
Loading…
Reference in New Issue