java.lang.Object
com.aoindustries.aoserv.daemon.iptables.Ipset
Handles access to ipset.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumipset has a global namespace.static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCallsipset -A.static voidcreate(String setName, Ipset.SetType setType, String... options) Callsipset -N.static voidCallsipset -D.static voidParses an ipset save file, returning the mutable set of IP addresses in order dumped.static StringCallsipset -S, skipping any comment lines.static voidsynchronize(Set<Integer> entries, short networkPrefix, String setName, PosixFile setDir) Synchronizes a single set to the expected entries, both in-kernel and on-disk versions.
-
Field Details
-
MAX_IPSET_SIZE
public static final int MAX_IPSET_SIZE- See Also:
-
HOST_NETWORK_PREFIX
public static final short HOST_NETWORK_PREFIX- See Also:
-
-
Method Details
-
save
Callsipset -S, skipping any comment lines.- Parameters:
setName- the name of the setmissingAsNull- when true, a missing set will be returned as null, otherwise will throw an exception- Throws:
IOException
-
create
public static void create(String setName, Ipset.SetType setType, String... options) throws IOException Callsipset -N.- Throws:
IOException
-
delete
Callsipset -D.- Throws:
IOException
-
add
Callsipset -A.- Throws:
IOException
-
parse
Parses an ipset save file, returning the mutable set of IP addresses in order dumped.- Throws:
IOException
-
synchronize
public static void synchronize(Set<Integer> entries, short networkPrefix, String setName, PosixFile setDir) throws IOException Synchronizes a single set to the expected entries, both in-kernel and on-disk versions. Creates set in kernel if missing. Adds/removes any necessary changes. Updates on-disk only if missing or set modified.- Parameters:
entries- the ip or network entries, only the firstMAX_IPSET_SIZEentries will be usednetworkPrefix- the network prefix orHOST_NETWORK_PREFIXfor individual hostssetName- the set name used both in-kernel and on-disksetDir- the directory that stores the on-disk version- Throws:
IOException
-
