github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/api/types/container/hostconfig_windows.go (about)

     1  package container // import "github.com/docker/docker/api/types/container"
     2  
     3  // IsBridge indicates whether container uses the bridge network stack
     4  // in windows it is given the name NAT
     5  func (n NetworkMode) IsBridge() bool {
     6  	return n == "nat"
     7  }
     8  
     9  // IsHost indicates whether container uses the host network stack.
    10  // returns false as this is not supported by windows
    11  func (n NetworkMode) IsHost() bool {
    12  	return false
    13  }
    14  
    15  // IsUserDefined indicates user-created network
    16  func (n NetworkMode) IsUserDefined() bool {
    17  	return !n.IsDefault() && !n.IsNone() && !n.IsBridge() && !n.IsContainer()
    18  }
    19  
    20  // IsValid indicates if an isolation technology is valid
    21  func (i Isolation) IsValid() bool {
    22  	return i.IsDefault() || i.IsHyperV() || i.IsProcess()
    23  }
    24  
    25  // NetworkName returns the name of the network stack.
    26  func (n NetworkMode) NetworkName() string {
    27  	if n.IsDefault() {
    28  		return "default"
    29  	} else if n.IsBridge() {
    30  		return "nat"
    31  	} else if n.IsNone() {
    32  		return "none"
    33  	} else if n.IsContainer() {
    34  		return "container"
    35  	} else if n.IsUserDefined() {
    36  		return n.UserDefined()
    37  	}
    38  
    39  	return ""
    40  }