github.com/tonistiigi/docker@v0.10.1-0.20240229224939-974013b0dc6a/api/types/container/hostconfig_windows.go (about)

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