Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pinned
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ faststreams;https://github.com/status-im/nim-faststreams@#720fc5e5c8e428d9d0af61
httputils;https://github.com/status-im/nim-http-utils@#3b491a40c60aad9e8d3407443f46f62511e63b18
json_serialization;https://github.com/status-im/nim-json-serialization@#85b7ea093cb85ee4f433a617b97571bd709d30df
metrics;https://github.com/status-im/nim-metrics@#6142e433fc8ea9b73379770a788017ac528d46ff
ngtcp2;https://github.com/status-im/nim-ngtcp2@#6834f4756b6af58356ac9c4fef3d71db3c3ae5fe
ngtcp2;https://github.com/status-im/nim-ngtcp2@#9456daa178c655bccd4a3c78ad3b8cce1f0add73
nimcrypto;https://github.com/cheatfate/nimcrypto@#1c8d6e3caf3abc572136ae9a1da81730c4eb4288
quic;https://github.com/status-im/nim-quic.git@#ddcb31ffb74b5460ab37fd13547eca90594248bc
quic;https://github.com/status-im/nim-quic.git@#51f20d2cbd79d02ec25ff29d87ee192d2b4cc2af
results;https://github.com/arnetheduck/nim-results@#f3c666a272c69d70cb41e7245e7f6844797303ad
secp256k1;https://github.com/status-im/nim-secp256k1@#7246d91c667f4cc3759fdd50339caa45a2ecd8be
serialization;https://github.com/status-im/nim-serialization@#4bdbc29e54fe54049950e352bb969aab97173b35
Expand Down
2 changes: 1 addition & 1 deletion libp2p.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ requires "nim >= 1.6.0",
"nimcrypto >= 0.6.0 & < 0.7.0", "dnsclient >= 0.3.0 & < 0.4.0", "bearssl >= 0.2.5",
"chronicles >= 0.10.2", "chronos >= 4.0.3", "metrics", "secp256k1", "stew#head",
"websock", "unittest2",
"https://github.com/status-im/nim-quic.git#ddcb31ffb74b5460ab37fd13547eca90594248bc"
"https://github.com/status-im/nim-quic.git#51f20d2cbd79d02ec25ff29d87ee192d2b4cc2af"

let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js)
Expand Down
9 changes: 5 additions & 4 deletions libp2p/builders.nim
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import services/wildcardresolverservice
export switch, peerid, peerinfo, connection, multiaddress, crypto, errors

type
TransportProvider* {.public.} = proc(upgr: Upgrade): Transport {.gcsafe, raises: [].}
TransportProvider* {.public.} =
proc(upgr: Upgrade, privateKey: PrivateKey): Transport {.gcsafe, raises: [].}

