@Test public void test() { IptablesRule ir = new IptablesRule("80", "HTTP/NGINX"); System.err.println(ir.getRule()); List<IP> ipList = new ArrayList<IP>(); ipList.add(new IP("10.17.0.0/8")); IptablesRule ir2 = new IptablesRule(ipList, "内网"); System.err.println(ir2.getRule()); ipList.add(new IP("192.168.0.0/16")); ipList.add(new IP("10.0.0.0/8")); IptablesRule ir3 = new IptablesRule(ipList, "多个内网"); System.err.println(ir3.getRule()); IptablesRule ir4 = new IptablesRule("8080",ipList,"HTTP/TOMCAT"); System.err.println(ir4.getRule()); IptablesRule ir5 = new IptablesRule("8080:8090",ipList,"HTTP/TOMCAT"); System.err.println(ir5.getRule()); }
public String getRule() { buildRuleByType(); return getDesc() + getRuleHead() + ruleBody; }
IptablesRule { public String getRule() { buildRuleByType(); return getDesc() + getRuleHead() + ruleBody; } }
IptablesRule { public String getRule() { buildRuleByType(); return getDesc() + getRuleHead() + ruleBody; } IptablesRule(String port, List<IP> ips, int ruleType, String desc);  IptablesRule(String port, List<IP> ips, String desc);  IptablesRule(String port, String desc);  IptablesRule(List<IP> ips, String desc); }
IptablesRule { public String getRule() { buildRuleByType(); return getDesc() + getRuleHead() + ruleBody; } IptablesRule(String port, List<IP> ips, int ruleType, String desc);  IptablesRule(String port, List<IP> ips, String desc);  IptablesRule(String port, String desc);  IptablesRule(List<IP> ips, String desc); String getDesc(); void setDesc(String desc); String getRule(); }
IptablesRule { public String getRule() { buildRuleByType(); return getDesc() + getRuleHead() + ruleBody; } IptablesRule(String port, List<IP> ips, int ruleType, String desc);  IptablesRule(String port, List<IP> ips, String desc);  IptablesRule(String port, String desc);  IptablesRule(List<IP> ips, String desc); String getDesc(); void setDesc(String desc); String getRule(); final static int ruleTypeAllowIP4Port; final static int ruleTypeOpenPort; final static int ruleTypeAllowIP; }