Allow API to bind to ipv6 addresses #16950

Merged
merged 1 commit into from Oct 16, 2015

Conversation

Projects
None yet
6 participants
@cpuguy83
Contributor

cpuguy83 commented Oct 12, 2015

Use net.SplitHostPort which supports ipv6 rather than relying on
splitting on :

Fixes #15557

Allow API to bind to ipv6 addresses
Use `net.SplitHostPort` which supports ipv6 rather than relying on
splitting on `:`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83

This comment has been minimized.

Show comment
Hide comment
@cpuguy83

cpuguy83 Oct 12, 2015

Contributor

Interestingly the unit tests fail on Darwin where url.Parse does not like to parse [<addr>]:... which seems odd... but also this is no different than before other than we have a test case for it.

Contributor

cpuguy83 commented Oct 12, 2015

Interestingly the unit tests fail on Darwin where url.Parse does not like to parse [<addr>]:... which seems odd... but also this is no different than before other than we have a test case for it.

@calavera

This comment has been minimized.

Show comment
Hide comment
@calavera

calavera Oct 16, 2015

Contributor

LGTM

Contributor

calavera commented Oct 16, 2015

LGTM

@runcom

This comment has been minimized.

Show comment
Hide comment
@runcom

runcom Oct 16, 2015

Member

LGTM

Member

runcom commented Oct 16, 2015

LGTM

runcom added a commit that referenced this pull request Oct 16, 2015

@runcom runcom merged commit 4fc97e4 into moby:master Oct 16, 2015

5 checks passed

docker/dco-signed All commits signed
Details
experimental Jenkins build Docker-PRs-experimental 9006 has succeeded
Details
janky Jenkins build Docker-PRs 17768 has succeeded
Details
userns Jenkins build Docker-PRs-userns 132 has succeeded
Details
windows Jenkins build Windows-PRs 14981 has succeeded
Details
if err != nil && p == 0 {
return "", fmt.Errorf("Invalid bind address format: %s", tryAddr)
}
+
+ if net.ParseIP(host).To4() == nil && strings.Contains(host, ":") {

This comment has been minimized.

@narqo

narqo Nov 13, 2015

Contributor

@cpuguy83 could you explain why didn't you use net.JoinHostPort() here?

@narqo

narqo Nov 13, 2015

Contributor

@cpuguy83 could you explain why didn't you use net.JoinHostPort() here?

This comment has been minimized.

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

I'm not sure why I would want to join here.
I'm verifying that the IP is indeed an ipv6 address, I don't want the port.

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

I'm not sure why I would want to join here.
I'm verifying that the IP is indeed an ipv6 address, I don't want the port.

This comment has been minimized.

@narqo

narqo Nov 13, 2015

Contributor

My bad, sorry. What I wanted to ask was, couldn't the whole chunk of code be written as:

return fmt.Sprintf("tcp://%s%s", net.JoinHostPort(host, port), u.Path), nil
@narqo

narqo Nov 13, 2015

Contributor

My bad, sorry. What I wanted to ask was, couldn't the whole chunk of code be written as:

return fmt.Sprintf("tcp://%s%s", net.JoinHostPort(host, port), u.Path), nil

This comment has been minimized.

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

Seems like it could!

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

Seems like it could!

This comment has been minimized.

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

Care to make a PR?

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

Care to make a PR?

This comment has been minimized.

@narqo

narqo Nov 13, 2015

Contributor

Sure, just wanted to be sure I haven't missed anything.

@narqo

narqo Nov 13, 2015

Contributor

Sure, just wanted to be sure I haven't missed anything.

This comment has been minimized.

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

❤️

@cpuguy83

cpuguy83 Nov 13, 2015

Contributor

❤️

@cpuguy83 cpuguy83 deleted the cpuguy83:support_ipv6_in_host_parser branch Jan 11, 2016

@aanand aanand referenced this pull request in docker/docker-py Jul 20, 2016

Closed

Support IPv6 addresses in DOCKER_HOST #1135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment