MCPcopy Index your code
hub / github.com/coder/coder / hostsToIPStrings

Function hostsToIPStrings

vpn/tunnel.go:710–722  ·  view source on GitHub ↗

hostsToIPStrings returns a slice of all unique IP addresses in the values of the given map.

(hosts map[dnsname.FQDN][]netip.Addr)

Source from the content-addressed store, hash-verified

708// hostsToIPStrings returns a slice of all unique IP addresses in the values
709// of the given map.
710func hostsToIPStrings(hosts map[dnsname.FQDN][]netip.Addr) []string {
711 seen := make(map[netip.Addr]struct{})
712 var result []string
713 for _, inner := range hosts {
714 for _, elem := range inner {
715 if _, exists := seen[elem]; !exists {
716 seen[elem] = struct{}{}
717 result = append(result, elem.String())
718 }
719 }
720 }
721 return result
722}
723
724// the following are taken from sloghuman:
725

Callers 2

convertAgentsLockedMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected