Skip to content

Commit

Permalink
fix(wakucanary): add enr record to builder (#1882)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpavlin committed Aug 4, 2023
1 parent 2fc4884 commit 831a093
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/wakucanary/wakucanary.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import
libp2p/nameresolving/dnsresolver,
libp2p/multicodec
import
../../waku/v2/waku_enr,
../../waku/v2/node/peer_manager,
../../waku/v2/waku_core,
../../waku/v2/waku_node
Expand Down Expand Up @@ -148,11 +149,21 @@ proc main(rng: ref HmacDrbgContext): Future[int] {.async.} =
wssEnabled = isWss,
)

var enrBuilder = EnrBuilder.init(nodeKey)

let recordRes = enrBuilder.build()
let record =
if recordRes.isErr():
error "failed to create enr record", error=recordRes.error
quit(QuitFailure)
else: recordRes.get()

if isWss and (conf.websocketSecureKeyPath.len == 0 or
conf.websocketSecureCertPath.len == 0):
error "WebSocket Secure requires key and certificate, see --help"
return 1

builder.withRecord(record)
builder.withNetworkConfiguration(netConfig.tryGet())
builder.withSwitchConfiguration(
secureKey = some(conf.websocketSecureKeyPath),
Expand Down

0 comments on commit 831a093

Please sign in to comment.