api/types/network: Port,PortRange: don't panic on zero values, add Port.Port()#52165
Merged
thaJeztah merged 4 commits intomoby:masterfrom Mar 14, 2026
Merged
api/types/network: Port,PortRange: don't panic on zero values, add Port.Port()#52165thaJeztah merged 4 commits intomoby:masterfrom
thaJeztah merged 4 commits intomoby:masterfrom
Conversation
d7b608c to
41a3b38
Compare
Member
Author
|
oh! I need to rebase this one as it has an extra commit with the "add back replace rules" that was already merged; will do so later |
- Prevent panic when calling .Proto() on zero values - Don't iterate on zero-value port-ranges Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This brings back the Port() method that was defined on the nat.Port type, which was used in many places to (e.g.) do a network.JoinHostPort. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Call out that users should check if the port/port-range is valid before consuming the value returned by String(). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
41a3b38 to
a722b68
Compare
This was referenced Mar 31, 2026
Closed
xingfanxia
added a commit
to xingfanxia/omni
that referenced
this pull request
Apr 9, 2026
Without this, fresh installs hit a moby 29.x daemon panic:
compose expands the unset "${TELEGRAM_CONNECTOR_PORT}" in the
telegram-connector's `expose:` field to an empty string, then
creates the container on-disk with ExposedPorts: { "": {} }.
Every subsequent `ContainerStart` call deserializes that bad
config, constructs a zero-value network.Port{}, and calls
Port.Proto() — which dereferences a zero unique.Handle[IPProtocol]
and nil-pointer-panics at container_operations.go:113.
The moby fix (moby/moby#52165) is on master but has not been
backported to docker-29.x as of 29.4.0, so the defensive move
is to make sure the env var is always defined.
4015 continues the 4xxx connector-port sequence
(4013=filesystem, 4014=nextcloud, 4015=telegram).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
xingfanxia
added a commit
to xingfanxia/omni
that referenced
this pull request
Apr 9, 2026
Without this, fresh installs hit a moby 29.x daemon panic:
compose expands the unset "${TELEGRAM_CONNECTOR_PORT}" in the
telegram-connector's `expose:` field to an empty string, then
creates the container on-disk with ExposedPorts: { "": {} }.
Every subsequent `ContainerStart` call deserializes that bad
config, constructs a zero-value network.Port{}, and calls
Port.Proto() — which dereferences a zero unique.Handle[IPProtocol]
and nil-pointer-panics at container_operations.go:113.
The moby fix (moby/moby#52165) is on master but has not been
backported to docker-29.x as of 29.4.0, so the defensive move
is to make sure the env var is always defined.
4015 continues the 4xxx connector-port sequence
(4013=filesystem, 4014=nextcloud, 4015=telegram).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
xingfanxia
added a commit
to xingfanxia/omni
that referenced
this pull request
Apr 10, 2026
Without this, fresh installs hit a moby 29.x daemon panic:
compose expands the unset "${TELEGRAM_CONNECTOR_PORT}" in the
telegram-connector's `expose:` field to an empty string, then
creates the container on-disk with ExposedPorts: { "": {} }.
Every subsequent `ContainerStart` call deserializes that bad
config, constructs a zero-value network.Port{}, and calls
Port.Proto() — which dereferences a zero unique.Handle[IPProtocol]
and nil-pointer-panics at container_operations.go:113.
The moby fix (moby/moby#52165) is on master but has not been
backported to docker-29.x as of 29.4.0, so the defensive move
is to make sure the env var is always defined.
4015 continues the 4xxx connector-port sequence
(4013=filesystem, 4014=nextcloud, 4015=telegram).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
xingfanxia
added a commit
to xingfanxia/omni
that referenced
this pull request
Apr 10, 2026
Without this, fresh installs hit a moby 29.x daemon panic:
compose expands the unset "${TELEGRAM_CONNECTOR_PORT}" in the
telegram-connector's `expose:` field to an empty string, then
creates the container on-disk with ExposedPorts: { "": {} }.
Every subsequent `ContainerStart` call deserializes that bad
config, constructs a zero-value network.Port{}, and calls
Port.Proto() — which dereferences a zero unique.Handle[IPProtocol]
and nil-pointer-panics at container_operations.go:113.
The moby fix (moby/moby#52165) is on master but has not been
backported to docker-29.x as of 29.4.0, so the defensive move
is to make sure the env var is always defined.
4015 continues the 4xxx connector-port sequence
(4013=filesystem, 4014=nextcloud, 4015=telegram).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
api/types/network: Port,PortRange: don't panic on zero values
api/types/network: add Port.Port()
This brings back the Port() method that was defined on the nat.Port type,
which was used in many places to (e.g.) do a network.JoinHostPort.
api/types/network: Port, PortRange: update godoc for "String()"
Call out that users should check if the port/port-range is valid
before consuming the value returned by String().
api/types/network: use blackbox testing for ports
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)