Skip to content

Commit

Permalink
Make connecting to relays work
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaBlume99 committed Jul 17, 2023
1 parent 67e78e7 commit 7525aed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions relay/relay.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ async function main () {
const node = await createLibp2p({
peerId : id,
addresses: {
listen: ['/ip4/0.0.0.0/tcp/5555/ws']
listen: ['/ip4/0.0.0.0/tcp/5555/ws'],
// TODO check "What is next?" section
// announce: ['/dns4/auto-relay.libp2p.io/tcp/443/wss/p2p/QmWDn2LY8nannvSWJzruUYoLZ4vV83vfCBwd8DipvdgQc3']
announce: ['/dns4/auto-relay.libp2p.io/tcp/443/wss/p2p/QmWDn2LY8nannvSWJzruUYoLZ4vV83vfCBwd8DipvdgQc3']
},
transports: [
webSockets()
Expand All @@ -27,19 +27,19 @@ async function main () {
yamux(),
mplex()
],
/*services: {
services: {
identify: identifyService(),
relay: circuitRelayServer()
}*/
relay: {
}
/*relay: {
enabled: true,
hop: {
enabled: true
},
advertise: {
enabled: true,
}
}
}*/
})

await node.handle("/trouperelay/keepalive", async ({ connection, stream }) => {
Expand Down
10 changes: 5 additions & 5 deletions rt/src/p2p/p2p.mts
Original file line number Diff line number Diff line change
Expand Up @@ -733,10 +733,10 @@ async function createLibp2p (_options) {
transports: [
tcp(),
webSockets(),
/*circuitRelayTransport({
circuitRelayTransport({
discoverRelays: 2, //AB: what to set this to?
reservationConcurrency : 2,
})*/
})
],
streamMuxers: [
yamux(),
Expand All @@ -753,9 +753,9 @@ async function createLibp2p (_options) {
interval: 20e3
})*/
],
/*services: {
services: {
identify: identifyService()
},*/
},
relay: {
enabled: true,
autoRelay: {
Expand Down Expand Up @@ -1046,7 +1046,7 @@ async function getPeerInfo(id:string) : Promise<PeerId>{
} else {
debug (`try_find_peer: attempt ${n_attempts} failed with ${nPeers()} nodes connected`)
// addPending (try_find_peer);
setTimeout (try_find_peer, 5000)
setTimeout (try_find_peer, 500)
}
}
}
Expand Down

0 comments on commit 7525aed

Please sign in to comment.