1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
11
// GetIPv4Address iterates through the addresses expecting the format from
12
// func (ifi *net.Interface) Addrs() ([]net.Addr, error)
13
func GetIPv4Address(addresses []net.Addr) (string, error) {
14
for _, addr := range addresses {
15
ip, _, err := net.ParseCIDR(addr.String())
23
return ipv4.String(), nil
25
return "", fmt.Errorf("no addresses match")