Skip to content

Listening on INADDR6_ANY not possible #1582

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

Closed
Grimeton opened this issue Apr 30, 2020 · 12 comments · Fixed by #2146 or #5133
Closed

Listening on INADDR6_ANY not possible #1582

Grimeton opened this issue Apr 30, 2020 · 12 comments · Fixed by #2146 or #5133
Labels
bug Something isn't working
Milestone

Comments

@Grimeton
Copy link

Hi,

when starting the server while trying to listen on INADDR6_ANY, also known as "::", the server errors out. It's not accepting a simple "::". According to RFC4038 the addresses should be placed in brackets, even when not using a port, so the "::" turns into "[::]", doesn't work either.

After switching to the --bind-addr parameter the situation got worse, because now, using "::" together with a port isn't possible anymore. When following RFC4038 I'm neither able to use "[::]", nor "[::]:1234".

Same happens with INADDR6_LOOPBACK, e.g. "::1" or "[::1]" or "[::1]:1234".

KR,

G.

@Grimeton Grimeton changed the title Listening on INADDR6_ANY not posisble Listening on INADDR6_ANY not possible Apr 30, 2020
@nhooyr
Copy link
Contributor

nhooyr commented May 18, 2020

Nice catch!

@nhooyr nhooyr added this to the v3.4.0 milestone May 18, 2020
@nhooyr nhooyr modified the milestones: v3.4.0, v3.5.0 May 27, 2020
@nhooyr nhooyr modified the milestone: v3.5.0 Aug 25, 2020
@nhooyr nhooyr added the bug Something isn't working label Aug 25, 2020
@nhooyr nhooyr modified the milestones: v3.5.0, v3.5.1 Aug 29, 2020
@code-asher code-asher self-assigned this Sep 30, 2020
code-asher added a commit that referenced this issue Sep 30, 2020
code-asher added a commit that referenced this issue Sep 30, 2020
@code-asher code-asher linked a pull request Sep 30, 2020 that will close this issue
@code-asher
Copy link
Member

Fixed and will be in 3.6.0.

@cycl0ne
Copy link

cycl0ne commented May 26, 2021

still not working or im not using the config.yaml correct, got the same errors with bind-addr:

Running with 3.10.2

running with: --host :: works

@code-asher
Copy link
Member

@cycl0ne something like this should work:

bind-addr: "[1234:1234:1234::1234]:443"

If it doesn't could you open a new issue with the bind-addr line you are trying to use and the code-server output? Thanks!

@despiegk
Copy link

despiegk commented Jan 8, 2022

root@vm1:~# code-server --host ::
[2022-01-08T03:16:47.810Z] info  code-server 4.0.1 735c6da829535969ff7193c79379299e4a1cb9bc
[2022-01-08T03:16:47.812Z] info  Using user-data-dir ~/.local/share/code-server
[2022-01-08T03:16:47.834Z] error Invalid URL: http://:::8080
root@vm1:~# code-server --host "[::]:8080"
[2022-01-08T03:17:02.380Z] info  code-server 4.0.1 735c6da829535969ff7193c79379299e4a1cb9bc
[2022-01-08T03:17:02.383Z] info  Using user-data-dir ~/.local/share/code-server
[2022-01-08T03:17:02.425Z] error getaddrinfo ENOTFOUND ::]:808

doesn't work for me

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 10, 2022

cc @code-asher - any ideas?^

@code-asher
Copy link
Member

--bind-addr "[::]:8080" should be correct but it seems changes to ensureAddress broke IPv6. Node expects :: but URL expects [::] so we have to convert.

Here we convert when listening:

// [] is the correct format when using :: but Node errors with them.
server.listen(port, host.replace(/^\[|\]$/g, ""), onListen)

Se we could need to convert here as well:

return new URL(`${protocol}://${addr.address}:${addr.port}`)

We can probably just check if it has : and if so wrap it in brackets.

@code-asher code-asher reopened this Jan 10, 2022
@code-asher
Copy link
Member

Actually there is a family property we can use to see if it is IPv6.

@GamingRebirth
Copy link

GamingRebirth commented Mar 14, 2022

It still does not work for me. Using version 4.1.0

@jsjoeio jsjoeio modified the milestones: v3.6.0, March 2022 Mar 14, 2022
@jsjoeio jsjoeio modified the milestones: March 2022, April 2022 Mar 22, 2022
@misskniss misskniss removed this from the April 2022 milestone Mar 29, 2022
@misskniss misskniss added this to the On Deck - High Priority milestone Mar 29, 2022
@qiurigao
Copy link

It still does not work for me. Using version 4.3.0

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 31, 2022

This hasn't been fixed yet. But we think we can fix it in the near future.

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 31, 2022

PRs welcome!

awfulcooking added a commit to awfulcooking/code-server that referenced this issue Apr 26, 2022
Wrap IPv6 addresses in square brackets when making URL in ensureAddress,
fixing regression (coder#1582)
awfulcooking added a commit to awfulcooking/code-server that referenced this issue Apr 26, 2022
Wrap IPv6 addresses in square brackets when making URL in ensureAddress,
fixing regression (coder#1582)
awfulcooking added a commit to awfulcooking/code-server that referenced this issue Apr 26, 2022
Wrap IPv6 addresses in square brackets when making URL in ensureAddress,
fixing regression (coder#1582)
jsjoeio pushed a commit that referenced this issue Apr 26, 2022
Wrap IPv6 addresses in square brackets when making URL in ensureAddress,
fixing regression (#1582)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
9 participants