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

Specify a default listening port #98

Closed
NuSkooler opened this issue Dec 14, 2020 · 2 comments · Fixed by #101
Closed

Specify a default listening port #98

NuSkooler opened this issue Dec 14, 2020 · 2 comments · Fixed by #101

Comments

@NuSkooler
Copy link

When using Cabal behind a firewall/NAT environment, we need a way to specify explicit listening port or port ranges such that they can be allowed through. For example, my setup looks like this:

{ internet } <--> pfSense firewall <--> CentOS 7 firewalld <--> cabal

I must NAT through the firewall and open up a port(s) at firewalld as well.

As instructed in chat, a starting point is simply patching swarm.js:

`hyperswarm({ preferredPort: 49737 })`

This does the trick as a test. However, a configurable set of port/port ranges would be better to allow for conflicts/etc. I would submit a PR but I just started poking around with this yesterday and don't know the code base yet 😅

@cblgh
Copy link
Member

cblgh commented Dec 15, 2020

thanks for making the issue @NuSkooler! i like the following way of solving this:

  • choosing a default port and setting it in swarm.js
    • let's make sure to choose a port number that does not conflict with beaker or hyperdivision's projects & products (as there is a chance of overlap in users for cabal & beaker :)
  • allow passing in a port option to cabal-core, which overrides the default port
  • add a --port option to cabal-cli to make it easy for people to use in practice
  • support port in config.yml (thanks kira!)

@hackergrrl
Copy link
Member

This could also be a useful thing to support in cabal's config.yml

cblgh added a commit that referenced this issue Jan 11, 2021
add a preferredPort to listen for hyperswarm connections on. the
preferredPort is smart enough that if it is blocked, hyperswarm will try
preferredPort+1, preferredPort+2 before giving up. see the hyperswarm code:
https://github.com/hyperswarm/network/blob/ad41b0c2ac19dbf92865e481282ba6ac6e513d57/index.js#L150-L162

this allows people with highly configured firewalls to port forward a
single port for cabal, which they can themselves configure in their
clients.

fix #98
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

Successfully merging a pull request may close this issue.

3 participants