mirror of
https://github.com/dokku/dokku.git
synced 2025-12-28 16:06:40 +01:00
This doesn't make sense as a port can't be listened to twice on the same domain, so instead we should just fail immediately if someone attempts to perform this action. Refs dokku/dokku-letsencrypt#269
27 lines
639 B
Go
27 lines
639 B
Go
package ports
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// PortMap is a struct that contains a scheme:host-port:container-port mapping
|
|
type PortMap struct {
|
|
// ContainerPort is the port on the container
|
|
ContainerPort int `json:"container_port"`
|
|
|
|
// HostPort is the port on the host
|
|
HostPort int `json:"host_port"`
|
|
|
|
// Scheme is the scheme of the port mapping
|
|
Scheme string `json:"scheme"`
|
|
}
|
|
|
|
func (p PortMap) String() string {
|
|
return fmt.Sprintf("%s:%d:%d", p.Scheme, p.HostPort, p.ContainerPort)
|
|
}
|
|
|
|
// AllowsPersistence returns true if the port map is not to be persisted
|
|
func (p PortMap) AllowsPersistence() bool {
|
|
return p.Scheme == "__internal__"
|
|
}
|