Atlas › Test

TestLookupLocalhostIPWithIPv6

Exact test identity: go.temporal.io/server/temporal/environment/TestLookupLocalhostIPWithIPv6

Package
go.temporal.io/server/temporal/environment
Suite / test hierarchy
TestLookupLocalhostIPWithIPv6
Test
TestLookupLocalhostIPWithIPv6
Introduced at
env.go ×1 Frontier kind: Joint frontier
Covered ranges
3
Covered lines
8
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/temporal/environment/env.go 8 covered LOC · 3 ranges

Open complete file

39 )
40
41 > func lookupLocalhostIP(domain string) string { env.go
42 > // lookup localhost and favor the first ipv4 address
43 > // unless there are only ipv6 addresses available
44 > ips, err := net.LookupIP(domain)
45 > if err != nil || len(ips) == 0 {
46 // fallback to default instead of error
47 return localhostIPDefault
48 }
49 > for _, ip := range ips { env.go
50 > if ip4 := ip.To4(); ip4 != nil {
51 return ip4.String()
52 }
53 }
54 > return ips[len(ips)-1].String() env.go
55 }
56