|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 06-Dec-2017 | - |
| bitseq/ | H | 06-Dec-2017 | - | 856 | 649 |
| cluster/ | H | 06-Dec-2017 | - | 37 | 26 |
| common/ | H | 06-Dec-2017 | - | 166 | 121 |
| config/ | H | 06-Dec-2017 | - | 299 | 232 |
| datastore/ | H | 06-Dec-2017 | - | 970 | 682 |
| diagnose/ | H | 06-Dec-2017 | - | 134 | 89 |
| discoverapi/ | H | 06-Dec-2017 | - | 61 | 35 |
| driverapi/ | H | 06-Dec-2017 | - | 375 | 204 |
| drivers/ | H | 06-Dec-2017 | - | 14,638 | 11,485 |
| drvregistry/ | H | 06-Dec-2017 | - | 229 | 163 |
| etchosts/ | H | 06-Dec-2017 | - | 209 | 156 |
| hostdiscovery/ | H | 06-Dec-2017 | - | 145 | 114 |
| idm/ | H | 06-Dec-2017 | - | 77 | 54 |
| ipam/ | H | 06-Dec-2017 | - | 1,192 | 923 |
| ipamapi/ | H | 06-Dec-2017 | - | 108 | 52 |
| ipams/ | H | 06-Dec-2017 | - | 537 | 395 |
| ipamutils/ | H | 06-Dec-2017 | - | 51 | 38 |
| iptables/ | H | 06-Dec-2017 | - | 763 | 585 |
| ipvs/ | H | 06-Dec-2017 | - | 871 | 599 |
| netlabel/ | H | 06-Dec-2017 | - | 130 | 65 |
| netutils/ | H | 06-Dec-2017 | - | 372 | 262 |
| networkdb/ | H | 06-Dec-2017 | - | 5,627 | 4,663 |
| ns/ | H | 06-Dec-2017 | - | 141 | 115 |
| options/ | H | 06-Dec-2017 | - | 89 | 56 |
| osl/ | H | 06-Dec-2017 | - | 1,868 | 1,346 |
| portallocator/ | H | 06-Dec-2017 | - | 320 | 251 |
| portmapper/ | H | 06-Dec-2017 | - | 420 | 337 |
| resolvconf/ | H | 06-Dec-2017 | - | 284 | 207 |
| types/ | H | 06-Dec-2017 | - | 637 | 441 |
| LICENSE | H A D | 06-Dec-2017 | 11.1 KiB | 203 | 169 |
| README.md | H A D | 06-Dec-2017 | 3.3 KiB | 90 | 68 |
| agent.go | H A D | 06-Dec-2017 | 23.7 KiB | 914 | 739 |
| agent.pb.go | H A D | 06-Dec-2017 | 26.3 KiB | 1,004 | 935 |
| agent.proto | H A D | 06-Dec-2017 | 2.4 KiB | 73 | 55 |
| controller.go | H A D | 06-Dec-2017 | 33.3 KiB | 1,294 | 969 |
| default_gateway.go | H A D | 06-Dec-2017 | 5.1 KiB | 202 | 144 |
| default_gateway_freebsd.go | H A D | 06-Dec-2017 | 326 | 14 | 9 |
| default_gateway_linux.go | H A D | 06-Dec-2017 | 694 | 33 | 25 |
| default_gateway_windows.go | H A D | 06-Dec-2017 | 539 | 23 | 17 |
| drivers_experimental_linux.go | H A D | 06-Dec-2017 | 170 | 10 | 7 |
| drivers_freebsd.go | H A D | 06-Dec-2017 | 258 | 14 | 11 |
| drivers_ipam.go | H A D | 06-Dec-2017 | 580 | 24 | 20 |
| drivers_linux.go | H A D | 06-Dec-2017 | 629 | 27 | 23 |
| drivers_windows.go | H A D | 06-Dec-2017 | 602 | 22 | 19 |
| endpoint.go | H A D | 06-Dec-2017 | 30.5 KiB | 1,207 | 947 |
| endpoint_cnt.go | H A D | 06-Dec-2017 | 3.4 KiB | 183 | 147 |
| endpoint_info.go | H A D | 06-Dec-2017 | 11.2 KiB | 453 | 358 |
| endpoint_info_unix.go | H A D | 06-Dec-2017 | 655 | 31 | 22 |
| endpoint_info_windows.go | H A D | 06-Dec-2017 | 906 | 46 | 34 |
| error.go | H A D | 06-Dec-2017 | 5.5 KiB | 194 | 99 |
| firewall_linux.go | H A D | 06-Dec-2017 | 827 | 30 | 21 |
| firewall_others.go | H A D | 06-Dec-2017 | 71 | 7 | 3 |
| network.go | H A D | 06-Dec-2017 | 52.9 KiB | 2,133 | 1,680 |
| network_unix.go | H A D | 06-Dec-2017 | 267 | 15 | 7 |
| network_windows.go | H A D | 06-Dec-2017 | 1.8 KiB | 73 | 59 |
| resolver.go | H A D | 06-Dec-2017 | 13.1 KiB | 534 | 418 |
| resolver_unix.go | H A D | 06-Dec-2017 | 3 KiB | 102 | 82 |
| resolver_windows.go | H A D | 06-Dec-2017 | 95 | 8 | 4 |
| sandbox.go | H A D | 06-Dec-2017 | 29.8 KiB | 1,230 | 913 |
| sandbox_dns_unix.go | H A D | 06-Dec-2017 | 11.6 KiB | 416 | 321 |
| sandbox_dns_windows.go | H A D | 06-Dec-2017 | 566 | 36 | 21 |
| sandbox_externalkey.go | H A D | 06-Dec-2017 | 209 | 13 | 9 |
| sandbox_externalkey_unix.go | H A D | 06-Dec-2017 | 3.9 KiB | 177 | 141 |
| sandbox_externalkey_windows.go | H A D | 06-Dec-2017 | 1.3 KiB | 46 | 27 |
| sandbox_store.go | H A D | 06-Dec-2017 | 6.9 KiB | 306 | 245 |
| service.go | H A D | 06-Dec-2017 | 2.3 KiB | 94 | 53 |
| service_common.go | H A D | 06-Dec-2017 | 11.5 KiB | 386 | 278 |
| service_linux.go | H A D | 06-Dec-2017 | 22.1 KiB | 782 | 613 |
| service_unsupported.go | H A D | 06-Dec-2017 | 595 | 26 | 17 |
| service_windows.go | H A D | 06-Dec-2017 | 3.8 KiB | 151 | 116 |
| store.go | H A D | 06-Dec-2017 | 11.4 KiB | 497 | 388 |
| vendor.conf | H A D | 06-Dec-2017 | 2.9 KiB | 54 | 51 |
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)
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
18func main() {
19 if reexec.Init() {
20 return
21 }
22
23 // Select and configure the network driver
24 networkType := "bridge"
25
26 // Create a new controller instance
27 driverOptions := options.Generic{}
28 genericOption := make(map[string]interface{})
29 genericOption[netlabel.GenericData] = driverOptions
30 controller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption))
31 if err != nil {
32 log.Fatalf("libnetwork.New: %s", err)
33 }
34
35 // Create a network for containers to join.
36 // NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use.
37 network, err := controller.NewNetwork(networkType, "network1", "")
38 if err != nil {
39 log.Fatalf("controller.NewNetwork: %s", err)
40 }
41
42 // For each new container: allocate IP and interfaces. The returned network
43 // settings will be used for container infos (inspect and such), as well as
44 // iptables rules for port publishing. This info is contained or accessible
45 // from the returned endpoint.
46 ep, err := network.CreateEndpoint("Endpoint1")
47 if err != nil {
48 log.Fatalf("network.CreateEndpoint: %s", err)
49 }
50
51 // Create the sandbox for the container.
52 // NewSandbox accepts Variadic optional arguments which libnetwork can use.
53 sbx, err := controller.NewSandbox("container1",
54 libnetwork.OptionHostname("test"),
55 libnetwork.OptionDomainname("docker.io"))
56 if err != nil {
57 log.Fatalf("controller.NewSandbox: %s", err)
58 }
59
60 // A sandbox can join the endpoint via the join api.
61 err = ep.Join(sbx)
62 if err != nil {
63 log.Fatalf("ep.Join: %s", err)
64 }
65
66 // libnetwork client can check the endpoint's operational data via the Info() API
67 epInfo, err := ep.DriverInfo()
68 if err != nil {
69 log.Fatalf("ep.DriverInfo: %s", err)
70 }
71
72 macAddress, ok := epInfo[netlabel.MacAddress]
73 if !ok {
74 log.Fatalf("failed to get mac address from endpoint info")
75 }
76
77 fmt.Printf("Joined endpoint %s (%s) to sandbox %s (%s)\n", ep.Name(), macAddress, sbx.ContainerID(), sbx.Key())
78}
79```
80
81## Future
82Please refer to [roadmap](ROADMAP.md) for more information.
83
84## Contributing
85
86Want to hack on libnetwork? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.
87
88## Copyright and license
89Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.
90