|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 27-Aug-2018 | - |
| bitseq/ | H | 27-Aug-2018 | - | 880 | 662 |
| cluster/ | H | 27-Aug-2018 | - | 38 | 26 |
| config/ | H | 27-Aug-2018 | - | 308 | 239 |
| datastore/ | H | 27-Aug-2018 | - | 970 | 682 |
| diagnostic/ | H | 27-Aug-2018 | - | 361 | 266 |
| discoverapi/ | H | 27-Aug-2018 | - | 61 | 35 |
| driverapi/ | H | 27-Aug-2018 | - | 375 | 204 |
| drivers/ | H | 27-Aug-2018 | - | 14,770 | 11,573 |
| drvregistry/ | H | 27-Aug-2018 | - | 229 | 163 |
| etchosts/ | H | 27-Aug-2018 | - | 209 | 156 |
| hostdiscovery/ | H | 27-Aug-2018 | - | 145 | 114 |
| idm/ | H | 27-Aug-2018 | - | 77 | 54 |
| internal/ | H | 27-Aug-2018 | - | 166 | 121 |
| ipam/ | H | 27-Aug-2018 | - | 1,227 | 938 |
| ipamapi/ | H | 27-Aug-2018 | - | 108 | 52 |
| ipams/ | H | 27-Aug-2018 | - | 590 | 433 |
| ipamutils/ | H | 27-Aug-2018 | - | 136 | 99 |
| iptables/ | H | 27-Aug-2018 | - | 804 | 610 |
| ipvs/ | H | 27-Aug-2018 | - | 890 | 615 |
| netlabel/ | H | 27-Aug-2018 | - | 130 | 65 |
| netutils/ | H | 27-Aug-2018 | - | 372 | 262 |
| networkdb/ | H | 27-Aug-2018 | - | 5,956 | 4,903 |
| ns/ | H | 27-Aug-2018 | - | 141 | 115 |
| options/ | H | 27-Aug-2018 | - | 89 | 56 |
| osl/ | H | 27-Aug-2018 | - | 1,998 | 1,432 |
| portallocator/ | H | 27-Aug-2018 | - | 321 | 252 |
| portmapper/ | H | 27-Aug-2018 | - | 485 | 398 |
| resolvconf/ | H | 27-Aug-2018 | - | 281 | 202 |
| types/ | H | 27-Aug-2018 | - | 654 | 449 |
| LICENSE | H A D | 27-Aug-2018 | 11.1 KiB | 203 | 169 |
| README.md | H A D | 27-Aug-2018 | 3.7 KiB | 101 | 77 |
| agent.go | H A D | 27-Aug-2018 | 26.2 KiB | 976 | 784 |
| agent.pb.go | H A D | 27-Aug-2018 | 27.9 KiB | 1,096 | 1,012 |
| agent.proto | H A D | 27-Aug-2018 | 2.5 KiB | 77 | 58 |
| controller.go | H A D | 27-Aug-2018 | 34.6 KiB | 1,339 | 1,002 |
| default_gateway.go | H A D | 27-Aug-2018 | 5.2 KiB | 204 | 146 |
| default_gateway_freebsd.go | H A D | 27-Aug-2018 | 326 | 14 | 9 |
| default_gateway_linux.go | H A D | 27-Aug-2018 | 694 | 33 | 25 |
| default_gateway_windows.go | H A D | 27-Aug-2018 | 539 | 23 | 17 |
| drivers_experimental_linux.go | H A D | 27-Aug-2018 | 170 | 10 | 7 |
| drivers_freebsd.go | H A D | 27-Aug-2018 | 258 | 14 | 11 |
| drivers_ipam.go | H A D | 27-Aug-2018 | 713 | 26 | 22 |
| drivers_linux.go | H A D | 27-Aug-2018 | 629 | 27 | 23 |
| drivers_windows.go | H A D | 27-Aug-2018 | 602 | 22 | 19 |
| endpoint.go | H A D | 27-Aug-2018 | 30.8 KiB | 1,219 | 953 |
| endpoint_cnt.go | H A D | 27-Aug-2018 | 3.4 KiB | 183 | 147 |
| endpoint_info.go | H A D | 27-Aug-2018 | 11.3 KiB | 460 | 362 |
| endpoint_info_unix.go | H A D | 27-Aug-2018 | 655 | 31 | 22 |
| endpoint_info_windows.go | H A D | 27-Aug-2018 | 906 | 46 | 34 |
| error.go | H A D | 27-Aug-2018 | 5.5 KiB | 194 | 99 |
| firewall_linux.go | H A D | 27-Aug-2018 | 1,008 | 41 | 31 |
| firewall_others.go | H A D | 27-Aug-2018 | 87 | 7 | 3 |
| network.go | H A D | 27-Aug-2018 | 55.9 KiB | 2,209 | 1,716 |
| network_unix.go | H A D | 27-Aug-2018 | 267 | 15 | 7 |
| network_windows.go | H A D | 27-Aug-2018 | 1.9 KiB | 76 | 62 |
| resolver.go | H A D | 27-Aug-2018 | 14 KiB | 556 | 433 |
| resolver_unix.go | H A D | 27-Aug-2018 | 3 KiB | 102 | 82 |
| resolver_windows.go | H A D | 27-Aug-2018 | 95 | 8 | 4 |
| sandbox.go | H A D | 27-Aug-2018 | 30.7 KiB | 1,248 | 926 |
| sandbox_dns_unix.go | H A D | 27-Aug-2018 | 12.7 KiB | 435 | 330 |
| sandbox_dns_windows.go | H A D | 27-Aug-2018 | 566 | 36 | 21 |
| sandbox_externalkey.go | H A D | 27-Aug-2018 | 209 | 13 | 9 |
| sandbox_externalkey_unix.go | H A D | 27-Aug-2018 | 3.9 KiB | 177 | 141 |
| sandbox_externalkey_windows.go | H A D | 27-Aug-2018 | 1.3 KiB | 46 | 27 |
| sandbox_store.go | H A D | 27-Aug-2018 | 6.9 KiB | 304 | 243 |
| service.go | H A D | 27-Aug-2018 | 2.3 KiB | 99 | 57 |
| service_common.go | H A D | 27-Aug-2018 | 12.2 KiB | 402 | 284 |
| service_linux.go | H A D | 27-Aug-2018 | 22.6 KiB | 768 | 613 |
| service_unsupported.go | H A D | 27-Aug-2018 | 595 | 26 | 17 |
| service_windows.go | H A D | 27-Aug-2018 | 4.1 KiB | 174 | 136 |
| store.go | H A D | 27-Aug-2018 | 11.4 KiB | 497 | 388 |
| vendor.conf | H A D | 27-Aug-2018 | 2.6 KiB | 52 | 48 |
README.md
1# libnetwork - networking for containers
2
3[![Circle CI](https://circleci.com/gh/docker/libnetwork/tree/master.svg?style=svg)](https://circleci.com/gh/docker/libnetwork/tree/master) [![Coverage Status](https://coveralls.io/repos/docker/libnetwork/badge.svg)](https://coveralls.io/r/docker/libnetwork) [![GoDoc](https://godoc.org/github.com/docker/libnetwork?status.svg)](https://godoc.org/github.com/docker/libnetwork) [![Go Report Card](https://goreportcard.com/badge/github.com/docker/libnetwork)](https://goreportcard.com/report/github.com/docker/libnetwork)
4
5Libnetwork provides a native Go implementation for connecting containers
6
7The goal of libnetwork is to deliver a robust Container Network Model that provides a consistent programming interface and the required network abstractions for applications.
8
9#### Design
10Please refer to the [design](docs/design.md) for more information.
11
12#### Using libnetwork
13
14There are many networking solutions available to suit a broad range of use-cases. libnetwork uses a driver / plugin model to support all of these solutions while abstracting the complexity of the driver implementations by exposing a simple and consistent Network Model to users.
15
16
17```go
18import (
19 "fmt"
20 "log"
21
22 "github.com/docker/docker/pkg/reexec"
23 "github.com/docker/libnetwork"
24 "github.com/docker/libnetwork/config"
25 "github.com/docker/libnetwork/netlabel"
26 "github.com/docker/libnetwork/options"
27)
28
29func main() {
30 if reexec.Init() {
31 return
32 }
33
34 // Select and configure the network driver
35 networkType := "bridge"
36
37 // Create a new controller instance
38 driverOptions := options.Generic{}
39 genericOption := make(map[string]interface{})
40 genericOption[netlabel.GenericData] = driverOptions
41 controller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption))
42 if err != nil {
43 log.Fatalf("libnetwork.New: %s", err)
44 }
45
46 // Create a network for containers to join.
47 // NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use.
48 network, err := controller.NewNetwork(networkType, "network1", "")
49 if err != nil {
50 log.Fatalf("controller.NewNetwork: %s", err)
51 }
52
53 // For each new container: allocate IP and interfaces. The returned network
54 // settings will be used for container infos (inspect and such), as well as
55 // iptables rules for port publishing. This info is contained or accessible
56 // from the returned endpoint.
57 ep, err := network.CreateEndpoint("Endpoint1")
58 if err != nil {
59 log.Fatalf("network.CreateEndpoint: %s", err)
60 }
61
62 // Create the sandbox for the container.
63 // NewSandbox accepts Variadic optional arguments which libnetwork can use.
64 sbx, err := controller.NewSandbox("container1",
65 libnetwork.OptionHostname("test"),
66 libnetwork.OptionDomainname("docker.io"))
67 if err != nil {
68 log.Fatalf("controller.NewSandbox: %s", err)
69 }
70
71 // A sandbox can join the endpoint via the join api.
72 err = ep.Join(sbx)
73 if err != nil {
74 log.Fatalf("ep.Join: %s", err)
75 }
76
77 // libnetwork client can check the endpoint's operational data via the Info() API
78 epInfo, err := ep.DriverInfo()
79 if err != nil {
80 log.Fatalf("ep.DriverInfo: %s", err)
81 }
82
83 macAddress, ok := epInfo[netlabel.MacAddress]
84 if !ok {
85 log.Fatalf("failed to get mac address from endpoint info")
86 }
87
88 fmt.Printf("Joined endpoint %s (%s) to sandbox %s (%s)\n", ep.Name(), macAddress, sbx.ContainerID(), sbx.Key())
89}
90```
91
92## Future
93Please refer to [roadmap](ROADMAP.md) for more information.
94
95## Contributing
96
97Want to hack on libnetwork? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.
98
99## Copyright and license
100Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.
101