mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
e797f80ad4
- Added api enhancement to pass driver specific config - Refactored simple bridge driver code for driver specific config - Added an undocumented option to add non-default bridges without manual pre-provisioning to help libnetwork testing - Reenabled libnetwork test to do api testing - Updated README.md Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
24 lines
479 B
Go
24 lines
479 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()
|
|
driver, _ := controller.NewNetworkDriver("simplebridge", options)
|
|
netw, err := controller.NewNetwork(driver, "dummy", "")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Printf("Network=%#v\n", netw)
|
|
}
|