MCPcopy Index your code
hub / github.com/coder/envbox / BridgeIPFromCIDR

Function BridgeIPFromCIDR

dockerutil/network.go:11–16  ·  view source on GitHub ↗
(cidr string)

Source from the content-addressed store, hash-verified

9var DefaultBridgeCIDR = "172.19.0.1/30"
10
11func BridgeIPFromCIDR(cidr string) (net.IP, int) {
12 ipNet := mustParseIPv4Net(cidr)
13 prefixLen, _ := ipNet.Mask.Size()
14 bridgeIP := mustNextIPv4(ipNet.IP, 1)
15 return bridgeIP, prefixLen
16}
17
18func mustParseIPv4Net(s string) *net.IPNet {
19 _, n, err := net.ParseCIDR(s)

Callers 1

dockerdArgsFunction · 0.92

Calls 2

mustParseIPv4NetFunction · 0.85
mustNextIPv4Function · 0.85

Tested by

no test coverage detected