mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
nat: enable upper case proto
We only accepted lower case proto: tcp, udp. This patch will enable us to use upper case of proto such as: EXPOSE 1234/TCP Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
parent
eda9c14cb9
commit
2706426434
1 changed files with 2 additions and 2 deletions
|
@ -140,7 +140,7 @@ func ParsePortSpecs(ports []string) (map[Port]struct{}, map[Port][]PortBinding,
|
||||||
return nil, nil, fmt.Errorf("Invalid ranges specified for container and host Ports: %s and %s", containerPort, hostPort)
|
return nil, nil, fmt.Errorf("Invalid ranges specified for container and host Ports: %s and %s", containerPort, hostPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !validateProto(proto) {
|
if !validateProto(strings.ToLower(proto)) {
|
||||||
return nil, nil, fmt.Errorf("Invalid proto: %s", proto)
|
return nil, nil, fmt.Errorf("Invalid proto: %s", proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ func ParsePortSpecs(ports []string) (map[Port]struct{}, map[Port][]PortBinding,
|
||||||
if len(hostPort) > 0 {
|
if len(hostPort) > 0 {
|
||||||
hostPort = strconv.FormatUint(startHostPort+i, 10)
|
hostPort = strconv.FormatUint(startHostPort+i, 10)
|
||||||
}
|
}
|
||||||
port := NewPort(proto, containerPort)
|
port := NewPort(strings.ToLower(proto), containerPort)
|
||||||
if _, exists := exposedPorts[port]; !exists {
|
if _, exists := exposedPorts[port]; !exists {
|
||||||
exposedPorts[port] = struct{}{}
|
exposedPorts[port] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue