mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
cc4f27f6af
* Modified NB API with self referential var-aarg for future proofing the APIs * Modified Driver API's option parameter to be a Map of interface{} Signed-off-by: Madhu Venugopal <madhu@docker.com>
25 lines
490 B
Go
25 lines
490 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net"
|
|
|
|
"github.com/docker/libnetwork"
|
|
"github.com/docker/libnetwork/pkg/options"
|
|
)
|
|
|
|
func main() {
|
|
ip, net, _ := net.ParseCIDR("192.168.100.1/24")
|
|
net.IP = ip
|
|
|
|
options := options.Generic{"AddressIPv4": net}
|
|
controller := libnetwork.New()
|
|
netType := "bridge"
|
|
err := controller.ConfigureNetworkDriver(netType, options)
|
|
netw, err := controller.NewNetwork(netType, "dummy")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Printf("Network=%#v\n", netw)
|
|
}
|