github.com/rogpeppe/juju@v0.0.0-20140613142852-6337964b789e/container/network.go (about)

     1  // Copyright 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package container
     5  
     6  const (
     7  	// BridgeNetwork will have the container use the network bridge.
     8  	BridgeNetwork = "bridge"
     9  	// PhyscialNetwork will have the container use a specified network device.
    10  	PhysicalNetwork = "physical"
    11  )
    12  
    13  // NetworkConfig defines how the container network will be configured.
    14  type NetworkConfig struct {
    15  	NetworkType string
    16  	Device      string
    17  }
    18  
    19  // BridgeNetworkConfig returns a valid NetworkConfig to use the specified
    20  // device as a network bridge for the container.
    21  func BridgeNetworkConfig(device string) *NetworkConfig {
    22  	return &NetworkConfig{BridgeNetwork, device}
    23  }
    24  
    25  // PhysicalNetworkConfig returns a valid NetworkConfig to use the specified
    26  // device as the network device for the container.
    27  func PhysicalNetworkConfig(device string) *NetworkConfig {
    28  	return &NetworkConfig{PhysicalNetwork, device}
    29  }