2015-02-19 22:21:05 -08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"github.com/docker/libnetwork"
|
2015-04-13 18:40:42 +00:00
|
|
|
"github.com/docker/libnetwork/pkg/options"
|
2015-02-19 22:21:05 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2015-02-22 21:11:12 -08:00
|
|
|
ip, net, _ := net.ParseCIDR("192.168.100.1/24")
|
|
|
|
net.IP = ip
|
2015-02-19 22:21:05 -08:00
|
|
|
|
2015-04-13 18:40:42 +00:00
|
|
|
options := options.Generic{"AddressIPv4": net}
|
|
|
|
controller := libnetwork.New()
|
|
|
|
netw, err := controller.NewNetwork("simplebridge", "dummy", options)
|
2015-02-19 22:21:05 -08:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
fmt.Printf("Network=%#v\n", netw)
|
|
|
|
}
|