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

[Enhancement] Make Invidious listen dual stack ipv4 and ipv6 #4705

Open
unixfox opened this issue May 18, 2024 · 3 comments
Open

[Enhancement] Make Invidious listen dual stack ipv4 and ipv6 #4705

unixfox opened this issue May 18, 2024 · 3 comments
Labels
enhancement Improvement of an existing feature

Comments

@unixfox
Copy link
Member

unixfox commented May 18, 2024

Is your enhancement request related to a problem? Please describe.
By default, invidious does not listen on IPv6.

Describe the solution you'd like
I would like to have invidious listening on ipv4 and ipv6 at the same time.

Describe alternatives you've considered

Additional context
Related to #4693

@unixfox unixfox added the enhancement Improvement of an existing feature label May 18, 2024
@unixfox
Copy link
Member Author

unixfox commented May 18, 2024

Forcing Kemal.config.host_binding to :: works for Linux but not FreeBSD, see here: #4693 (comment)

I'm not sure how to tackle this improvement. Maybe we should have an if case for BSD distributions in order to not listen on ::.

@GlowingUmbreon
Copy link

It may be possible to just add a note to the documentation that mentions that invidious listens to a IPv6 address and you will need to either set the address manually or to enable the IPv4 address or set the IPv4, IPv6 translation on your operating system based on requirements.
It appears that most Linux distros should work out of the box, if you are on a operating system or Distro that does does not have this feature enabled by default it is likely you are already comfortable with making changes to the config to get this working.

The main concern I have with this is breaking user's existing configurations. If any invidious instance maintainers rely on listening to IPv4 and the default changes without warning this could potentially be a problem. I know my configuration is currently susceptible to this.

@SamantazFox
Copy link
Member

SamantazFox commented May 18, 2024

Listening on both is possible, the stdlib supports dual stack:

require "http/server"

server = HTTP::Server.new { }
server.bind_tcp("127.0.0.1", 10080)
server.bind_tcp("::1", 10080)

server.each_address do |addr|
  pp addr
end
# output
Socket::IPAddress(127.0.0.1:10080)
Socket::IPAddress([::1]:10080)

But we need to open a pull request for kemal, as it only supports binding to a single IP:
https://github.com/kemalcr/kemal/blob/5554d3d2f1b7496e850df48663c48765aa8af511/src/kemal.cr#L51-L61


Edit: I realized that we could create our own HTTP::Server, store it in Kemal.config.server and then call Kemal.run, though.

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

No branches or pull requests

3 participants