2014-06-24 07:23:51 +08:00
|
|
|
// +build linux
|
|
|
|
|
2014-03-16 08:01:31 +08:00
|
|
|
package network
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Loopback is a network strategy that provides a basic loopback device
|
|
|
|
type Loopback struct {
|
|
|
|
}
|
|
|
|
|
2014-06-26 06:51:28 +08:00
|
|
|
func (l *Loopback) Create(n *Network, nspid int, networkState *NetworkState) error {
|
2014-03-16 08:01:31 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2014-06-26 06:51:28 +08:00
|
|
|
func (l *Loopback) Initialize(config *Network, networkState *NetworkState) error {
|
2014-07-15 08:50:54 +08:00
|
|
|
// Do not set the MTU on the loopback interface - use the default.
|
2014-03-16 08:01:31 +08:00
|
|
|
if err := InterfaceUp("lo"); err != nil {
|
|
|
|
return fmt.Errorf("lo up %s", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|