Skip to content

Commit acc1c9a

Browse files
committed
fix: nph
1 parent b54b859 commit acc1c9a

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

libp2p.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ requires "nim >= 1.6.0",
1111
"nimcrypto >= 0.6.0 & < 0.7.0", "dnsclient >= 0.3.0 & < 0.4.0", "bearssl >= 0.2.5",
1212
"chronicles >= 0.10.2", "chronos >= 4.0.3", "metrics", "secp256k1", "stew#head",
1313
"websock", "unittest2",
14-
"https://github.com/status-im/nim-quic.git#757171ae59c7ebb993f3400053baeded4a2762f7",
14+
"https://github.com/status-im/nim-quic.git#v0.2.0",
1515
"https://github.com/status-im/nim-mbedtls.git"
1616

1717
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use

libp2p/builders.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ import services/wildcardresolverservice
3838
export switch, peerid, peerinfo, connection, multiaddress, crypto, errors
3939

4040
type
41-
TransportProvider* {.public.} = proc(upgr: Upgrade, privateKey: PrivateKey): Transport {.gcsafe, raises: [].}
41+
TransportProvider* {.public.} =
42+
proc(upgr: Upgrade, privateKey: PrivateKey): Transport {.gcsafe, raises: [].}
4243

4344
SecureProtocol* {.pure.} = enum
4445
Noise

libp2p/transports/quictransport.nim

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ method close*(session: QuicSession) {.async: (raises: []).} =
8484
proc getStream*(
8585
session: QuicSession, direction = Direction.In
8686
): Future[QuicStream] {.async: (raises: [QuicTransportError]).} =
87-
try:
87+
try:
8888
var stream: Stream
8989
case direction
9090
of Direction.In:
@@ -156,7 +156,7 @@ func new*(_: type QuicTransport, u: Upgrade, privateKey: PrivateKey): QuicTransp
156156
return QuicTransport(
157157
upgrader: QuicUpgrade(ms: u.ms),
158158
privateKey: privateKey,
159-
client: QuicClient.init(tlsConfig)
159+
client: QuicClient.init(tlsConfig),
160160
)
161161
except QuicConfigError as exc:
162162
doAssert false, "invalid quic setup: " & $exc.msg
@@ -173,13 +173,10 @@ method start*(
173173
#TODO handle multiple addr
174174

175175
let pubkey = self.privateKey.getPublicKey().valueOr:
176-
doAssert false, "could not obtain public key"
177-
return
176+
doAssert false, "could not obtain public key"
177+
return
178178

179-
let keypair = KeyPair(
180-
seckey: self.privateKey,
181-
pubkey: pubkey
182-
)
179+
let keypair = KeyPair(seckey: self.privateKey, pubkey: pubkey)
183180

184181
let certPair = generate(keypair, EncodingFormat.PEM)
185182

@@ -238,7 +235,9 @@ proc wrapConnection(
238235

239236
method accept*(
240237
self: QuicTransport
241-
): Future[connection.Connection] {.async: (raises: [transport.TransportError, CancelledError]).} =
238+
): Future[connection.Connection] {.
239+
async: (raises: [transport.TransportError, CancelledError])
240+
.} =
242241
doAssert not self.listener.isNil, "call start() before calling accept()"
243242
try:
244243
let connection = await self.listener.accept()
@@ -253,10 +252,12 @@ method dial*(
253252
hostname: string,
254253
address: MultiAddress,
255254
peerId: Opt[PeerId] = Opt.none(PeerId),
256-
): Future[connection.Connection] {.async: (raises: [transport.TransportError, CancelledError]).} =
255+
): Future[connection.Connection] {.
256+
async: (raises: [transport.TransportError, CancelledError])
257+
.} =
257258
try:
258259
let quicConnection = await self.client.dial(initTAddress(address).tryGet)
259-
return await self.wrapConnection(quicConnection, Direction.In)
260+
return await self.wrapConnection(quicConnection, Direction.In)
260261
except CancelledError as e:
261262
raise e
262263
except CatchableError as e:

0 commit comments

Comments
 (0)