From 58f62a22cd957e27f96bc129a8e433d009d1c950 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Wed, 15 Apr 2015 13:42:25 +0100
Subject: [PATCH] Fix typos and formatting in docs. Add Godoc badge.
Signed-off-by: Dave Tucker
---
README.md | 2 +-
network.go | 73 ++++++++++++++++++++++--------------------------------
2 files changed, 31 insertions(+), 44 deletions(-)
diff --git a/README.md b/README.md
index acf601f..7db0395 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# libnetwork - networking for containers
-[](https://circleci.com/gh/docker/libnetwork/tree/master) [](https://coveralls.io/r/docker/libnetwork)
+[](https://circleci.com/gh/docker/libnetwork/tree/master) [](https://coveralls.io/r/docker/libnetwork) [](https://godoc.org/github.com/docker/libnetwork)
Libnetwork provides a native Go implementation for connecting containers
diff --git a/network.go b/network.go
index 67ca1f4..ff0a4de 100644
--- a/network.go
+++ b/network.go
@@ -1,52 +1,40 @@
/*
-Package libnetwork provides basic fonctionalities and extension points to
+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 := libnetwork.New()
+ // Create a new controller instance
+ controller := libnetwork.New()
-// This option is only needed for in-tree drivers. Plugins(in future) will get
-// their options through plugin infrastructure.
-option := options.Generic{}
-driver, err := controller.NewNetworkDriver("simplebridge", option)
-if err != nil {
+ // This option is only needed for in-tree drivers. Plugins(in future) will get
+ // their options through plugin infrastructure.
+ option := options.Generic{}
+ driver, err := controller.NewNetworkDriver("simplebridge", option)
+ if err != nil {
return
-}
+ }
-netOptions := options.Generic{}
-// Create a network for containers to join.
-network, err := controller.NewNetwork(driver, "network1", netOptions)
-if err != nil {
- return
-}
+ netOptions := options.Generic{}
+ // Create a network for containers to join.
+ network, err := controller.NewNetwork(driver, "network1", netOptions)
+ if err != nil {
+ return
+ }
-// For a new container: create a sandbox instance (providing a unique key).
-// For linux it is a filesystem path
-networkPath := "/var/lib/docker/.../4d23e"
-networkNamespace, err := sandbox.NewSandbox(networkPath)
-if err != nil {
- return
-}
+ // For a new container: create a sandbox instance (providing a unique key).
+ // For linux it is a filesystem path
+ networkPath := "/var/lib/docker/.../4d23e"
+ networkNamespace, err := sandbox.NewSandbox(networkPath)
+ if err != nil {
+ return
+ }
-// For each new container: allocate IP and interfaces. The returned network
-// settings will be used for container infos (inspect and such), as well as
-// iptables rules for port publishing.
-_, sinfo, err := network.CreateEndpoint("Endpoint1", networkNamespace.Key(), "")
-if err != nil {
- return
-}
-
-// Add interfaces to the namespace.
-for _, iface := range sinfo.Interfaces {
- if err := networkNamespace.AddInterface(iface); err != nil {
- return
- }
-}
-
-// Set the gateway IP
-if err := networkNamespace.SetGateway(sinfo.Gateway); err != nil {
- return
-}
+ // For each new container: allocate IP and interfaces. The returned network
+ // settings will be used for container infos (inspect and such), as well as
+ // iptables rules for port publishing.
+ _, sinfo, err := network.CreateEndpoint("Endpoint1", networkNamespace.Key(), "")
+ if err != nil {
+ return
+ }
*/
package libnetwork
@@ -68,8 +56,7 @@ type NetworkController interface {
}
// A Network represents a logical connectivity zone that containers may
-// ulteriorly join using the CreateEndpoint method. A Network is managed by a specific
-// driver.
+// join using the Link method. A Network is managed by a specific driver.
type Network interface {
// A user chosen name for this network.
Name() string