MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / transPortToStr

Function transPortToStr

agent/app/service/container.go:2024–2039  ·  view source on GitHub ↗
(ports []container.Port)

Source from the content-addressed store, hash-verified

2022 return itemPorts, nil
2023}
2024func transPortToStr(ports []container.Port) []string {
2025 var (
2026 ipv4Ports []container.Port
2027 ipv6Ports []container.Port
2028 )
2029 for _, port := range ports {
2030 if strings.Contains(port.IP, ":") {
2031 ipv6Ports = append(ipv6Ports, port)
2032 } else {
2033 ipv4Ports = append(ipv4Ports, port)
2034 }
2035 }
2036 list1 := simplifyPort(ipv4Ports)
2037 list2 := simplifyPort(ipv6Ports)
2038 return append(list1, list2...)
2039}
2040func simplifyPort(ports []container.Port) []string {
2041 var datas []string
2042 if len(ports) == 0 {

Callers 3

PageComposeMethod · 0.85
loadContainerPortForInfoFunction · 0.85
searchWithFilterFunction · 0.85

Calls 1

simplifyPortFunction · 0.85

Tested by

no test coverage detected