1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-10-05 18:03:21 +08:00

Show docker swarm used ports

This commit is contained in:
Jonathan Leibiusky (@xetorthio)
2016-12-05 09:21:43 -03:00
parent a7811b4e33
commit 69050373d7
10 changed files with 110 additions and 15 deletions

View File

@@ -28,6 +28,19 @@ type Instance struct {
Mem string `json:"mem"`
Cpu string `json:"cpu"`
Ports []uint16 `json:"ports"`
tempPorts []uint16 `json:"-"`
}
func (i *Instance) setUsedPort(port uint16) {
rw.Lock()
defer rw.Unlock()
for _, p := range i.tempPorts {
if p == port {
return
}
}
i.tempPorts = append(i.tempPorts, port)
}
func (i *Instance) IsConnected() bool {