@@ -4,22 +4,6 @@ import (
4
4
"strings"
5
5
)
6
6
7
- // IsDefault indicates whether container uses the default network stack.
8
- func (n NetworkMode ) IsDefault () bool {
9
- return n == "default"
10
- }
11
-
12
- // IsNone indicates whether container isn't using a network stack.
13
- func (n NetworkMode ) IsNone () bool {
14
- return n == "none"
15
- }
16
-
17
- // IsContainer indicates whether container uses a container network stack.
18
- // Returns false as windows doesn't support this mode
19
- func (n NetworkMode ) IsContainer () bool {
20
- return false
21
- }
22
-
23
7
// IsBridge indicates whether container uses the bridge network stack
24
8
// in windows it is given the name NAT
25
9
func (n NetworkMode ) IsBridge () bool {
@@ -32,20 +16,9 @@ func (n NetworkMode) IsHost() bool {
32
16
return false
33
17
}
34
18
35
- // IsPrivate indicates whether container uses its private network stack.
36
- func (n NetworkMode ) IsPrivate () bool {
37
- return ! (n .IsHost () || n .IsContainer ())
38
- }
39
-
40
- // ConnectedContainer is the id of the container which network this container is connected to.
41
- // Returns blank string on windows
42
- func (n NetworkMode ) ConnectedContainer () string {
43
- return ""
44
- }
45
-
46
19
// IsUserDefined indicates user-created network
47
20
func (n NetworkMode ) IsUserDefined () bool {
48
- return ! n .IsDefault () && ! n .IsNone () && ! n .IsBridge ()
21
+ return ! n .IsDefault () && ! n .IsNone () && ! n .IsBridge () && ! n . IsContainer ()
49
22
}
50
23
51
24
// IsHyperV indicates the use of a Hyper-V partition for isolation
@@ -71,17 +44,11 @@ func (n NetworkMode) NetworkName() string {
71
44
return "nat"
72
45
} else if n .IsNone () {
73
46
return "none"
47
+ } else if n .IsContainer () {
48
+ return "container"
74
49
} else if n .IsUserDefined () {
75
50
return n .UserDefined ()
76
51
}
77
52
78
53
return ""
79
54
}
80
-
81
- //UserDefined indicates user-created network
82
- func (n NetworkMode ) UserDefined () string {
83
- if n .IsUserDefined () {
84
- return string (n )
85
- }
86
- return ""
87
- }
0 commit comments