mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-26 11:01:07 +01:00
smarter port selection
This commit is contained in:
@@ -201,6 +201,11 @@ func selectPort(c *types.Container) uint16 {
|
||||
}
|
||||
|
||||
func selectPortInternal(c *types.Container, getPort func(types.Port) uint16) uint16 {
|
||||
for _, p := range c.Ports {
|
||||
if isWellKnownHTTPPort(p.PrivatePort) {
|
||||
return getPort(p)
|
||||
}
|
||||
}
|
||||
for _, p := range c.Ports {
|
||||
if port := getPort(p); port != 0 {
|
||||
return port
|
||||
@@ -208,3 +213,8 @@ func selectPortInternal(c *types.Container, getPort func(types.Port) uint16) uin
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func isWellKnownHTTPPort(port uint16) bool {
|
||||
_, ok := wellKnownHTTPPorts[port]
|
||||
return ok
|
||||
}
|
||||
Reference in New Issue
Block a user