fixed tcp/udp I/O, deadlock, nil dereference; improved docker watcher, idlewatcher, loading page

This commit is contained in:
yusing
2024-09-23 00:49:46 +08:00
parent 96bce79e4b
commit 090b73d287
31 changed files with 687 additions and 468 deletions

View File

@@ -1,6 +1,7 @@
package provider
import (
"fmt"
"regexp"
"strconv"
"strings"
@@ -26,6 +27,10 @@ func DockerProviderImpl(dockerHost string) (ProviderImpl, E.NestedError) {
return &DockerProvider{dockerHost: dockerHost, hostname: hostname}, nil
}
func (p *DockerProvider) String() string {
return fmt.Sprintf("docker:%s", p.dockerHost)
}
func (p *DockerProvider) NewWatcher() W.Watcher {
return W.NewDockerWatcher(p.dockerHost)
}
@@ -145,7 +150,7 @@ func (p *DockerProvider) entriesFromContainerLabels(container D.Container) (M.Ra
entryPortSplit := strings.Split(entry.Port, ":")
if len(entryPortSplit) == 2 && entryPortSplit[1] == containerPort {
entryPortSplit[1] = publicPort
} else if entryPortSplit[0] == containerPort {
} else if len(entryPortSplit) == 1 && entryPortSplit[0] == containerPort {
entryPortSplit[0] = publicPort
}
entry.Port = strings.Join(entryPortSplit, ":")