mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Cleanup: Change "Ip" to "IP" in func and var names
This commit is contained in:
parent
efb24d44c6
commit
9551ecb7c3
@ -91,10 +91,10 @@ func newProxyServer(
|
||||
return nil, fmt.Errorf("unable to register configz: %s", err)
|
||||
}
|
||||
|
||||
protocol := utiliptables.ProtocolIpv4
|
||||
protocol := utiliptables.ProtocolIPv4
|
||||
if net.ParseIP(config.BindAddress).To4() == nil {
|
||||
klog.V(0).Infof("IPv6 bind address (%s), assume IPv6 operation", config.BindAddress)
|
||||
protocol = utiliptables.ProtocolIpv6
|
||||
protocol = utiliptables.ProtocolIPv6
|
||||
}
|
||||
|
||||
var iptInterface utiliptables.Interface
|
||||
@ -201,10 +201,10 @@ func newProxyServer(
|
||||
var ipt [2]utiliptables.Interface
|
||||
if iptInterface.IsIPv6() {
|
||||
ipt[1] = iptInterface
|
||||
ipt[0] = utiliptables.New(execer, utiliptables.ProtocolIpv4)
|
||||
ipt[0] = utiliptables.New(execer, utiliptables.ProtocolIPv4)
|
||||
} else {
|
||||
ipt[0] = iptInterface
|
||||
ipt[1] = utiliptables.New(execer, utiliptables.ProtocolIpv6)
|
||||
ipt[1] = utiliptables.New(execer, utiliptables.ProtocolIPv6)
|
||||
}
|
||||
|
||||
// Always ordered to match []ipt
|
||||
@ -269,10 +269,10 @@ func newProxyServer(
|
||||
var ipt [2]utiliptables.Interface
|
||||
if iptInterface.IsIPv6() {
|
||||
ipt[1] = iptInterface
|
||||
ipt[0] = utiliptables.New(execer, utiliptables.ProtocolIpv4)
|
||||
ipt[0] = utiliptables.New(execer, utiliptables.ProtocolIPv4)
|
||||
} else {
|
||||
ipt[0] = iptInterface
|
||||
ipt[1] = utiliptables.New(execer, utiliptables.ProtocolIpv6)
|
||||
ipt[1] = utiliptables.New(execer, utiliptables.ProtocolIPv6)
|
||||
}
|
||||
|
||||
nodeIPs := nodeIPTuple(config.BindAddress)
|
||||
|
@ -214,8 +214,8 @@ func Test_getLocalDetector(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101/64"},
|
||||
ipt: utiliptablestest.NewIpv6Fake(),
|
||||
expected: resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIpv6Fake())),
|
||||
ipt: utiliptablestest.NewIPv6Fake(),
|
||||
expected: resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIPv6Fake())),
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
@ -228,14 +228,14 @@ func Test_getLocalDetector(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101"},
|
||||
ipt: utiliptablestest.NewIpv6Fake(),
|
||||
ipt: utiliptablestest.NewIPv6Fake(),
|
||||
expected: nil,
|
||||
errExpected: true,
|
||||
},
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "10.0.0.0/14"},
|
||||
ipt: utiliptablestest.NewIpv6Fake(),
|
||||
ipt: utiliptablestest.NewIPv6Fake(),
|
||||
expected: nil,
|
||||
errExpected: true,
|
||||
},
|
||||
@ -265,8 +265,8 @@ func Test_getLocalDetector(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101/64"},
|
||||
ipt: utiliptablestest.NewIpv6Fake(),
|
||||
expected: resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIpv6Fake())),
|
||||
ipt: utiliptablestest.NewIPv6Fake(),
|
||||
expected: resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIPv6Fake())),
|
||||
nodeInfo: makeNodeWithPodCIDRs("2002::1234:abcd:ffff:c0a8:101/96"),
|
||||
errExpected: false,
|
||||
},
|
||||
@ -281,7 +281,7 @@ func Test_getLocalDetector(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101"},
|
||||
ipt: utiliptablestest.NewIpv6Fake(),
|
||||
ipt: utiliptablestest.NewIPv6Fake(),
|
||||
expected: nil,
|
||||
nodeInfo: makeNodeWithPodCIDRs("2002::1234:abcd:ffff:c0a8:101"),
|
||||
errExpected: true,
|
||||
@ -289,7 +289,7 @@ func Test_getLocalDetector(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "10.0.0.0/14"},
|
||||
ipt: utiliptablestest.NewIpv6Fake(),
|
||||
ipt: utiliptablestest.NewIPv6Fake(),
|
||||
expected: nil,
|
||||
nodeInfo: makeNodeWithPodCIDRs("10.0.0.0/24"),
|
||||
errExpected: true,
|
||||
@ -350,25 +350,25 @@ func Test_getDualStackLocalDetectorTuple(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "10.0.0.0/14,2002::1234:abcd:ffff:c0a8:101/64"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: resolveDualStackLocalDetectors(t)(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("10.0.0.0/14", utiliptablestest.NewFake()))(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIpv6Fake())),
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIPv6Fake())),
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101/64,10.0.0.0/14"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: resolveDualStackLocalDetectors(t)(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("10.0.0.0/14", utiliptablestest.NewFake()))(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIpv6Fake())),
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIPv6Fake())),
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "10.0.0.0/14"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{
|
||||
resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("10.0.0.0/14", utiliptablestest.NewFake())),
|
||||
proxyutiliptables.NewNoOpLocalDetector()},
|
||||
@ -377,16 +377,16 @@ func Test_getDualStackLocalDetectorTuple(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101/64"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{
|
||||
proxyutiliptables.NewNoOpLocalDetector(),
|
||||
resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIpv6Fake()))},
|
||||
resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/64", utiliptablestest.NewIPv6Fake()))},
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeClusterCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: ""},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{proxyutiliptables.NewNoOpLocalDetector(), proxyutiliptables.NewNoOpLocalDetector()},
|
||||
errExpected: false,
|
||||
},
|
||||
@ -394,27 +394,27 @@ func Test_getDualStackLocalDetectorTuple(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "10.0.0.0/14,2002::1234:abcd:ffff:c0a8:101/64"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: resolveDualStackLocalDetectors(t)(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("10.0.0.0/24", utiliptablestest.NewFake()))(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIpv6Fake())),
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIPv6Fake())),
|
||||
nodeInfo: makeNodeWithPodCIDRs("10.0.0.0/24", "2002::1234:abcd:ffff:c0a8:101/96"),
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101/64,10.0.0.0/14"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: resolveDualStackLocalDetectors(t)(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("10.0.0.0/24", utiliptablestest.NewFake()))(
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIpv6Fake())),
|
||||
proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIPv6Fake())),
|
||||
nodeInfo: makeNodeWithPodCIDRs("2002::1234:abcd:ffff:c0a8:101/96", "10.0.0.0/24"),
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "10.0.0.0/14"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{
|
||||
resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("10.0.0.0/24", utiliptablestest.NewFake())),
|
||||
proxyutiliptables.NewNoOpLocalDetector()},
|
||||
@ -424,17 +424,17 @@ func Test_getDualStackLocalDetectorTuple(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: "2002::1234:abcd:ffff:c0a8:101/64"},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{
|
||||
proxyutiliptables.NewNoOpLocalDetector(),
|
||||
resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIpv6Fake()))},
|
||||
resolveLocalDetector(t)(proxyutiliptables.NewDetectLocalByCIDR("2002::1234:abcd:ffff:c0a8:101/96", utiliptablestest.NewIPv6Fake()))},
|
||||
nodeInfo: makeNodeWithPodCIDRs("2002::1234:abcd:ffff:c0a8:101/96"),
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: ""},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{proxyutiliptables.NewNoOpLocalDetector(), proxyutiliptables.NewNoOpLocalDetector()},
|
||||
nodeInfo: makeNodeWithPodCIDRs(),
|
||||
errExpected: false,
|
||||
@ -442,7 +442,7 @@ func Test_getDualStackLocalDetectorTuple(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalModeNodeCIDR,
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: ""},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{proxyutiliptables.NewNoOpLocalDetector(), proxyutiliptables.NewNoOpLocalDetector()},
|
||||
nodeInfo: nil,
|
||||
errExpected: false,
|
||||
@ -451,7 +451,7 @@ func Test_getDualStackLocalDetectorTuple(t *testing.T) {
|
||||
{
|
||||
mode: proxyconfigapi.LocalMode("abcd"),
|
||||
config: &proxyconfigapi.KubeProxyConfiguration{ClusterCIDR: ""},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIpv6Fake()},
|
||||
ipt: [2]utiliptables.Interface{utiliptablestest.NewFake(), utiliptablestest.NewIPv6Fake()},
|
||||
expected: [2]proxyutiliptables.LocalTrafficDetector{proxyutiliptables.NewNoOpLocalDetector(), proxyutiliptables.NewNoOpLocalDetector()},
|
||||
errExpected: false,
|
||||
},
|
||||
|
@ -51,7 +51,7 @@ func NewFakeIPTables() *fakeIPTables {
|
||||
string(utiliptables.TableNAT): sets.NewString("PREROUTING", "INPUT", "OUTPUT", "POSTROUTING"),
|
||||
string(utiliptables.TableMangle): sets.NewString("PREROUTING", "INPUT", "FORWARD", "OUTPUT", "POSTROUTING"),
|
||||
},
|
||||
protocol: utiliptables.ProtocolIpv4,
|
||||
protocol: utiliptables.ProtocolIPv4,
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ func (f *fakeIPTables) DeleteRule(tableName utiliptables.Table, chainName utilip
|
||||
}
|
||||
|
||||
func (f *fakeIPTables) IsIPv6() bool {
|
||||
return f.protocol == utiliptables.ProtocolIpv6
|
||||
return f.protocol == utiliptables.ProtocolIPv6
|
||||
}
|
||||
|
||||
func (f *fakeIPTables) Protocol() utiliptables.Protocol {
|
||||
|
@ -88,10 +88,10 @@ func (hm *hostportManager) Add(id string, podPortMapping *PodPortMapping, natInt
|
||||
return fmt.Errorf("invalid or missing IP of pod %s", podFullName)
|
||||
}
|
||||
podIP := podPortMapping.IP.String()
|
||||
isIpv6 := utilnet.IsIPv6(podPortMapping.IP)
|
||||
isIPv6 := utilnet.IsIPv6(podPortMapping.IP)
|
||||
|
||||
if isIpv6 != hm.iptables.IsIPv6() {
|
||||
return fmt.Errorf("HostPortManager IP family mismatch: %v, isIPv6 - %v", podIP, isIpv6)
|
||||
if isIPv6 != hm.iptables.IsIPv6() {
|
||||
return fmt.Errorf("HostPortManager IP family mismatch: %v, isIPv6 - %v", podIP, isIPv6)
|
||||
}
|
||||
|
||||
if err = ensureKubeHostportChains(hm.iptables, natInterfaceName); err != nil {
|
||||
@ -180,9 +180,9 @@ func (hm *hostportManager) Add(id string, podPortMapping *PodPortMapping, natInt
|
||||
// create a new conntrack entry without any DNAT. That will result in blackhole of the traffic even after correct
|
||||
// iptables rules have been added back.
|
||||
if hm.execer != nil && hm.conntrackFound {
|
||||
klog.Infof("Starting to delete udp conntrack entries: %v, isIPv6 - %v", conntrackPortsToRemove, isIpv6)
|
||||
klog.Infof("Starting to delete udp conntrack entries: %v, isIPv6 - %v", conntrackPortsToRemove, isIPv6)
|
||||
for _, port := range conntrackPortsToRemove {
|
||||
err = conntrack.ClearEntriesForPort(hm.execer, port, isIpv6, v1.ProtocolUDP)
|
||||
err = conntrack.ClearEntriesForPort(hm.execer, port, isIPv6, v1.ProtocolUDP)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to clear udp conntrack for port %d, error: %v", port, err)
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ func TestGetHostportChain(t *testing.T) {
|
||||
|
||||
func TestHostportManagerIPv6(t *testing.T) {
|
||||
iptables := NewFakeIPTables()
|
||||
iptables.protocol = utiliptables.ProtocolIpv6
|
||||
iptables.protocol = utiliptables.ProtocolIPv6
|
||||
portOpener := NewFakeSocketManager()
|
||||
manager := &hostportManager{
|
||||
hostPortMap: make(map[hostport]closeable),
|
||||
|
@ -244,7 +244,7 @@ func matchRule(chain *fakeChain, match string) bool {
|
||||
|
||||
func TestOpenPodHostportsIPv6(t *testing.T) {
|
||||
fakeIPTables := NewFakeIPTables()
|
||||
fakeIPTables.protocol = utiliptables.ProtocolIpv6
|
||||
fakeIPTables.protocol = utiliptables.ProtocolIPv6
|
||||
fakeOpener := NewFakeSocketManager()
|
||||
|
||||
h := &hostportSyncer{
|
||||
|
@ -122,8 +122,8 @@ type kubenetNetworkPlugin struct {
|
||||
|
||||
func NewPlugin(networkPluginDirs []string, cacheDir string) network.NetworkPlugin {
|
||||
execer := utilexec.New()
|
||||
iptInterface := utiliptables.New(execer, utiliptables.ProtocolIpv4)
|
||||
iptInterfacev6 := utiliptables.New(execer, utiliptables.ProtocolIpv6)
|
||||
iptInterface := utiliptables.New(execer, utiliptables.ProtocolIPv4)
|
||||
iptInterfacev6 := utiliptables.New(execer, utiliptables.ProtocolIPv6)
|
||||
return &kubenetNetworkPlugin{
|
||||
podIPs: make(map[kubecontainer.ContainerID]utilsets.String),
|
||||
execer: utilexec.New(),
|
||||
|
@ -523,10 +523,10 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
}
|
||||
httpClient := &http.Client{}
|
||||
parsedNodeIP := net.ParseIP(nodeIP)
|
||||
protocol := utilipt.ProtocolIpv4
|
||||
protocol := utilipt.ProtocolIPv4
|
||||
if utilnet.IsIPv6(parsedNodeIP) {
|
||||
klog.V(0).Infof("IPv6 node IP (%s), assume IPv6 operation", nodeIP)
|
||||
protocol = utilipt.ProtocolIpv6
|
||||
protocol = utilipt.ProtocolIPv6
|
||||
}
|
||||
|
||||
klet := &Kubelet{
|
||||
|
@ -2088,10 +2088,10 @@ func (proxier *Proxier) isIPInExcludeCIDRs(ip net.IP) bool {
|
||||
|
||||
func (proxier *Proxier) getLegacyBindAddr(activeBindAddrs map[string]bool, currentBindAddrs []string) map[string]bool {
|
||||
legacyAddrs := make(map[string]bool)
|
||||
isIpv6 := utilnet.IsIPv6(proxier.nodeIP)
|
||||
isIPv6 := utilnet.IsIPv6(proxier.nodeIP)
|
||||
for _, addr := range currentBindAddrs {
|
||||
addrIsIPv6 := utilnet.IsIPv6(net.ParseIP(addr))
|
||||
if addrIsIPv6 && !isIpv6 || !addrIsIPv6 && isIpv6 {
|
||||
if addrIsIPv6 && !isIPv6 || !addrIsIPv6 && isIPv6 {
|
||||
continue
|
||||
}
|
||||
if _, ok := activeBindAddrs[addr]; !ok {
|
||||
|
@ -70,12 +70,12 @@ func TestNewDetectLocalByCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
cidr: "2002::1234:abcd:ffff:c0a8:101/64",
|
||||
ipt: iptablestest.NewIpv6Fake(),
|
||||
ipt: iptablestest.NewIPv6Fake(),
|
||||
errExpected: false,
|
||||
},
|
||||
{
|
||||
cidr: "10.0.0.0/14",
|
||||
ipt: iptablestest.NewIpv6Fake(),
|
||||
ipt: iptablestest.NewIPv6Fake(),
|
||||
errExpected: true,
|
||||
},
|
||||
{
|
||||
@ -90,7 +90,7 @@ func TestNewDetectLocalByCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
cidr: "2002::1234:abcd:ffff:c0a8:101",
|
||||
ipt: iptablestest.NewIpv6Fake(),
|
||||
ipt: iptablestest.NewIPv6Fake(),
|
||||
errExpected: true,
|
||||
},
|
||||
{
|
||||
@ -100,7 +100,7 @@ func TestNewDetectLocalByCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
cidr: "",
|
||||
ipt: iptablestest.NewIpv6Fake(),
|
||||
ipt: iptablestest.NewIPv6Fake(),
|
||||
errExpected: true,
|
||||
},
|
||||
}
|
||||
@ -137,7 +137,7 @@ func TestDetectLocalByCIDR(t *testing.T) {
|
||||
},
|
||||
{
|
||||
cidr: "2002::1234:abcd:ffff:c0a8:101/64",
|
||||
ipt: iptablestest.NewIpv6Fake(),
|
||||
ipt: iptablestest.NewIPv6Fake(),
|
||||
chain: "TEST",
|
||||
args: []string{"arg1", "arg2"},
|
||||
expectedJumpIfOutput: []string{"arg1", "arg2", "-s", "2002::1234:abcd:ffff:c0a8:101/64", "-j", "TEST"},
|
||||
|
@ -213,7 +213,7 @@ func (proxier *Proxier) addServicePortPortal(servicePortPortalName ServicePortPo
|
||||
return nil, fmt.Errorf("could not parse ip '%q'", listenIP)
|
||||
}
|
||||
// add the IP address. Node port binds to all interfaces.
|
||||
args := proxier.netshIpv4AddressAddArgs(serviceIP)
|
||||
args := proxier.netshIPv4AddressAddArgs(serviceIP)
|
||||
if existed, err := proxier.netsh.EnsureIPAddress(args, serviceIP); err != nil {
|
||||
return nil, err
|
||||
} else if !existed {
|
||||
@ -262,7 +262,7 @@ func (proxier *Proxier) closeServicePortPortal(servicePortPortalName ServicePort
|
||||
// close the PortalProxy by deleting the service IP address
|
||||
if info.portal.ip != allAvailableInterfaces {
|
||||
serviceIP := net.ParseIP(info.portal.ip)
|
||||
args := proxier.netshIpv4AddressDeleteArgs(serviceIP)
|
||||
args := proxier.netshIPv4AddressDeleteArgs(serviceIP)
|
||||
if err := proxier.netsh.DeleteIPAddress(args); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -474,7 +474,7 @@ func isClosedError(err error) bool {
|
||||
return strings.HasSuffix(err.Error(), "use of closed network connection")
|
||||
}
|
||||
|
||||
func (proxier *Proxier) netshIpv4AddressAddArgs(destIP net.IP) []string {
|
||||
func (proxier *Proxier) netshIPv4AddressAddArgs(destIP net.IP) []string {
|
||||
intName := proxier.netsh.GetInterfaceToAddIP()
|
||||
args := []string{
|
||||
"interface", "ipv4", "add", "address",
|
||||
@ -485,7 +485,7 @@ func (proxier *Proxier) netshIpv4AddressAddArgs(destIP net.IP) []string {
|
||||
return args
|
||||
}
|
||||
|
||||
func (proxier *Proxier) netshIpv4AddressDeleteArgs(destIP net.IP) []string {
|
||||
func (proxier *Proxier) netshIPv4AddressDeleteArgs(destIP net.IP) []string {
|
||||
intName := proxier.netsh.GetInterfaceToAddIP()
|
||||
args := []string{
|
||||
"interface", "ipv4", "delete", "address",
|
||||
|
@ -92,10 +92,10 @@ type Interface interface {
|
||||
type Protocol string
|
||||
|
||||
const (
|
||||
// ProtocolIpv4 represents ipv4 protocol in iptables
|
||||
ProtocolIpv4 Protocol = "IPv4"
|
||||
// ProtocolIpv6 represents ipv6 protocol in iptables
|
||||
ProtocolIpv6 Protocol = "IPv6"
|
||||
// ProtocolIPv4 represents ipv4 protocol in iptables
|
||||
ProtocolIPv4 Protocol = "IPv4"
|
||||
// ProtocolIPv6 represents ipv6 protocol in iptables
|
||||
ProtocolIPv6 Protocol = "IPv6"
|
||||
)
|
||||
|
||||
// Table represents different iptable like filter,nat, mangle and raw
|
||||
@ -322,7 +322,7 @@ func (runner *runner) DeleteRule(table Table, chain Chain, args ...string) error
|
||||
}
|
||||
|
||||
func (runner *runner) IsIPv6() bool {
|
||||
return runner.protocol == ProtocolIpv6
|
||||
return runner.protocol == ProtocolIPv6
|
||||
}
|
||||
|
||||
func (runner *runner) Protocol() Protocol {
|
||||
@ -416,14 +416,14 @@ func (runner *runner) restoreInternal(args []string, data []byte, flush FlushFla
|
||||
}
|
||||
|
||||
func iptablesSaveCommand(protocol Protocol) string {
|
||||
if protocol == ProtocolIpv6 {
|
||||
if protocol == ProtocolIPv6 {
|
||||
return cmdIP6TablesSave
|
||||
}
|
||||
return cmdIPTablesSave
|
||||
}
|
||||
|
||||
func iptablesRestoreCommand(protocol Protocol) string {
|
||||
if protocol == ProtocolIpv6 {
|
||||
if protocol == ProtocolIPv6 {
|
||||
return cmdIP6TablesRestore
|
||||
}
|
||||
return cmdIPTablesRestore
|
||||
@ -431,7 +431,7 @@ func iptablesRestoreCommand(protocol Protocol) string {
|
||||
}
|
||||
|
||||
func iptablesCommand(protocol Protocol) string {
|
||||
if protocol == ProtocolIpv6 {
|
||||
if protocol == ProtocolIPv6 {
|
||||
return cmdIP6Tables
|
||||
}
|
||||
return cmdIPTables
|
||||
|
@ -68,11 +68,11 @@ func testIPTablesVersionCmds(t *testing.T, protocol Protocol) {
|
||||
}
|
||||
|
||||
func TestIPTablesVersionCmdsIPv4(t *testing.T) {
|
||||
testIPTablesVersionCmds(t, ProtocolIpv4)
|
||||
testIPTablesVersionCmds(t, ProtocolIPv4)
|
||||
}
|
||||
|
||||
func TestIPTablesVersionCmdsIPv6(t *testing.T) {
|
||||
testIPTablesVersionCmds(t, ProtocolIpv6)
|
||||
testIPTablesVersionCmds(t, ProtocolIPv6)
|
||||
}
|
||||
|
||||
func testEnsureChain(t *testing.T, protocol Protocol) {
|
||||
@ -127,12 +127,12 @@ func testEnsureChain(t *testing.T, protocol Protocol) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnsureChainIpv4(t *testing.T) {
|
||||
testEnsureChain(t, ProtocolIpv4)
|
||||
func TestEnsureChainIPv4(t *testing.T) {
|
||||
testEnsureChain(t, ProtocolIPv4)
|
||||
}
|
||||
|
||||
func TestEnsureChainIpv6(t *testing.T) {
|
||||
testEnsureChain(t, ProtocolIpv6)
|
||||
func TestEnsureChainIPv6(t *testing.T) {
|
||||
testEnsureChain(t, ProtocolIPv6)
|
||||
}
|
||||
|
||||
func TestFlushChain(t *testing.T) {
|
||||
@ -153,7 +153,7 @@ func TestFlushChain(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
// Success.
|
||||
err := runner.FlushChain(TableNAT, Chain("FOOBAR"))
|
||||
if err != nil {
|
||||
@ -190,7 +190,7 @@ func TestDeleteChain(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
// Success.
|
||||
err := runner.DeleteChain(TableNAT, Chain("FOOBAR"))
|
||||
if err != nil {
|
||||
@ -226,7 +226,7 @@ func TestEnsureRuleAlreadyExists(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
exists, err := runner.EnsureRule(Append, TableNAT, ChainOutput, "abc", "123")
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -262,7 +262,7 @@ func TestEnsureRuleNew(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
exists, err := runner.EnsureRule(Append, TableNAT, ChainOutput, "abc", "123")
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -295,7 +295,7 @@ func TestEnsureRuleErrorChecking(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
_, err := runner.EnsureRule(Append, TableNAT, ChainOutput, "abc", "123")
|
||||
if err == nil {
|
||||
t.Errorf("expected failure")
|
||||
@ -325,7 +325,7 @@ func TestEnsureRuleErrorCreating(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
_, err := runner.EnsureRule(Append, TableNAT, ChainOutput, "abc", "123")
|
||||
if err == nil {
|
||||
t.Errorf("expected failure")
|
||||
@ -352,7 +352,7 @@ func TestDeleteRuleDoesNotExist(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -385,7 +385,7 @@ func TestDeleteRuleExists(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -415,7 +415,7 @@ func TestDeleteRuleErrorChecking(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
|
||||
if err == nil {
|
||||
t.Errorf("expected failure")
|
||||
@ -445,7 +445,7 @@ func TestDeleteRuleErrorDeleting(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
|
||||
if err == nil {
|
||||
t.Errorf("expected failure")
|
||||
@ -480,7 +480,7 @@ func TestGetIPTablesHasCheckCommand(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
ipt := New(&fexec, ProtocolIpv4)
|
||||
ipt := New(&fexec, ProtocolIPv4)
|
||||
runner := ipt.(*runner)
|
||||
if testCase.Expected != runner.hasCheck {
|
||||
t.Errorf("Expected result: %v, Got result: %v", testCase.Expected, runner.hasCheck)
|
||||
@ -494,12 +494,12 @@ func TestIPTablesCommands(t *testing.T) {
|
||||
protocol Protocol
|
||||
expectedCmd string
|
||||
}{
|
||||
{"iptablesCommand", ProtocolIpv4, cmdIPTables},
|
||||
{"iptablesCommand", ProtocolIpv6, cmdIP6Tables},
|
||||
{"iptablesSaveCommand", ProtocolIpv4, cmdIPTablesSave},
|
||||
{"iptablesSaveCommand", ProtocolIpv6, cmdIP6TablesSave},
|
||||
{"iptablesRestoreCommand", ProtocolIpv4, cmdIPTablesRestore},
|
||||
{"iptablesRestoreCommand", ProtocolIpv6, cmdIP6TablesRestore},
|
||||
{"iptablesCommand", ProtocolIPv4, cmdIPTables},
|
||||
{"iptablesCommand", ProtocolIPv6, cmdIP6Tables},
|
||||
{"iptablesSaveCommand", ProtocolIPv4, cmdIPTablesSave},
|
||||
{"iptablesSaveCommand", ProtocolIPv6, cmdIP6TablesSave},
|
||||
{"iptablesRestoreCommand", ProtocolIPv4, cmdIPTablesRestore},
|
||||
{"iptablesRestoreCommand", ProtocolIPv6, cmdIP6TablesRestore},
|
||||
}
|
||||
for _, testCase := range testCases {
|
||||
var cmd string
|
||||
@ -641,7 +641,7 @@ func TestWaitFlagUnavailable(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteChain(TableNAT, Chain("FOOBAR"))
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -672,7 +672,7 @@ func TestWaitFlagOld(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteChain(TableNAT, Chain("FOOBAR"))
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -706,7 +706,7 @@ func TestWaitFlagNew(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteChain(TableNAT, Chain("FOOBAR"))
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -737,7 +737,7 @@ func TestWaitIntervalFlagNew(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := New(&fexec, ProtocolIpv4)
|
||||
runner := New(&fexec, ProtocolIPv4)
|
||||
err := runner.DeleteChain(TableNAT, Chain("FOOBAR"))
|
||||
if err != nil {
|
||||
t.Errorf("expected success, got %v", err)
|
||||
@ -817,11 +817,11 @@ COMMIT
|
||||
}
|
||||
|
||||
func TestSaveIntoIPv4(t *testing.T) {
|
||||
testSaveInto(t, ProtocolIpv4)
|
||||
testSaveInto(t, ProtocolIPv4)
|
||||
}
|
||||
|
||||
func TestSaveIntoIPv6(t *testing.T) {
|
||||
testSaveInto(t, ProtocolIpv6)
|
||||
testSaveInto(t, ProtocolIPv6)
|
||||
}
|
||||
|
||||
func testRestore(t *testing.T, protocol Protocol) {
|
||||
@ -908,11 +908,11 @@ func testRestore(t *testing.T, protocol Protocol) {
|
||||
}
|
||||
|
||||
func TestRestoreIPv4(t *testing.T) {
|
||||
testRestore(t, ProtocolIpv4)
|
||||
testRestore(t, ProtocolIPv4)
|
||||
}
|
||||
|
||||
func TestRestoreIPv6(t *testing.T) {
|
||||
testRestore(t, ProtocolIpv6)
|
||||
testRestore(t, ProtocolIPv6)
|
||||
}
|
||||
|
||||
// TestRestoreAll tests only the simplest use case, as flag handling code is already tested in TestRestore
|
||||
@ -932,7 +932,7 @@ func TestRestoreAll(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := newInternal(&fexec, ProtocolIpv4, TestLockfilePath)
|
||||
runner := newInternal(&fexec, ProtocolIPv4, TestLockfilePath)
|
||||
defer os.Remove(TestLockfilePath)
|
||||
|
||||
err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters)
|
||||
@ -973,7 +973,7 @@ func TestRestoreAllWait(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := newInternal(&fexec, ProtocolIpv4, TestLockfilePath)
|
||||
runner := newInternal(&fexec, ProtocolIPv4, TestLockfilePath)
|
||||
defer os.Remove(TestLockfilePath)
|
||||
|
||||
err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters)
|
||||
@ -1018,7 +1018,7 @@ func TestRestoreAllWaitOldIptablesRestore(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := newInternal(&fexec, ProtocolIpv4, TestLockfilePath)
|
||||
runner := newInternal(&fexec, ProtocolIPv4, TestLockfilePath)
|
||||
defer os.Remove(TestLockfilePath)
|
||||
|
||||
err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters)
|
||||
@ -1064,7 +1064,7 @@ func TestRestoreAllGrabNewLock(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
runner := newInternal(&fexec, ProtocolIpv4, TestLockfilePath)
|
||||
runner := newInternal(&fexec, ProtocolIPv4, TestLockfilePath)
|
||||
defer os.Remove(TestLockfilePath)
|
||||
|
||||
// Grab the /run lock and ensure the RestoreAll fails
|
||||
@ -1106,7 +1106,7 @@ func TestRestoreAllGrabOldLock(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
runner := newInternal(&fexec, ProtocolIpv4, TestLockfilePath)
|
||||
runner := newInternal(&fexec, ProtocolIPv4, TestLockfilePath)
|
||||
defer os.Remove(TestLockfilePath)
|
||||
|
||||
// Grab the abstract @xtables socket
|
||||
@ -1146,7 +1146,7 @@ func TestRestoreAllWaitBackportedIptablesRestore(t *testing.T) {
|
||||
func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
|
||||
},
|
||||
}
|
||||
runner := newInternal(&fexec, ProtocolIpv4, TestLockfilePath)
|
||||
runner := newInternal(&fexec, ProtocolIPv4, TestLockfilePath)
|
||||
defer os.Remove(TestLockfilePath)
|
||||
|
||||
err := runner.RestoreAll([]byte{}, NoFlushTables, RestoreCounters)
|
||||
|
@ -180,7 +180,7 @@ func (mfc *monitorFakeCmd) Stop() {
|
||||
|
||||
func TestIPTablesMonitor(t *testing.T) {
|
||||
mfe := newMonitorFakeExec()
|
||||
ipt := New(mfe, ProtocolIpv4)
|
||||
ipt := New(mfe, ProtocolIPv4)
|
||||
|
||||
var reloads uint32
|
||||
stopCh := make(chan struct{})
|
||||
|
@ -62,12 +62,12 @@ type FakeIPTables struct {
|
||||
|
||||
// NewFake returns a no-op iptables.Interface
|
||||
func NewFake() *FakeIPTables {
|
||||
return &FakeIPTables{protocol: iptables.ProtocolIpv4}
|
||||
return &FakeIPTables{protocol: iptables.ProtocolIPv4}
|
||||
}
|
||||
|
||||
// NewIpv6Fake returns a no-op iptables.Interface with IsIPv6() == true
|
||||
func NewIpv6Fake() *FakeIPTables {
|
||||
return &FakeIPTables{protocol: iptables.ProtocolIpv6}
|
||||
// NewIPv6Fake returns a no-op iptables.Interface with IsIPv6() == true
|
||||
func NewIPv6Fake() *FakeIPTables {
|
||||
return &FakeIPTables{protocol: iptables.ProtocolIPv6}
|
||||
}
|
||||
|
||||
// SetHasRandomFully is part of iptables.Interface
|
||||
@ -103,7 +103,7 @@ func (*FakeIPTables) DeleteRule(table iptables.Table, chain iptables.Chain, args
|
||||
|
||||
// IsIPv6 is part of iptables.Interface
|
||||
func (f *FakeIPTables) IsIPv6() bool {
|
||||
return f.protocol == iptables.ProtocolIpv6
|
||||
return f.protocol == iptables.ProtocolIPv6
|
||||
}
|
||||
|
||||
// Protocol is part of iptables.Interface
|
||||
|
Loading…
Reference in New Issue
Block a user