Class MaskIPV4Address
java.lang.Object
com.github.eventmanager.processors.MaskIPV4Address
- All Implemented Interfaces:
Processor
The MaskIPV4Address class implements the Processor interface and provides methods to mask IPv4 addresses in
different event formats (KV, JSON, XML). The class also provides methods to check if an IP address is in a CIDR
range and to convert an IP address to a long value. The class uses a list of CIDR ranges to mask the IP addresses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isIpInCidr
(String ip, String cidr) Checks if the given IP address is in the specified CIDR range.processJSON
(String event) Processes a JSON formatted event and masks any IPv4 addresses that match the CIDR ranges.Processes a key-value formatted event and masks any IPv4 addresses that match the CIDR ranges.processXML
(String event) Processes an XML formatted event and masks any IPv4 addresses that match the CIDR ranges.
-
Constructor Details
-
MaskIPV4Address
-
-
Method Details
-
processKV
Processes a key-value formatted event and masks any IPv4 addresses that match the CIDR ranges. -
processJSON
Processes a JSON formatted event and masks any IPv4 addresses that match the CIDR ranges.- Specified by:
processJSON
in interfaceProcessor
- Parameters:
event
- the JSON formatted event string.- Returns:
- the event string with masked IPv4 addresses.
-
processXML
Processes an XML formatted event and masks any IPv4 addresses that match the CIDR ranges.- Specified by:
processXML
in interfaceProcessor
- Parameters:
event
- the XML formatted event string.- Returns:
- the event string with masked IPv4 addresses.
-
isIpInCidr
Checks if the given IP address is in the specified CIDR range.- Parameters:
ip
- the IP address to check.cidr
- the CIDR range to check against.- Returns:
- true if the IP address is in the CIDR range, false otherwise.
-