Skip to content

Commit

Permalink
Add server option as well
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Aug 29, 2023
1 parent bc83172 commit ee8ce6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ async function connectThroughNode (c, address, socket) {

const hs = c.handshake.final()

if (c.relayThrough) {
if (c.relayThrough || payload.relayThrough) {
// TODO
}

Expand Down
6 changes: 4 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = class Server extends EventEmitter {
this.closed = false
this.firewall = opts.firewall || (() => false)
this.holepunch = opts.holepunch || (() => true)
this.relayThrough = opts.relayThrough || null
this.createHandshake = opts.createHandshake || defaultCreateHandshake
this.createSecretStream = opts.createSecretStream || defaultCreateSecretStream

Expand Down Expand Up @@ -234,7 +235,8 @@ module.exports = class Server extends EventEmitter {
id: hs.rawStream ? hs.rawStream.id : 0,
seq: 0
},
secretStream: {}
secretStream: {},
relayThrough: this.relayThrough?.remotePublicKey || null
})
} catch (err) {
safetyCatch(err)
Expand All @@ -255,7 +257,7 @@ module.exports = class Server extends EventEmitter {
return hs
}

if (remotePayload.relayThrough) {
if (this.relayThrough || remotePayload.relayThrough) {
// TODO
}

Expand Down

0 comments on commit ee8ce6e

Please sign in to comment.