Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utp: true causes whoami to return wrong port #32

Open
max-mapper opened this issue Sep 27, 2017 · 2 comments
Open

utp: true causes whoami to return wrong port #32

max-mapper opened this issue Sep 27, 2017 · 2 comments

Comments

@max-mapper
Copy link
Collaborator

when running this code inside a docker container:

var swarm = require('discovery-swarm')   
var defaults = require('datland-swarm-defaults')()
var sw = swarm({
  dns: {
    servers: defaults.dns.server
  }
})

sw.listen(9000, console.log.bind(console))

I get the debug discovery-channel whoami() succeeded, I am: { port: 9000, host: '104.197.167.83' } +113ms

But running this:

var swarm = require('discovery-swarm')   
var defaults = require('datland-swarm-defaults')()
var sw = swarm({
  utp: false,
  dns: {
    servers: defaults.dns.server
  }
})

sw.listen(9000, console.log.bind(console))

I get debug discovery-channel whoami() succeeded, I am: { port: 57969, host: '104.197.167.83' } +118ms

In this case I expect 57969 from both cases, 9000 is the internal port in the docker container and is the wrong port to return

@max-mapper
Copy link
Collaborator Author

I think related to #11 (comment)

@mafintosh
Copy link
Owner

It's unrelated. The port is the public port the dht sees when using utp (they share a socket in order for hole punching to work)

Why are you explicitly passing a port to listen on instead of having the swarm pick it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants