. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("IptablesManager", func() { var ( fakeChains []*fake_chain.FakeChain manager *iptables_manager.IPTablesManager containerID string bridgeName string ip net.IP network *net.IPNet ) BeforeEach(func() { manager = iptables_manager.New() fakeChains = []*fake_chain.FakeChain{} for i := 0; i < 2; i++ { fakeChain := new(fake_chain.FakeChain) fakeChains = append(fakeChains, fakeChain) manager.AddChain(fakeChain) } containerID = "some-ctr-id" bridgeName = "some-bridge" var err error ip, network, err = net.ParseCIDR("1.2.3.4/28") Expect(err).NotTo(HaveOccurred()) })
func createIPTablesManager(sysconfig sysconfig.Config, runner command_runner.CommandRunner, log lager.Logger) linux_container.IPTablesManager { filterChain := iptables_manager.NewFilterChain(&sysconfig.IPTables.Filter, runner, log.Session("iptables-manager-filter")) natChain := iptables_manager.NewNATChain(&sysconfig.IPTables.NAT, runner, log.Session("iptables-manager-nat")) return iptables_manager.New().AddChain(filterChain).AddChain(natChain) }