SecureProtocol* {.pure.} = enum
Noise
Expand Down Expand Up @@ -151,7 +152,7 @@ proc withTransport*(
let switch = SwitchBuilder
.new()
.withTransport(
proc(upgr: Upgrade): Transport =
proc(upgr: Upgrade, privateKey: PrivateKey): Transport =
TcpTransport.new(flags, upgr)
)
.build()
Expand All @@ -162,7 +163,7 @@ proc withTcpTransport*(
b: SwitchBuilder, flags: set[ServerFlags] = {}
): SwitchBuilder {.public.} =
b.withTransport(
proc(upgr: Upgrade): Transport =
proc(upgr: Upgrade, privateKey: PrivateKey): Transport =
TcpTransport.new(flags, upgr)
)

Expand Down Expand Up @@ -270,7 +271,7 @@ proc build*(b: SwitchBuilder): Switch {.raises: [LPError], public.} =
let transports = block:
var transports: seq[Transport]
for tProvider in b.transports:
transports.add(tProvider(muxedUpgrade))
transports.add(tProvider(muxedUpgrade, seckey))
transports

if b.secureManagers.len == 0:
Expand Down
12 changes: 6 additions & 6 deletions libp2p/dial.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ method connect*(
## a protocol
##

doAssert(false, "Not implemented!")
doAssert(false, "[Dial.connect] abstract method not implemented!")

method connect*(
self: Dial, address: MultiAddress, allowUnknownPeerId = false
): Future[PeerId] {.base, async: (raises: [DialFailedError, CancelledError]).} =
## Connects to a peer and retrieve its PeerId

doAssert(false, "Not implemented!")
doAssert(false, "[Dial.connect] abstract method not implemented!")

method dial*(
self: Dial, peerId: PeerId, protos: seq[string]
Expand All @@ -47,7 +47,7 @@ method dial*(
## existing connection
##

doAssert(false, "Not implemented!")
doAssert(false, "[Dial.dial] abstract method not implemented!")

method dial*(
self: Dial,
Expand All @@ -60,14 +60,14 @@ method dial*(
## a connection if one doesn't exist already
##

doAssert(false, "Not implemented!")
doAssert(false, "[Dial.dial] abstract method not implemented!")

method addTransport*(self: Dial, transport: Transport) {.base.} =
doAssert(false, "Not implemented!")
doAssert(false, "[Dial.addTransport] abstract method not implemented!")

method tryDial*(
self: Dial, peerId: PeerId, addrs: seq[MultiAddress]
): Future[Opt[MultiAddress]] {.
base, async: (raises: [DialFailedError, CancelledError])
.} =
doAssert(false, "Not implemented!")
doAssert(false, "[Dial.tryDial] abstract method not implemented!")
6 changes: 3 additions & 3 deletions libp2p/discovery/discoverymngr.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ proc `{}`*[T](pa: PeerAttributes, t: typedesc[T]): Opt[T] =

proc `[]`*[T](pa: PeerAttributes, t: typedesc[T]): T {.raises: [KeyError].} =
pa{T}.valueOr:
raise newException(KeyError, "Attritute not found")
raise newException(KeyError, "Attribute not found")

proc match*(pa, candidate: PeerAttributes): bool =
for f in pa.attributes:
Expand All @@ -86,12 +86,12 @@ type
method request*(
self: DiscoveryInterface, pa: PeerAttributes
) {.base, async: (raises: [DiscoveryError, CancelledError]).} =
doAssert(false, "Not implemented!")
doAssert(false, "[DiscoveryInterface.request] abstract method not implemented!")

method advertise*(
self: DiscoveryInterface
) {.base, async: (raises: [CancelledError, AdvertiseError]).} =
doAssert(false, "Not implemented!")
doAssert(false, "[DiscoveryInterface.advertise] abstract method not implemented!")

type
DiscoveryQuery* = ref object
Expand Down
4 changes: 2 additions & 2 deletions libp2p/muxers/muxer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ method newStream*(
): Future[Connection] {.
base, async: (raises: [CancelledError, LPStreamError, MuxerError], raw: true)
.} =
raiseAssert("Not implemented!")
raiseAssert("[Muxer.newStream] abstract method not implemented!")

method close*(m: Muxer) {.base, async: (raises: []).} =
if m.connection != nil:
Expand All @@ -68,4 +68,4 @@ proc new*(
muxerProvider

method getStreams*(m: Muxer): seq[Connection] {.base, gcsafe.} =
raiseAssert("Not implemented!")
raiseAssert("[Muxer.getStreams] abstract method not implemented!")
4 changes: 2 additions & 2 deletions libp2p/nameresolving/nameresolver.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ method resolveTxt*(
self: NameResolver, address: string
): Future[seq[string]] {.async: (raises: [CancelledError]), base.} =
## Get TXT record
raiseAssert "Not implemented!"
raiseAssert "[NameResolver.resolveTxt] abstract method not implemented!"

method resolveIp*(
self: NameResolver, address: string, port: Port, domain: Domain = Domain.AF_UNSPEC
): Future[seq[TransportAddress]] {.
async: (raises: [CancelledError, TransportAddressError]), base
.} =
## Resolve the specified address
raiseAssert "Not implemented!"
raiseAssert "[NameResolver.resolveIp] abstract method not implemented!"

proc getHostname*(ma: MultiAddress): string =
let
Expand Down
4 changes: 2 additions & 2 deletions libp2p/protocols/secure/secure.nim
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ method readMessage*(
): Future[seq[byte]] {.
async: (raises: [CancelledError, LPStreamError], raw: true), base
.} =
raiseAssert("Not implemented!")
raiseAssert("[SecureConn.readMessage] abstract method not implemented!")

method getWrapped*(s: SecureConn): Connection =
s.stream
Expand All @@ -92,7 +92,7 @@ method handshake*(
): Future[SecureConn] {.
async: (raises: [CancelledError, LPStreamError], raw: true), base
.} =
raiseAssert("Not implemented!")
raiseAssert("[Secure.handshake] abstract method not implemented!")

proc handleConn(
s: Secure, conn: Connection, initiator: bool, peerId: Opt[PeerId]
Expand Down
2 changes: 1 addition & 1 deletion libp2p/stream/connection.nim
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ proc timeoutMonitor(s: Connection) {.async: (raises: []).} =
return

method getWrapped*(s: Connection): Connection {.base.} =
raiseAssert("Not implemented!")
raiseAssert("[Connection.getWrapped] abstract method not implemented!")

when defined(libp2p_agents_metrics):
proc setShortAgent*(s: Connection, shortAgent: string) =
Expand Down
4 changes: 2 additions & 2 deletions libp2p/stream/lpstream.nim
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ method readOnce*(
## Reads whatever is available in the stream,
## up to `nbytes`. Will block if nothing is
## available
raiseAssert("Not implemented!")
raiseAssert("[LPStream.readOnce] abstract method not implemented!")

proc readExactly*(
s: LPStream, pbytes: pointer, nbytes: int
Expand Down Expand Up @@ -242,7 +242,7 @@ method write*(
async: (raises: [CancelledError, LPStreamError], raw: true), base, public
.} =
# Write `msg` to stream, waiting for the write to be finished
raiseAssert("Not implemented!")
raiseAssert("[LPStream.write] abstract method not implemented!")

proc writeLp*(
s: LPStream, msg: openArray[byte]
Expand Down
2 changes: 1 addition & 1 deletion libp2p/switch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ method setup*(
return true

method run*(self: Service, switch: Switch) {.base, async: (raises: [CancelledError]).} =
doAssert(false, "Not implemented!")
doAssert(false, "[Service.run] abstract method not implemented!")

method stop*(
self: Service, switch: Switch
Expand Down
Loading
Loading