From e82989f8455721f4287bd501ee2d819924dd8026 Mon Sep 17 00:00:00 2001 From: Chun Chen Date: Tue, 22 Sep 2015 23:27:11 +0800 Subject: [PATCH] Fix outdated docs and comments Signed-off-by: Chun Chen --- libnetwork/README.md | 4 ++-- libnetwork/controller.go | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libnetwork/README.md b/libnetwork/README.md index 46dec9bb79..aa3fcbce4c 100644 --- a/libnetwork/README.md +++ b/libnetwork/README.md @@ -45,13 +45,13 @@ There are many networking solutions available to suit a broad range of use-cases return } - // Create the sandbox for the containr. + // Create the sandbox for the container. + // NewSandbox accepts Variadic optional arguments which libnetwork can use. sbx, err := controller.NewSandbox("container1", libnetwork.OptionHostname("test"), libnetwork.OptionDomainname("docker.io")) // A sandbox can join the endpoint via the join api. - // Join accepts Variadic arguments which libnetwork and Drivers can use. err = ep.Join(sbx) if err != nil { return diff --git a/libnetwork/controller.go b/libnetwork/controller.go index f834b7b370..e5cf1a3475 100644 --- a/libnetwork/controller.go +++ b/libnetwork/controller.go @@ -2,16 +2,13 @@ Package libnetwork provides the basic functionality and extension points to create network namespaces and allocate interfaces for containers to use. - // Create a new controller instance - controller, _err := libnetwork.New(nil) - - // Select and configure the network driver networkType := "bridge" + // Create a new controller instance driverOptions := options.Generic{} genericOption := make(map[string]interface{}) genericOption[netlabel.GenericData] = driverOptions - err := controller.ConfigureNetworkDriver(networkType, genericOption) + controller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption)) if err != nil { return } @@ -32,11 +29,14 @@ create network namespaces and allocate interfaces for containers to use. return } - // A container can join the endpoint by providing the container ID to the join api. - // Join accepts Variadic arguments which will be made use of by libnetwork and Drivers - err = ep.Join("container1", - libnetwork.JoinOptionHostname("test"), - libnetwork.JoinOptionDomainname("docker.io")) + // Create the sandbox for the container. + // NewSandbox accepts Variadic optional arguments which libnetwork can use. + sbx, err := controller.NewSandbox("container1", + libnetwork.OptionHostname("test"), + libnetwork.OptionDomainname("docker.io")) + + // A sandbox can join the endpoint via the join api. + err = ep.Join(sbx) if err != nil { return }