Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindIpOnByte ¶
This is a FindIpOnByte function that tries to find an IP address in a given string and returns it as a string. The function uses an array of bytes (buf) to store the IP address while parsing it and several variables (C, I, P) to keep track of the current position in the byte array and in the input string. The function iterates over the input string, character by character, and uses a series of conditional statements, to check if the current character is a valid part of the IP address. If a valid character is found, it is added to the byte array (buf) and the variables are updated accordingly. If an invalid character is found, the function checks to see if the full IP address has been found (checking whether whether the number of dots is 3 and the number of allowed characters is greater than 5), and if so, it uses net.ParseIP to parse the IP address and convert it to the net.IP type. The .String() method is then used to return the IP address as a string. The function returns an empty string if no valid IP address is found in the input string.
Types ¶
This section is empty.