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

Allow configuration for IPv4 binding #769

Open
3 of 5 tasks
Sytten opened this issue Mar 13, 2024 · 3 comments
Open
3 of 5 tasks

Allow configuration for IPv4 binding #769

Sytten opened this issue Mar 13, 2024 · 3 comments
Labels
feat New feature or request.

Comments

@Sytten
Copy link

Sytten commented Mar 13, 2024

Preflight checklist

Ory Network Project

No response

Describe your problem

Golang by default binds to IPv6, which doesn't work for everybody.
It would be nice if we could specify tcp4 for:

return net.Listen("tcp", address)

Describe your ideal solution

Ideally the parent service config can pass down an override for the IPv4 vs IPv6 binding with a default to IPv6.
I can push the PR, but I am not sure if we want to offer another function to avoid a breaking change in the interface.

func MakeListener(network string, address string, socketPermission *configx.UnixPermission) (net.Listener, error)

Workarounds or alternatives

There is none right now.

Version

Kratos 1.1.0

Additional Context

No response

@Sytten Sytten added the feat New feature or request. label Mar 13, 2024
@alnr
Copy link
Contributor

alnr commented Mar 28, 2024

This should be possible by specifying an IPv4 literal as the listening address, no?

Please reopen if I'm mistaken.

@alnr alnr closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2024
@Sytten
Copy link
Author

Sytten commented Mar 28, 2024

You are mistaken, by default it will always use IPv6 even with an IPv4 address is given at least for common cases like 0.0.0.0

@alnr alnr reopened this Mar 29, 2024
@alnr
Copy link
Contributor

alnr commented Mar 29, 2024

Confirmed, and very weird. Go listens on IPv6 given net.Listen("tcp", "0.0.0.0:0").

We can't change any interfaces.

On my machine, net.Listen("tcp", "127.0.0.1:0") binds a IPv4 address. So the problem is probably only acute if you want to listen on all IPv4 addresses (which is not currently possible)?

We could add a special case just for "0.0.0.0" and force IPv4 in that case. WDYT?

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

No branches or pull requests

2 participants