Fetch the default subnet from weave to use as the ipam driver 'pool'

This commit is contained in:
Bryan Boreham committed 2015-12-08 16:59:34 +00:00
1 parent ec3de1a072
commit f87876c1c3
3 files changed
+20 -2

No files matched your search

+9
View File
@@ -30,6 +30,15 @@ func (client *Client) ReleaseIP(ID string) error {
return err
}
func (client *Client) DefaultSubnet() (*net.IPNet, error) {
cidr, err := httpVerb("GET", fmt.Sprintf("%s/ipinfo/defaultsubnet", client.baseUrl), nil)
if err != nil {
return nil, err
}
_, ipnet, err := net.ParseCIDR(cidr)
return ipnet, err
}
func parseIP(body string) (*net.IPNet, error) {
ip, ipnet, err := net.ParseCIDR(string(body))
if err != nil {