mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-04 15:58:39 +00:00
30 lines
465 B
Go
30 lines
465 B
Go
package docker
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
const (
|
|
networkGateway = "10.0.3.1"
|
|
networkPrefixLen = 24
|
|
)
|
|
|
|
type NetworkInterface struct {
|
|
IpAddress string
|
|
IpPrefixLen int
|
|
Gateway net.IP
|
|
}
|
|
|
|
func allocateIPAddress() string {
|
|
return "10.0.3.2"
|
|
}
|
|
|
|
func allocateNetwork() (*NetworkInterface, error) {
|
|
iface := &NetworkInterface{
|
|
IpAddress: allocateIPAddress(),
|
|
IpPrefixLen: networkPrefixLen,
|
|
Gateway: net.ParseIP(networkGateway),
|
|
}
|
|
return iface, nil
|
|
}
|