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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user