1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/vendor/src/github.com/docker/libnetwork
Santhosh Manohar 1041f39670 Vendor in libnetwork changes to support container rename
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2015-10-23 16:27:03 -07:00
..
bitseq Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
config Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
datastore Vendoring in libnetwork with fixes for issues identified in RC1 & RC2 2015-10-26 13:56:56 -07:00
driverapi Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
drivers Vendoring in libnetwork with fixes for issues identified in RC1 & RC2 2015-10-26 13:56:56 -07:00
etchosts Vendoring in Libnetwork 2015-10-22 14:12:46 -07:00
hostdiscovery Vendoring in Libnetwork 2015-10-22 14:12:46 -07:00
idm Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
ipam Vendoring in libnetwork with fixes for issues identified in RC1 & RC2 2015-10-26 13:56:56 -07:00
ipamapi Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
ipams Vendoring in Libnetwork 2015-10-22 14:12:46 -07:00
ipamutils Vendoring libnetwork 2015-10-19 21:29:26 -07:00
iptables Vendoring in libnetwork 22dc04d06067b40a9e7ef575aee6d1bb69d4dcc3 2015-08-14 05:57:47 -07:00
netlabel Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
netutils Vendoring libnetwork 2015-10-19 21:29:26 -07:00
ns Vendoring libnetwork 3e31cead05cba8ec20241630d051e6d73765b3a2 2015-09-08 07:36:35 -07:00
options Vendor libnetwork dc52820147f40fe424c8959987af3b396f842639 2015-09-02 16:57:43 -07:00
osl Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
portallocator Vendoring in libnetwork 22dc04d06067b40a9e7ef575aee6d1bb69d4dcc3 2015-08-14 05:57:47 -07:00
portmapper Vendor libnetwork dc52820147f40fe424c8959987af3b396f842639 2015-09-02 16:57:43 -07:00
resolvconf Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
types Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
.gitignore Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
circle.yml Vendoring in libnetwork, netns, netlink 2015-05-19 22:40:18 +00:00
controller.go Vendor in libnetwork changes to support container rename 2015-10-23 16:27:03 -07:00
default_gateway.go Vendoring in libnetwork with fixes for issues identified in RC1 & RC2 2015-10-26 13:56:56 -07:00
default_gateway_freebsd.go Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
default_gateway_linux.go Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
default_gateway_windows.go Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
drivers.go Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
drivers_freebsd.go Vendoring libnetwork and libkv 2015-09-25 10:02:31 -07:00
drivers_linux.go Vendoring libnetwork and libkv 2015-09-25 10:02:31 -07:00
drivers_windows.go Vendoring libnetwork and libkv 2015-09-25 10:02:31 -07:00
endpoint.go Vendor in libnetwork changes to support container rename 2015-10-23 16:27:03 -07:00
endpoint_cnt.go Vendor in libnetwork changes to support container rename 2015-10-23 16:27:03 -07:00
endpoint_info.go Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
error.go Vendoring in libnetwork ipam support 2015-10-13 10:52:49 -07:00
LICENSE Vendoring in libnetwork, netns, netlink 2015-05-19 22:40:18 +00:00
MAINTAINERS Vendoring in libnetwork to 3be488927db8d719568917203deddd630a194564 2015-06-12 16:10:40 -07:00
Makefile Vendoring libnetwork 2015-10-19 21:29:26 -07:00
network.go Vendoring in libnetwork with fixes for issues identified in RC1 & RC2 2015-10-26 13:56:56 -07:00
README.md Vendoring libnetwork and libkv 2015-09-25 10:02:31 -07:00
ROADMAP.md Vendoring libnetwork 2015-07-06 20:53:03 -07:00
sandbox.go Vendor in libnetwork changes to support container rename 2015-10-23 16:27:03 -07:00
sandbox_externalkey.go Vendoring libnetwork and libkv 2015-09-25 10:02:31 -07:00
sandbox_store.go Vendoring libnetwork 2015-10-19 21:29:26 -07:00
store.go Vendor in libnetwork changes to support container rename 2015-10-23 16:27:03 -07:00
wrapmake.sh Vendor libnetwork dc52820147f40fe424c8959987af3b396f842639 2015-09-02 16:57:43 -07:00

libnetwork - networking for containers

Circle CI Coverage Status GoDoc

Libnetwork provides a native Go implementation for connecting containers

The goal of libnetwork is to deliver a robust Container Network Model that provides a consistent programming interface and the required network abstractions for applications.

NOTE: libnetwork project is under heavy development and is not ready for general use.

Design

Please refer to the design for more information.

Using libnetwork

There 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.

	// 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
	controller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption))
	if err != nil {
		return
	}

	// Create a network for containers to join.
	// NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use.
	network, err := controller.NewNetwork(networkType, "network1")
	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. This info is contained or accessible
	// from the returned endpoint.
	ep, err := network.CreateEndpoint("Endpoint1")
	if err != nil {
		return
	}

	// 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
	}

	// libnetwork client can check the endpoint's operational data via the Info() API
	epInfo, err := ep.DriverInfo()
	mapData, ok := epInfo[netlabel.PortMap]
	if ok {
		portMapping, ok := mapData.([]types.PortBinding)
		if ok {
			fmt.Printf("Current port mapping for endpoint %s: %v", ep.Name(), portMapping)
		}
	}

Current Status

Please watch this space for updates on the progress.

Currently libnetwork is nothing more than an attempt to modularize the Docker platform's networking subsystem by moving it into libnetwork as a library.

Future

Please refer to roadmap for more information.

Contributing

Want to hack on libnetwork? Docker's contributions guidelines apply.

Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.