Method and device for retrieving address

By polling the address pool in the cloud computing platform and controlling the self-increase of parameters, the problem of low IP address retrieval efficiency is solved, and more efficient address retrieval and more stable system performance is achieved.

CN118503506BActive Publication Date: 2024-11-12JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410959031.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-11-12
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

The prior art has low efficiency in retrieving IP addresses in cloud computing platforms, especially in the case of large network segments, resulting in system stability and response capabilities being affected.

Method used

By obtaining search instructions, polling the address segments in the address pool, converting the start and end addresses into an array, and controlling the parameters to perform self-increasing operations according to the search conditions to determine the legal address and improve the search efficiency.

Benefits of technology

It improves the efficiency of IP address retrieval, reduces memory resource usage and time consumption, and improves system stability and response capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503506B_ABST
    Figure CN118503506B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a method and device for retrieving an address, wherein the method includes: obtaining a retrieval instruction, the retrieval instruction is used to instruct to retrieve a legal address that meets the retrieval condition in the address pool, the retrieval instruction carries the retrieval condition, and the address pool includes N address segments; polling each address segment in the address pool, converting the starting address in the currently polled address segment into a starting array, and converting the ending address into a ending array; controlling M parameters to perform a self-increment operation according to a loop condition corresponding to the retrieval condition, determining a legal address in the currently polled address segment, and performing a self-increment operation on the first parameter starting from the first element in the starting array, and ending the self-increment operation when the value of the first parameter is greater than the first element in the ending array. Through the present application, the problem of low efficiency in retrieving addresses is solved, and the technical effect of improving the efficiency of address retrieval is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the computer field, and in particular, to a method and device for retrieving an address. Background Art

[0002] Against the backdrop of new productivity strengthening strategic emerging industries and actively promoting the development of future industries, cloud computing, as a part of information infrastructure construction that has been deeply rooted for many years and has provided major changes to all walks of life, has penetrated into all aspects of many fields.

[0003] Infrastructure as a Service (IaaS) refers to the provision of Internet infrastructure as a service through the Internet. In this service model, users do not need to build a data center by themselves, but use infrastructure services, including servers, storage and networks, by renting. In terms of usage mode, IaaS is similar to traditional hosting, but IaaS has strong advantages in terms of service flexibility, scalability and cost. Virtualization is often used as the basis of cloud computing. Virtualization separates resources and services from the physical underlying delivery environment. In this way, multiple virtual systems can be created within a single physical system. The driving factor of virtualization comes from the consolidation of servers, which can provide efficiency and potential cost savings for organizations.

[0004] When managing computing, network and other resources, subnet is one of the key resources. When we create cloud hosts, load balancers, floating Internet Protocol (IP), bare metal, virtual network cards and other resources, we need to use subnets to occupy an Internet Protocol (IP) address to provide original services. However, how to let users know which IP addresses are available, or how to query and occupy some specific IP addresses under specific conditions, is an important service capability that should be possessed in a cloud platform.

[0005] The original fuzzy matching is rather rigid. First, the available IP address range is obtained from the address pool. This is a set of sequences, each element of which contains the start and end IP addresses, such as [192.168.0.2-192.168.0.10, 192.168.0.20-192.168.0.30]. Then the IP start and end addresses are converted into corresponding decimal numbers [3232235522-3232235530, 3232235540-3232235550]. Then, all the IP address decimal values ​​are generated in natural order and then converted into IP address format respectively. Finally, string matching is performed to filter out the IP addresses that meet the screening criteria. The strategy of this method is to generate the full amount first, and then filter and screen it. It will inevitably process a lot of unnecessary data. Moreover, for large network segments with more addresses, generating all the data will take up a lot of memory resources and time. This will inevitably seriously affect the stability and responsiveness of the system. For example, 10.0.0.0 / 24 contains 256 addresses, while 10.0.0.0 / 8 contains 16777216 addresses.

[0006] There is currently no effective solution to the above problems. Summary of the invention

[0007] The embodiments of the present application provide a method and device for retrieving an address, so as to at least solve the problem of low efficiency in retrieving an address in the related art.

[0008] According to one embodiment of the present application, a method for retrieving an address is provided, comprising: obtaining a retrieval instruction, wherein the retrieval instruction is used to instruct to retrieve a legal address that meets a retrieval condition in an address pool, the retrieval instruction carries the retrieval condition, the address pool includes N address segments, N is an integer greater than or equal to 1, and the address segment includes a start address and an end address; polling each address segment in the address pool, converting the start address in the address segment currently polled into a start array, and converting the end address into a end array; controlling M parameters to perform a self-increment operation according to a loop condition corresponding to the retrieval condition, and determining the legal address in the address segment currently polled, wherein M is an integer greater than or equal to 1, and the legal address includes M parameter values, the first parameter performs the self-increment operation starting from the first element in the start array, and ends the self-increment operation when the value of the first parameter is greater than the first element in the end array.

[0009] In an exemplary embodiment, M parameters are controlled to perform a self-increment operation according to a loop condition corresponding to the retrieval condition to obtain the legal address, including: when the retrieval condition is empty and the number of legal addresses currently retrieved is less than a preset number threshold, the first parameter is controlled to perform the self-increment operation starting from the first element in the starting array; according to the value of the jth parameter among the M parameters, the j+1th parameter is controlled to perform the self-increment operation to obtain M parameter values, where j is an integer greater than or equal to 1 and less than M; and the M parameter values ​​are assembled into the legal address.

[0010] In an exemplary embodiment, controlling the j+1th parameter to perform the self-increment operation according to the value of the jth parameter among the M parameters includes: determining whether the current value of the jth parameter is equal to the jth element in the starting array; if they are equal, controlling the j+1th parameter to perform the self-increment operation starting from the j+1th element in the starting array; if they are not equal, controlling the j+1th parameter to perform the self-increment operation starting from 0.

[0011] In an exemplary embodiment, controlling M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address also includes: when the search condition is S characters, and the S characters do not contain a dot, and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array, wherein S is an integer greater than or equal to 1; determining a first string array, wherein the first string array includes an element consisting of S characters; determining M matching positions; determining whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, controlling the M parameters to perform the self-increment operation, and obtaining M parameter values; assembling the M parameter values ​​into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0012] In an exemplary embodiment, determining whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, controlling the M parameters to perform the self-increment operation, and obtaining M parameter values, includes: when the current matching position is the kth matching position and the current value of the kth parameter includes the one element, judging whether the current value of the kth parameter is equal to the kth element in the starting array, k is an integer greater than or equal to 1 and less than M; if they are equal, controlling the k+1th parameter to perform the self-increment operation starting from the k+1th element in the starting array; if they are not equal, controlling the k+1th parameter to perform the self-increment operation starting from 0.

[0013] In an exemplary embodiment, assembling the M parameter values ​​into the legal address includes: when the current matching position is the Mth matching position and the value of the Mth parameter includes the one element, assembling the M parameter values ​​into the legal address.

[0014] In an exemplary embodiment, when M=4, M parameters are controlled to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address, and it also includes: when the search condition is T characters, the T characters contain a dot, and the number of legal addresses currently retrieved is less than a preset number threshold, the first parameter is controlled to perform the self-increment operation starting from the first element in the starting array, wherein T is an integer greater than 1; the T characters are divided to obtain a second string array, wherein the second string array includes two elements, the element corresponding to the dot at the first or last position of the T characters is empty, and the other elements are strings; M-1 matching positions are determined; according to the M-1 matching positions, whether the values ​​of the M parameters start or end with an element in the second string array is determined; the j+1th parameter is controlled to perform the self-increment operation to obtain M parameter values; the M parameter values ​​are assembled into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0015] In an exemplary embodiment, determining whether the values ​​of the M parameters start or end with an element in the second string array according to the M-1 matching positions controls the j+1th parameter to perform the self-increment operation to obtain M parameter values, including: when the current matching position is the first matching position, the first element in the second string array is not empty, and the current value of the first parameter does not end with the first element in the second string array, controlling the current value of the first parameter to perform an increment operation; otherwise, determining whether the current value of the first parameter is equal to the first element in the starting array; if they are equal, controlling the second parameter to perform the self-increment operation starting from the second element in the starting array; if they are not equal, controlling the second parameter to perform the self-increment operation starting from 0.

[0016] In an exemplary embodiment, after controlling the second parameter to perform the self-increment operation, the method further includes: when the current matching position is the first matching position, the second element in the second string array is not empty, and the current value of the second parameter does not start with the second element in the second string array, or when the current matching position is the second matching position, the first element in the second string array is not empty, and the current value of the second parameter does not end with the first element in the second string array, controlling the current value of the second parameter to perform an increment operation; otherwise, determining whether the current value of the second parameter is equal to the second element in the starting array; if they are equal, controlling the third parameter to perform the self-increment operation starting from the third element in the starting array; if they are not equal, controlling the third parameter to perform the self-increment operation starting from 0.

[0017] In an exemplary embodiment, after controlling the third parameter to perform the self-increment operation, the method further includes: when the current matching position is the second matching position, the second element in the second string array is not empty, and the value of the third parameter does not start with the second element in the second string array, or when the current matching position is the third matching position, the first element in the second string array is not empty, and the value of the third parameter does not end with the first element in the second string array, controlling the current value of the second parameter to perform the addition operation; otherwise, determining whether the current value of the third parameter is equal to the third element in the starting array; if they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, controlling the fourth parameter to perform the self-increment operation from 0.

[0018] In an exemplary embodiment, after controlling the fourth parameter to perform the self-increment operation, the method further includes: when the current matching position is the third matching position, the second element in the second string array is not a null character, and the value of the fourth parameter does not start with the second element in the second string array, controlling the value of the fourth parameter to perform an increment operation; otherwise, assembling the M parameter values ​​into the legal address.

[0019] In an exemplary embodiment, when M=4, M parameters are controlled to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address, and it also includes: when the search condition is R characters, the R characters contain two points, and the number of legal addresses currently retrieved is less than a preset number threshold, the first parameter is controlled to perform the self-increment operation starting from the first element in the starting array, wherein R is an integer greater than 2; the R characters are divided to obtain a third string array, wherein the third string array includes three elements, the element corresponding to the point at the first or last position of the T characters is empty, and the other elements are strings; M-2 matching positions are determined; according to the M-2 matching positions, whether the values ​​of the M parameters start or end with an element in the third string array is determined; the j+1th parameter is controlled to perform the self-increment operation to obtain M parameter values; the M parameter values ​​are assembled into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0020] In an exemplary embodiment, determining whether the values ​​of the M parameters start or end with an element in the third string array based on the M-2 matching positions controls the j+1th parameter to perform the self-increment operation to obtain M parameter values, including: when the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array, controlling the value of the first parameter to perform a plus-one operation; otherwise, determining whether the current value of the first parameter is equal to the first element in the starting array; if they are equal, controlling the second parameter to perform the self-increment operation starting from the second element in the starting array; if they are not equal, controlling the second parameter to perform the self-increment operation starting from 0.

[0021] In an exemplary embodiment, after controlling the second parameter to perform the self-increment operation, the method further includes: when the current value of the first parameter is equal to the first element in the starting array, setting the first minimum value to the second element in the ending array and determining the first maximum value as the second element in the ending array, otherwise setting the first minimum value to 0 and determining the first maximum value to 255; when the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array, controlling the value of the first parameter to perform an increment operation; otherwise, setting the current value of the second parameter to the second element in the third string array; when the current value of the second parameter is greater than or equal to the first minimum value and less than or equal to the first maximum value, determining whether the current value of the second parameter is equal to the second element in the ending array; if they are equal, controlling the third parameter to perform the self-increment operation starting from the third element in the starting array; if they are not equal, controlling the third parameter to perform the self-increment operation starting from 0.

[0022] In an exemplary embodiment, after controlling the third parameter to perform the self-increment operation, the method further includes: when the third element in the third string array is not empty and the current value of the third parameter does not start with the third element in the third string array, controlling the value of the third parameter to perform an increment operation; otherwise, determining whether the current value of the third parameter is equal to the third element in the termination array; if they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, controlling the fourth parameter to perform the self-increment operation starting from 0.

[0023] In an exemplary embodiment, the method further includes: when the current matching position is not the first matching position, controlling the second parameter to perform the self-increment operation starting from the first minimum value; when the first element in the third string array is not empty and the current value of the second parameter does not end with the first element in the third string array, controlling the value of the second parameter to perform the addition operation; otherwise, if the current value of the second parameter is equal to the second element in the starting array, setting the second minimum value to the third element in the starting array, otherwise setting the second minimum value to 0; if the current value of the second parameter is equal to the second element in the ending array, setting the second maximum value to the third element in the ending array, otherwise setting the second maximum value to 255.

[0024] In an exemplary embodiment, the method further includes: setting the current value of the third parameter to the second element in the third string array; when the current value of the third parameter is less than the second minimum value or greater than the second maximum value, controlling the value of the first parameter to perform an increment operation; otherwise, determining whether the current value of the third parameter is equal to the third element in the starting array; if they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, controlling the fourth parameter to perform the self-increment operation starting from 0.

[0025] In an exemplary embodiment, after controlling the fourth parameter to perform the self-increment operation, the method further includes: when the third element in the third string array is not empty and the current value of the fourth parameter does not start with the third element in the third string array, controlling the value of the fourth parameter to perform an increment operation; otherwise, assembling the M parameter values ​​into the legal address.

[0026] In an exemplary embodiment, when M=4, controlling M parameters to perform an increment operation according to a loop condition corresponding to the search condition to obtain the legal address, further comprising: when the search condition is X characters, the X characters include three dots, and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the increment operation starting from the first element in the starting array, wherein X is an integer greater than 3; dividing the X characters to obtain a fourth character string array, wherein the fourth character string array includes four elements, the element corresponding to the dot at the first or last position of the T characters is empty, and the other elements are characters. string; when the first element in the fourth string array is not empty and the current value of the first parameter does not end with the first element in the fourth string array, control the value of the first parameter to perform an addition operation; otherwise, when the current value of the first parameter is equal to the first element in the starting array, set the third minimum value to the second element in the starting array, otherwise set the third minimum value to 0; if the current value of the first parameter is equal to the first element in the terminating array, set the third maximum value to the second element in the terminating array, otherwise set the third maximum value to 255.

[0027] In an exemplary embodiment, the method further includes: setting the value of the second parameter to the second element in the fourth string array; when the current value of the second parameter is less than the third minimum value or greater than the third maximum value, determining whether there is a next address segment in the address pool; when the next address segment exists, polling the next address segment to determine the legal address in the next address segment; otherwise, if the current value of the second parameter is equal to the second element in the starting array, setting the fourth minimum value to the third element in the starting array, otherwise setting the fourth minimum value to 0; if the current value of the second parameter is equal to the second element in the ending array, setting the fourth maximum value to the third element in the ending array, otherwise setting the fourth maximum value to 255.

[0028] In an exemplary embodiment, the method further includes: setting the value of the third parameter to the fourth element in the fourth string array; when the current value of the third parameter is less than the fourth minimum value and or greater than the fourth maximum value, determining whether the address pool has a next address segment; when the next address segment exists, polling the next address segment and determining the legal address in the next address segment; otherwise, determining whether the current value of the third parameter is equal to the third element in the starting array; when they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; when they are not equal, controlling the fourth parameter to perform the self-increment operation starting from 0.

[0029] In an exemplary embodiment, after controlling the fourth parameter to perform the self-increment operation starting from 0, the method further includes: when the fourth element in the fourth string array is not empty and the current value of the fourth parameter does not start with the fourth element in the fourth string array, controlling the value of the fourth parameter to perform an increment operation; otherwise, assembling the M parameter values ​​into the legal address.

[0030] According to another embodiment of the present application, a device for retrieving an address is provided, comprising: an acquisition module, used to acquire a retrieval instruction, wherein the retrieval instruction is used to instruct to retrieve a legal address that meets the retrieval condition in an address pool, the retrieval instruction carries the retrieval condition, the address pool includes N address segments, N is an integer greater than or equal to 1, and the address segment includes a start address and an end address; a conversion module, used to poll each address segment in the address pool, convert the start address in the address segment currently polled into a start array, and convert the end address into a end array; a control module, used to control M parameters to perform a self-increment operation according to a loop condition corresponding to the retrieval condition, and determine the legal address in the address segment currently polled, wherein M is an integer greater than or equal to 1, and the legal address includes M parameter values, the first parameter performs the self-increment operation starting from the first element in the start array, and ends the self-increment operation when the value of the first parameter is greater than the first element in the end array.

[0031] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0032] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0033] According to another embodiment of the present application, a computer program product is further provided. When the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0034] Through the present application, since the address pool includes N address segments, the retrieval instruction is obtained to poll each address segment in the address pool, and the starting address in the currently polled address segment is converted into a starting array, and the ending address is converted into an ending array; M parameters are controlled to perform a self-increment operation according to a loop condition corresponding to the retrieval condition, and a legal address is determined in the currently polled address segment. Therefore, the problem of low efficiency in retrieving addresses can be solved, and the technical effect of improving the efficiency of address retrieval can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a hardware structure block diagram of a server device of a method for retrieving an address in an embodiment of the present application;

[0036] Figure 2 is a flowchart of a method for retrieving an address according to an embodiment of the present application;

[0037] Figure 3 is a schematic diagram of type 1 according to an embodiment of the present application;

[0038] Figure 4 is a schematic diagram of type 2 according to an embodiment of the present application;

[0039] Figure 5 is a schematic diagram of type 3 according to an embodiment of the present application;

[0040] Figure 6 is a schematic diagram of type 4 according to an embodiment of the present application;

[0041] Figure 7 is a schematic diagram of type five according to an embodiment of the present application;

[0042] Figure 8 This is a schematic diagram of the process according to the embodiment of the present application Figure 1 ;

[0043] Fig. 9 This is a schematic diagram of the process according to the embodiment of the present application Figure 2 ;

[0044] Fig.10 This is a schematic diagram of the process according to the embodiment of the present application Figure 3 ;

[0045] Fig.11 This is a schematic diagram of the process according to the embodiment of the present application Figure 4 ;

[0046] Fig.12 This is a schematic diagram of the process according to the embodiment of the present application Figure 5 ;

[0047] Fig.13 This is a schematic diagram of the process according to the embodiment of the present application Figure 6 ;

[0048] Fig.14 It is a schematic diagram of the structure of a device for retrieving an address according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0051] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 11 is a hardware structure block diagram of a server device of a method for retrieving an address in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0052] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for retrieving addresses in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0053] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0054] In this embodiment, a method for retrieving an address is provided. Figure 2 is a flowchart of a method for retrieving an address according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0055] Step S202, obtaining a search instruction, wherein the search instruction is used to instruct to search for a legal address that meets a search condition in an address pool, the search instruction carries the search condition, the address pool includes N address segments, N is an integer greater than or equal to 1, and the address segment includes a start address and an end address;

[0056] Step S204, polling each address segment in the address pool, converting the start address in the address segment currently polled into a start array, and converting the end address into an end array;

[0057] Step S106, controlling M parameters to perform a self-increment operation according to a loop condition corresponding to the retrieval condition, and determining the legal address in the address segment currently polled, wherein M is an integer greater than or equal to 1, and the legal address includes M parameter values, and the first parameter performs the self-increment operation starting from the first element in the starting array, and when the value of the first parameter is greater than the first element in the ending array, the self-increment operation ends.

[0058] Since the address pool includes N address segments, the retrieval instruction is obtained to poll each address segment in the address pool, and the start address in the currently polled address segment is converted into a start array, and the end address is converted into an end array; the M parameters are controlled to perform a self-increment operation according to the loop condition corresponding to the retrieval condition, and a legal address is determined in the currently polled address segment. Therefore, the problem of low efficiency in address retrieval can be solved, and the technical effect of improving the address retrieval efficiency can be achieved.

[0059] The execution subject of the above steps may be a server, a terminal, etc., but is not limited thereto.

[0060] When the subnet in Neutron is mounted to other cloud resources as the allocation source of the virtual network card, a fixed IP sequence can be conveniently and efficiently generated dynamically based on the characters to be retrieved.

[0061] This application supports fuzzy matching and supports controlling the number of generated ones. Fuzzy matching means that when the user enters a string to be searched, the IP address containing this string at any position is returned. For example, if 168.1 is searched in the network segment 192.168.0.0 / 16, then 192.168.1.1, 192.168.1.2, 192.168.1.3, 192.168.168.1, 192.168.168.11, 192.168.168.12, 192.168.168.110, 192.168.168.120, etc. are all matching items that meet the search criteria.

[0062] The incoming fuzzy matching parameters can be divided into five types:

[0063] Type 1: The search command entered by the user does not contain any parameters (empty or empty string). In this case, all IP addresses in the address pool meet the requirements. For example, Figure 3 The following is a type of retrieval address without parameter transmission;

[0064] Type 2: The search instruction entered by the user contains parameters, but does not contain a dot in the IPv4 address (for example, the parameters of the search instruction are S characters, and the S characters do not contain a dot), such as Figure 4 If the search instruction contains only the character "1", the first string array is generated, including an element of 1. For another example, if the search instruction is "100", the string is split according to "." to assemble the first string array, which is an array containing one element "100";

[0065] Type 3: The search command entered by the user contains a parameter, and there is one "." in the IPv4 address (for example, the parameter of the search command is R characters, and the R characters contain two dots). Figure 5 It is shown that there is a "." in the parameter of the search instruction.

[0066] For another example, the parameters of the search instruction are ".100", "100.100" or "100.". The string is split according to the "." and assembled into a string array (the second string array). The second string array contains an array of two elements. The elements generated by the first and last "." are empty strings. The "." between the strings does not generate an element, and the string between two "." generates a string element.

[0067] For example, ".100" generates an empty string as the first element and "100" as the second element; "100.100" generates both elements as "100"; and "100." generates 100 as the first element and an empty string as the second element.

[0068] Type 4: The search command entered by the user contains parameters, and there are two "." in the IPv4 address, such as Figure 6 It is shown that there are two "." in the parameters of the search instruction.

[0069] For another example, the parameters in the search command input by the user are "100.100.", ".100.100", "100.100.100" or ".100.", and the string is split according to the "." to assemble into a string array (the third string array), and the third string array contains three elements. As in the above embodiment, the elements generated by the first and last "." are empty strings, the "." between the strings does not generate an element, and the string between two "." generates a string element. Therefore, there is a situation in which the element is an empty string in type four.

[0070] For example, "100.100." is split into a string array (the third string array) according to ".". The first element is "100", the second element is "100", and the third element is empty.

[0071] The three elements of "100.100.100" assembled into a string array (the third string array) are all "100".

[0072] Type 5: The search command entered by the user contains parameters, and there are three "." in the IPv4 address, such as Figure 7 As shown, there are three "." in the parameters of the search instruction.

[0073] For another example, the parameters in the search command input by the user are "100.100.100.", ".100.100.100", "100.100.100.100" or ".100.100.100.", and the string is split according to the "." to assemble into a string array (the fourth string array), and the fourth string array contains four elements. As in the above embodiment, the elements generated by the first and last "." are empty strings, the "." between the strings does not generate an element, and the string between two "." generates a string element. Therefore, there is a situation in which the element is an empty string in type five.

[0074] For the above type 1:

[0075] When the search condition is empty and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array;

[0076] According to the value of the jth parameter among the M parameters, control the j+1th parameter to perform the self-increment operation to obtain M parameter values, where j is an integer greater than or equal to 1 and less than M;

[0077] The M parameter values ​​are assembled into the legal address.

[0078] Among them, according to the value of the jth parameter among the M parameters, controlling the j+1th parameter to perform the self-increment operation includes:

[0079] Determine whether the current value of the j-th parameter is equal to the j-th element in the starting array; if they are equal, control the j+1-th parameter to perform the self-increment operation starting from the j+1-th element in the starting array; if they are not equal, control the j+1-th parameter to perform the self-increment operation starting from 0.

[0080] like Figure 8 The following is a flow chart of the type 1 getIpsOf0 algorithm:

[0081] First, you need to define the incoming parameters: the IP array ips to be generated that meets the conditions (ips records the legal addresses that meet the search conditions), the address pool array ipRanges (the address pool array includes N address segments), the number of IPs to be generated num (can be determined according to the actual situation, can be the default value, or can be a value used for setting, indicating the number of legal addresses retrieved. For example, it can be the default value 100, or it can be 50 carried in the user's search instruction, etc.), including the following steps:

[0082] S1: If the number of IPs in ips reaches num, exit, otherwise continue to execute;

[0083] S 2: If ipRanges is empty, that is, there is no legal address pool, then exit, otherwise continue to execute;

[0084] S 3: Open a loop for ipRanges, poll all address segments in the address pool array, and for each address segment in the address pool:

[0085] S3.1 If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0086] S3.2 splits the starting address of the address segment into an integer array intIpf (starting array) according to ".", and splits the ending address of the address segment into an integer array intIpt (ending array). Taking M=4 as an example, the starting array and the ending array both contain 4 integers, such as [1.1.1.1-2.2.2.2]. After the starting address 1.1.1.1 is split, intIpf is the array [1,1,1,1], and after the ending address 2.2.2.2 is split, intIpt is the array [2,2,2,2].

[0087] S3.3 opens the loop body. The loop starts with the first element of intIpf and ends with the first element of intIpt. The loop is incremented one by one in the order of Arabic numerals until it ends. In a single loop, the value currently being processed is a (the first parameter among M parameters). For each loop:

[0088] (a) If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0089] (b) Open the loop body. If a is equal to the first element of intIpf, the start of the loop is the second element of intIpf, otherwise the start of the loop is 0; if a is equal to the first element of intIpt, the end of the loop is the second element of intIpt, otherwise the end of the loop is 255; the loop is incremented in the order of the Arabic numerals until the end. The current value being processed is b (the second parameter of the M parameters). For each loop:

[0090] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0091] Open the loop body. If b is equal to the second element of intIpf, the start of the loop is the third element of intIpf, otherwise the start of the loop is 0; if it is equal to the second element of intIpt, the end of the loop is the third element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is c (the third parameter of M parameters). For each loop:

[0092] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0093] Open the loop body. If c is equal to the third element of intIpf, the start of the loop is the fourth element of intIpf, otherwise the start of the loop is 0; if c is equal to the third element of intIpt, the end of the loop is the fourth element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is d (the fourth parameter of M parameters). For each loop:

[0094] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0095] Generate a string, the string is assembled as a+".".+b+".".+c+".".+d, which is a legal IPv4 address;

[0096] Add this string to ips.

[0097] For the above type 2:

[0098] Controlling the M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address, further comprising:

[0099] When the search condition is S characters, and the S characters do not contain a dot, and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array, wherein S is an integer greater than or equal to 1;

[0100] Determine a first string array, wherein the first string array includes an element consisting of S characters;

[0101] Determine M matching positions; determine whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, control the M parameters to perform the self-increment operation, and obtain M parameter values;

[0102] The M parameter values ​​are assembled into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0103] Wherein, determining whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, controlling the M parameters to perform the self-increment operation, and obtaining M parameter values, includes:

[0104] When the current matching position is the k-th matching position and the current value of the k-th parameter includes the one element, determining whether the current value of the k-th parameter is equal to the k-th element in the starting array, where k is an integer greater than or equal to 1 and less than M;

[0105] If they are equal, the k+1th parameter is controlled to start the self-increment operation from the k+1th element in the starting array; if they are not equal, the k+1th parameter is controlled to start the self-increment operation from 0.

[0106] Assembling the M parameter values ​​into the legal address includes: when the current matching position is the Mth matching position and the value of the Mth parameter includes the one element, assembling the M parameter values ​​into the legal address.

[0107] like Fig. 9 The flowchart of the getIpsOf1 algorithm for processing type 2 is shown, taking M=4 as an example, including the following steps:

[0108] First, you need to define the incoming parameters: the first string array assembled by splitting the matching string according to ".": the array params containing 1 element, the array ips of the IPs to be generated that meet the conditions, the address pool array ipRanges, the number of IPs to be generated num, the matching position matchLocation (when params has only 1 element, the matching position matchLocation has four cases: 0, 1, 2, and 3, which are the first matching position, the second matching position, the third matching position, and the fourth matching position, respectively). The algorithm flow is as follows:

[0109] S1, if the number of IPs in ips reaches num (the preset number threshold), exit, otherwise continue to execute;

[0110] S2, if ipRanges is empty, that is, there is no legal address pool, then exit, otherwise continue to execute;

[0111] S3, opens a loop for ipRanges, polls all address segments in the address pool array, and for each address segment in the address pool:

[0112] S3.1, if the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0113] S3.2, split the starting address of the address segment according to the period “.” into an integer array intIpf (starting array), and split the ending address of the address segment according to the period “.” into an integer array intIpt (ending array). Both are arrays containing 4 integers, for example, [1.1.1.1-2.2.2.2]. After the starting address 1.1.1.1 is split, intIpf becomes the array [1,1,1,1], and after the ending address 2.2.2.2 is split, intIpt becomes the array [2,2,2,2].

[0114] Open the loop body. The loop starts at the first element of intIpf and ends at the first element of intIpt. The loop is incremented one by one in the order of Arabic numerals until it ends. In a single loop, the value currently being processed is a. For each loop:

[0115] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0116] If the matching position matchLocation is 0 (the first matching position), the first element in params (the first element at the end of the first string array) is not an empty string, and any position in a does not contain the first element in params, then terminate this loop;

[0117] Open the loop body. If a (the value of the first parameter) is equal to the first element of intIpf, the start of the loop is the second element of intIpf, otherwise the start of the loop is 0; if a is equal to the first element of intIpt, the end of the loop is the second element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is b (the value of the second parameter). For each loop:

[0118] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0119] If the matching position matchLocation is 1 (the second matching position), the first element in params is not an empty string, and any position in b does not contain the first element in params, then terminate this loop;

[0120] Open the loop body. If b (the value of the second parameter) is equal to the second element of intIpf, the start of the loop is the third element of intIpf, otherwise the start of the loop is 0; if b is equal to the second element of intIpt, the end of the loop is the third element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is c. For each loop:

[0121] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0122] If the matching position matchLocation is 2 (the third matching position), the first element in params is not an empty string, and any position in c does not contain the first element in params, then terminate this loop;

[0123] Open the loop body. If c (the value of the third parameter) is equal to the third element of intIpf, the start of the loop is the fourth element of intIpf, otherwise the start of the loop is 0; if c is equal to the third element of intIpt, the end of the loop is the fourth element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is d. For each loop:

[0124] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0125] If the matching position matchLocation is 3 (the fourth matching position), the first element in params is not an empty string, and any position in d does not contain the first element in params, then terminate this loop;

[0126] Generate a string, the string is assembled as a+".+b+".+c+".+d, which is a legal IPv4 address; add the string to ips.

[0127] For the above type 3:

[0128] In the case of M=4, when the search condition is T characters, the T characters contain a dot, and the number of legal addresses currently retrieved is less than the preset number threshold, the first parameter is controlled to perform the self-increment operation starting from the first element in the starting array, wherein T is an integer greater than 1; the T characters are divided to obtain a second string array, wherein the second string array includes two elements, the element corresponding to the dot at the first or last position of the T characters is empty, and the other elements are strings; M-1 matching positions are determined; according to the M-1 matching positions, whether the values ​​of the M parameters start or end with an element in the second string array is determined; the j+1th parameter is controlled to perform the self-increment operation to obtain M parameter values; the M parameter values ​​are assembled into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0129] Wherein, determining whether the values ​​of the M parameters start or end with an element in the second string array according to the M-1 matching positions controls the j+1th parameter to perform the self-increment operation, and obtains M parameter values, including:

[0130] When the current matching position is the first matching position, the first element in the second string array is not empty, and the current value of the first parameter does not end with the first element in the second string array, the current value of the first parameter is controlled to perform an increment operation; otherwise, it is determined whether the current value of the first parameter is equal to the first element in the starting array; if they are equal, the second parameter is controlled to perform the self-increment operation starting from the second element in the starting array; if they are not equal, the second parameter is controlled to perform the self-increment operation starting from 0.

[0131] After controlling the second parameter to perform the self-increment operation, the method further includes:

[0132] When the current matching position is the first matching position, the second element in the second string array is not empty, and the current value of the second parameter does not start with the second element in the second string array, or when the current matching position is the second matching position, the first element in the second string array is not empty, and the current value of the second parameter does not end with the first element in the second string array, the current value of the second parameter is controlled to perform an increment operation; otherwise, it is determined whether the current value of the second parameter is equal to the second element in the starting array; if they are equal, the third parameter is controlled to perform the self-increment operation starting from the third element in the starting array; if they are not equal, the third parameter is controlled to perform the self-increment operation starting from 0.

[0133] After controlling the third parameter to perform the self-increment operation, the method further includes: when the current matching position is the second matching position, the second element in the second string array is not empty, and the value of the third parameter does not start with the second element in the second string array, or when the current matching position is the third matching position, the first element in the second string array is not empty, and the value of the third parameter does not end with the first element in the second string array, controlling the current value of the second parameter to perform the addition operation; otherwise, determining whether the current value of the third parameter is equal to the third element in the starting array; if they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, controlling the fourth parameter to perform the self-increment operation from 0.

[0134] After controlling the fourth parameter to perform the self-increment operation, the method further includes:

[0135] When the current matching position is the third matching position, the second element in the second string array is not a null character, and the value of the fourth parameter does not start with the second element in the second string array, the value of the fourth parameter is controlled to perform an addition operation; otherwise, the M parameter values ​​are assembled into the legal address.

[0136] like Fig.10 The flowchart of the getIpsOf2 algorithm for processing type three is shown, which includes the following steps:

[0137] First, you need to define the incoming parameters: the second string array assembled by splitting the matching string according to "." contains a 2-element array params, an array of IPs that meet the conditions to be generated ips, an address pool array ipRanges, the number of IPs to be generated num, and a matching position matchLocation (when params has only 2 elements, the matching position matchLocation has three cases: 0, 1, and 2). The algorithm flow is as follows:

[0138] If the number of IPs in ips reaches num, exit, otherwise continue to execute;

[0139] If ipRanges is empty, that is, there is no legal address pool, then exit, otherwise continue to execute;

[0140] Open a loop for ipRanges and poll all address segments in the address pool array. For each address segment in the address pool:

[0141] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0142] The starting address of the address segment is split according to "." and assembled into an integer array intIpf (starting array). The ending address of the address segment is split according to "." and assembled into an integer array intIpt (ending array). Both are arrays containing 4 integers. For example, [1.1.1.1-2.2.2.2], the starting address 1.1.1.1 is split into intIpf array [1,1,1,1], and the ending address 2.2.2.2 is split into intIpt array [2,2,2,2];

[0143] Open the loop body. The loop starts at the first element of intIpf and ends at the first element of intIpt. The loop is incremented one by one in the order of Arabic numerals until it ends. In a single loop, the value currently being processed is a. For each loop:

[0144] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0145] If the match location matchLocation is 0 (the first match location), the first element in params (the second string array) is not an empty string, and a (the value of the first parameter) does not end with the first element in params, then terminate this loop;

[0146] Open the loop body. If a is equal to the first element of intIpf, the start of the loop is the second element of intIpf, otherwise the start of the loop is 0; if a is equal to the first element of intIpt, the end of the loop is the second element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is b. For each loop:

[0147] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0148] If the matching position matchLocation is 0 (the first matching position), the second element in params (the second string array) is not an empty string, and b does not start with the second element in params, or if the matching position matchLocation is 1, the first element in params is not an empty string, and b does not end with the first element in params, then terminate this loop;

[0149] Open the loop body. If b (the value of the second parameter) is equal to the second element of intIpf, the start of the loop is the third element of intIpf, otherwise the start of the loop is 0; if b is equal to the second element of intIpt, the end of the loop is the third element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is c. For each loop:

[0150] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0151] If the matching position matchLocation is 1 (the second matching position), the second element in params is not an empty string, and c does not start with the second element in params, or if the matching position matchLocation is 2 (the third matching position), the first element in params is not an empty string, and c does not end with the first element in params, then terminate this loop;

[0152] Open the loop body. If c is equal to the third element of intIpf, the start of the loop is the fourth element of intIpf, otherwise the start of the loop is 0; if c is equal to the third element of intIpt, the end of the loop is the fourth element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is d. For each loop:

[0153] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0154] If the matching position matchLocation is 2 (the third matching position), the second element in params is not an empty string, and d does not start with the second element in params, then terminate this loop;

[0155] Generate a string, the string is assembled as a+".+b+".+c+".+d, which is a legal IPv4 address; add the string to ips.

[0156] For the above type 4:

[0157] In the case of M=4, controlling M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address, further comprising: when the search condition is R characters, the R characters contain two dots, and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array, wherein R is an integer greater than 2; dividing the R characters to obtain a third string array, wherein the third string array includes three elements, the element corresponding to the dot at the first or last position of the T characters is empty, and the other elements are strings; determining M-2 matching positions; determining whether the values ​​of the M parameters start or end with an element in the third string array according to the M-2 matching positions; controlling the j+1th parameter to perform the self-increment operation to obtain M parameter values; assembling the M parameter values ​​into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0158] Wherein, determining whether the values ​​of the M parameters start or end with an element in the third string array according to the M-2 matching positions controls the j+1th parameter to perform the self-increment operation, and obtains M parameter values, including:

[0159] When the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array, the value of the first parameter is controlled to perform an increment operation; otherwise, it is determined whether the current value of the first parameter is equal to the first element in the starting array; if they are equal, the second parameter is controlled to perform the self-increment operation starting from the second element in the starting array; if they are not equal, the second parameter is controlled to perform the self-increment operation starting from 0.

[0160] After controlling the second parameter to perform the self-increment operation, the method further includes: when the current value of the first parameter is equal to the first element in the starting array, setting the first minimum value to the second element in the terminating array and determining the first maximum value to be the second element in the terminating array, otherwise setting the first minimum value to 0 and determining the first maximum value to 255; when the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array, controlling the value of the first parameter to perform an increment operation; otherwise, setting the current value of the second parameter to the second element in the third string array; when the current value of the second parameter is greater than or equal to the first minimum value and less than or equal to the first maximum value, determining whether the current value of the second parameter is equal to the second element in the terminating array; if they are equal, controlling the third parameter to perform the self-increment operation starting from the third element in the starting array; if they are not equal, controlling the third parameter to perform the self-increment operation starting from 0.

[0161] After controlling the third parameter to perform the self-increment operation, the method further includes: when the third element in the third string array is not empty and the current value of the third parameter does not start with the third element in the third string array, controlling the value of the third parameter to perform an increment operation; otherwise, determining whether the current value of the third parameter is equal to the third element in the termination array; if they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, controlling the fourth parameter to perform the self-increment operation starting from 0.

[0162] When the current matching position is not the first matching position, the second parameter is controlled to perform the self-increment operation starting from the first minimum value; when the first element in the third string array is not empty and the current value of the second parameter does not end with the first element in the third string array, the value of the second parameter is controlled to perform the addition operation; otherwise, if the current value of the second parameter is equal to the second element in the starting array, the second minimum value is set to the third element in the starting array, otherwise the second minimum value is set to 0; if the current value of the second parameter is equal to the second element in the terminating array, the second maximum value is set to the third element in the terminating array, otherwise the second maximum value is set to 255.

[0163] Set the current value of the third parameter to the second element in the third string array; when the current value of the third parameter is less than the second minimum value or greater than the second maximum value, control the value of the first parameter to perform an increment operation; otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; if they are equal, control the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, control the fourth parameter to perform the self-increment operation starting from 0.

[0164] After controlling the fourth parameter to perform the self-increment operation, the method further includes: when the third element in the third string array is not empty and the current value of the fourth parameter does not start with the third element in the third string array, controlling the value of the fourth parameter to perform an increment operation; otherwise, assembling the M parameter values ​​into the legal address.

[0165] like Fig.11 The getIpsOf3 algorithm flow chart for processing type 4 includes the following steps:

[0166] First, you need to define the incoming parameters: the third string array assembled by splitting the matching string according to "." contains the 3-element array params, the array ips of the IPs to be generated that meet the conditions, the address pool array ipRanges, the number of IPs to be generated num, and the matching position matchLocation (when params has only 3 elements, the matching position matchLocation has two cases: 0 and 1). The algorithm flow is as follows:

[0167] If the number of IPs in ips reaches num, exit, otherwise continue to execute;

[0168] If ipRanges is empty, that is, there is no legal address pool, then exit, otherwise continue to execute;

[0169] Open a loop for ipRanges and poll all address segments in the address pool array. For each address segment in the address pool:

[0170] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0171] The starting address of the address segment is split according to "." and assembled into an integer array intIpf. The ending address of the address segment is split according to "." and assembled into an integer array intIpt. Both are arrays containing 4 integers. For example, [1.1.1.1-2.2.2.2], the starting address 1.1.1.1 is split into intIpf, which is the array [1,1,1,1], and the ending address 2.2.2.2 is split into intIpt, which is the array [2,2,2,2];

[0172] Open the loop body. The loop starts at the first element of intIpf and ends at the first element of intIpt. The loop is incremented one by one in the order of Arabic numerals until it ends. In a single loop, the value currently being processed is a. For each loop:

[0173] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0174] If the match location matchLocation is 0 (the first match location), the first element in params (the third string array) is not an empty string, and a does not end with the first element in params, then terminate this loop;

[0175] Define the variable minB (first minimum value). If a (the value of the first parameter) is equal to the first element of intIpf, then minB is set to the second element of intIpf, otherwise minB is set to 0; define maxB (first maximum value). If a (the value of the first parameter) is equal to the first element of intIpt, then maxB is set to the second element of intIpt, otherwise minB is set to 255;

[0176] Distinguish the matching position matchLocation. If it is 0 (the first matching position), then:

[0177] If the first element in params is not an empty string and a does not end with the first element in params, terminate this loop;

[0178] Define variable b (second parameter) with the value of the second element in params. If b is less than minB or b is greater than maxB, exit the current loop.

[0179] Open the loop body. If b is equal to the second element of intIpf, the start of the loop is the third element of intIpf, otherwise the start of the loop is 0; if b is equal to the second element of intIpt, the end of the loop is the third element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is c (the third parameter). For each loop:

[0180] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0181] If the third element in params is not an empty string and c does not start with the third element in params, terminate this loop;

[0182] Open the loop body. If c is equal to the third element of intIpf, the start of the loop is the fourth element of intIpf, otherwise the start of the loop is 0; if c is equal to the third element of intIpt, the end of the loop is the fourth element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is d. For each loop:

[0183] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0184] Generate a string, the string is assembled as a+".".+b+".".+c+".".+d, which is a legal IPv4 address;

[0185] Add the string to ips;

[0186] Distinguish the matching location matchLocation, if it is 1, then:

[0187] Open the loop body. The start of the loop is minB, and the end of the loop is maxB. The loop is incremented in the order of the Arabic numerals until it ends. The current value being processed is b. For each loop:

[0188] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0189] If the first element in params is not an empty string and b (the second parameter) does not end with the first element in params, terminate this loop;

[0190] Define the variable minC (second minimum value). If b is equal to the second element of intIpf, minC is set to the third element of intIpf, otherwise minC is set to 0. Define maxC (second maximum value). If b is equal to the second element of intIpt, maxC is set to the third element of intIpt, otherwise minC is set to 255.

[0191] Define variable c, whose value is the second element in params (the third string array). If c is less than minC or c is greater than maxC, exit the current loop body;

[0192] Open the loop body. If c is equal to the third element of intIpf, the start of the loop is the fourth element of intIpf, otherwise the start of the loop is 0; if c is equal to the third element of intIpt, the end of the loop is the fourth element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is d. For each loop:

[0193] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0194] If the third element in params is not an empty string and d does not start with the third element in params, terminate this loop;

[0195] Generate a string, the string is assembled as a+".+b+".+c+".+d, which is a legal IPv4 address; add the string to ips.

[0196] For the above type five:

[0197] When the search condition is X characters, the X characters include three dots, and the number of legal addresses currently retrieved is less than a preset number threshold, the first parameter is controlled to perform the self-increment operation starting from the first element in the starting array, wherein X is an integer greater than 3; the X characters are divided to obtain a fourth character string array, wherein the fourth character string array includes four elements, the element corresponding to the dot located at the first or last position of the T characters is empty, and the other elements are character strings; when the first element in the fourth character string array is not empty, and the current value of the first parameter does not end with the first element in the fourth character string array, the value of the first parameter is controlled to perform an increment operation; otherwise, when the current value of the first parameter is equal to the first element in the starting array, the third minimum value is set to the second element in the starting array, otherwise the third minimum value is set to 0; if the current value of the first parameter is equal to the first element in the terminating array, the third maximum value is set to the second element in the terminating array, otherwise the third maximum value is set to 255.

[0198] Set the value of the second parameter to the second element in the fourth string array; when the current value of the second parameter is less than the third minimum value or greater than the third maximum value, determine whether the address pool has a next address segment; when the next address segment exists, poll the next address segment to determine the legal address in the next address segment; otherwise, if the current value of the second parameter is equal to the second element in the starting array, set the fourth minimum value to the third element in the starting array, otherwise set the fourth minimum value to 0; if the current value of the second parameter is equal to the second element in the ending array, set the fourth maximum value to the third element in the ending array, otherwise set the fourth maximum value to 255.

[0199] Set the value of the third parameter to the fourth element in the fourth string array; when the current value of the third parameter is less than the fourth minimum value and or greater than the fourth maximum value, determine whether the address pool has a next address segment; if the next address segment exists, poll the next address segment and determine the legal address in the next address segment; otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; if they are equal, control the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, control the fourth parameter to perform the self-increment operation starting from 0.

[0200] After controlling the fourth parameter to perform the self-increment operation starting from 0, the method further includes: when the fourth element in the fourth string array is not empty and the current value of the fourth parameter does not start with the fourth element in the fourth string array, controlling the value of the fourth parameter to perform an increment operation; otherwise, assembling the M parameter values ​​into the legal address.

[0201] like Fig.12 The getIpsOf4 algorithm flow chart of processing type 5 shown includes the following steps:

[0202] First, you need to define the incoming parameters: the fourth string array assembled by splitting the matching string according to "." contains a 4-element array params, an array of IPs that meet the conditions to be generated ips, an address pool array ipRanges, and the number of IPs to be generated num. The algorithm flow is as follows:

[0203] If the number of IPs in ips reaches num, exit, otherwise continue to execute;

[0204] If ipRanges is empty, that is, there is no legal address pool, then exit, otherwise continue to execute;

[0205] Open a loop for ipRanges and poll all address segments in the address pool array. For each address segment in the address pool:

[0206] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0207] The starting address of the address segment is split according to "." and assembled into an integer array intIpf. The ending address of the address segment is split according to "." and assembled into an integer array intIpt. Both are arrays containing 4 integers. For example, [1.1.1.1-2.2.2.2], the starting address 1.1.1.1 is split into intIpf, which is the array [1,1,1,1], and the ending address 2.2.2.2 is split into intIpt, which is the array [2,2,2,2];

[0208] Open the loop body. The loop starts at the first element of intIpf and ends at the first element of intIpt. The loop is incremented one by one in the order of Arabic numerals until it ends. In a single loop, the value currently being processed is a (the first parameter). For each loop:

[0209] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0210] If the first element in params (the fourth string array) is not an empty string and a does not end with the first element in params, terminate this loop;

[0211] Define the variable minB (third minimum value). If a is equal to the first element of intIpf, minB is set to the second element of intIpf, otherwise minB is set to 0. Define maxB (third maximum value). If a is equal to the first element of intIpt, maxB is set to the second element of intIpt, otherwise maxB is set to 255.

[0212] Define variable b (second parameter) with the value of the second element in params. If b is less than minB or b is greater than maxB, exit the current loop.

[0213] Define the variable minC (the fourth minimum value). If b is equal to the second element of intIpf, minC is set to the third element of intIpf, otherwise minC is set to 0. Define maxC (the fourth maximum value). If b is equal to the second element of intIpt, maxC is set to the third element of intIpt, otherwise maxC is set to 255.

[0214] Define variable c (third parameter), whose value is the third element in params. If c is less than minC or c is greater than maxC, exit the current loop body.

[0215] Open the loop body. If c is equal to the third element of intIpf, the start of the loop is the fourth element of intIpf, otherwise the start of the loop is 0; if c is equal to the third element of intIpt, the end of the loop is the fourth element of intIpt, otherwise the end of the loop is 255; the loop is incremented one by one in the order of Arabic numerals until the end. The current value being processed is d. For each loop:

[0216] If the number of IPs in ips reaches num, then jump out of this loop, otherwise continue to the next step;

[0217] If the fourth element in params is not an empty string and d does not start with the fourth element in params, terminate this loop; generate a string, the string is assembled as a+".".+b+".".+c+".".+d, which is a legal IPv4 address; add the string to ips.

[0218] like Fig.13As shown, using the above five algorithms, complete address generation can be performed for all scenarios. The algorithm is named getIps. First, the input parameters need to be defined: the IP array ips that meets the conditions to be generated, the address pool array ipRanges, the number of IPs to be generated num, and the matching string ip used for filtering. The algorithm flow is as follows:

[0219] If ip is empty or an empty string, call the getIpsof method and pass in the array of IPs to be generated that meet the conditions, the array of address pools, ipRanges, and the number of IPs to be generated, num;

[0220] If ip is not empty and is not an empty string, split it into strings according to "." and assemble it into a string array params:

[0221] If params contains 1 element, then:

[0222] Call the algorithm getIpsof1 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number of IPs to be generated num, and matching location matchLocation (set to 0).

[0223] Call the algorithm getIpsof1 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number of IPs to be generated num, and matching location matchLocation (set to 1).

[0224] Call the algorithm getIpsof1 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number num of IPs to be generated, and matching location matchLocation (set to 2).

[0225] Call the algorithm getIpsof1 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number of IPs to be generated num, and matching location matchLocation (set to 3).

[0226] If params contains 2 elements, then:

[0227] Call the algorithm getIpsof2 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number num of IPs to be generated, and matching location matchLocation (set to 0).

[0228] Call the algorithm getIpsof2 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number num of IPs to be generated, and matching location matchLocation (set to 1).

[0229] Call the algorithm getIpsof2 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number num of IPs to be generated, and matching location matchLocation (set to 2).

[0230] If params contains 3 elements, then:

[0231] Call the algorithm getIpsof3 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number num of IPs to be generated, and matching location matchLocation (set to 0).

[0232] Call the algorithm getIpsof3 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, number num of IPs to be generated, and matching location matchLocation (set to 1).

[0233] If params contains 4 elements, then:

[0234] Call the algorithm getIpsof4 and pass in the following parameters: string array params, array ips of IPs to be generated that meet the conditions, address pool array ipRanges, and number num of IPs to be generated.

[0235] The elements of the address pool array ipRanges are multiple address segments containing the starting and ending IPv4 addresses, which are used to limit the range of IPv4 addresses that can be allocated, such as [1.1.1.1-2.2.2.2, 3.3.3.3-4.4.4.4]. In a single address segment, the starting address must be smaller than the ending address. When allocating addresses, they can only be obtained from these address segments. Data not in them is not legal.

[0236] In the above algorithm, terminating this loop means that only the subsequent unexecuted methods of the current loop will not be continued, but the loops after this loop body will not be affected and will continue to execute; jumping out of the loop body means that the subsequent unexecuted methods of the current loop will not be continued, and the unexecuted loops after this loop body will not be executed, which means completely exiting this loop body. For multi-level nested loops, exiting this loop body will not affect the continuation of the upper loop. In addition, the above algorithm involves multiple nested loop bodies. Only when all lower loops are executed, the upper loop will execute the next business in this loop body. After all the businesses defined in the current loop are executed, the next polling of this loop will be performed.

[0237] In cloud computing platforms, this algorithm often only returns limited IP addresses for screening based on user input, such as returning the top 20 that meet the criteria. If the user enters again, the top 20 that meet the criteria will be returned again. This is a dynamically changing operating mechanism with very convenient operating features. In terms of performance, although the time complexity is O(n4), the business of the innermost loop that is executed the most is only character processing, and its single execution only takes about 0.001ms. Therefore, if only 20 data are generated, at most 20 effective loops will be executed, totaling 0.02ms. Even if the consumption of terminating this polling because the looped data does not meet the conditions for continuing execution is included, since there is no effective business that is actually executed and only polls once for data judgment, the cumulative maximum loss is only about 0.01ms. Therefore, the total time consumption in this case is about 0.03ms at most. If it is a traditional method, it is necessary to generate all IP addresses in a loop, and traverse the matches based on them to find the IP addresses that meet the matching conditions, and return the first 20. Limited by the different address pool ranges, the theoretical maximum time consumption is 255×255×255×255×0.001ms=4228250.625ms, which is about 70 minutes. Although the space complexity is also O(n4), if only 20 pieces of data are generated, 1 character occupies 2B, and 1 IP address occupies up to 30B (for example, 111.111.111.111, containing 15 characters), the maximum effective resource occupancy in memory is 20×30=600B; if the traditional method is used, all IP addresses must be loaded first and then matched on the basis. The shortest IP occupies 14B (for example, 1.1.1.1, containing 7 characters), then the theoretical value of the upper limit of memory occupancy is calculated as: (14+30)÷2×255×255×255×255=93021513750B, which is approximately 88712.22GB, 86.63TB, which is a very scary number. It can be seen that while ensuring the accuracy of data acquisition, our new algorithm has brought about a huge performance improvement. At the same time, the algorithm of this patent has a certain scene neutrality and has a very stable execution process under different data backgrounds. It will not have large differences in time consumption or resource usage due to different scenes or different search items.

[0238] In the cloud platform, the actual implementation is often not as simple as calling the algorithm getIps to obtain a given number of available addresses, because in the actual production environment there are often many IP addresses that are already in use, so the generated available addresses should not include these occupied addresses, so it is also necessary to obtain all virtual network cards under the current subnet and dig out all occupied IP addresses from them. If you need to obtain a certain number of available addresses, you should also add the number of all occupied addresses to this number to get a total. This total is the number of IP addresses that need to be generated by getIps. After the generation is completed, if there are occupied addresses mixed in, they need to be filtered out, and finally a given number of IP addresses are cut out from the remaining IP addresses and returned, so that the final IP addresses available for use are obtained.

[0239] This concept has been put into actual deployment in the cloud platform built in various architectural environments. After evaluation, this application can successfully achieve the original concept and is very easy for users to operate.

[0240] Directly use input items to accurately generate available addresses, ensure data accuracy, environmental security, and system stability, especially improve efficiency and reduce resource utilization, and provide users with available IP addresses. This solution has directly made various maintenance functions such as the creation of cloud hosts, cloud physical machines, virtual network cards and other resources very easy to use, accelerated response capabilities, and enhanced interactive effects, bringing another optimization point and progress to the cloud platform. It has significant progressive significance, and uses user input as the basis for targeted generation strategies, which truly achieves zero loss and no meaningless idle business. During the processing process, the occupancy rate of effective data is increased to 100%, which fundamentally solves the shortcomings of the old solution and has immediate results.

[0241] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0242] In the present embodiment, a device for retrieving an address is also provided, and the device is used to implement the above-mentioned embodiment and the preferred implementation mode, and the description thereof has been made no further. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and contemplated.

[0243] Fig.14 is a structural block diagram of a device for retrieving an address according to an embodiment of the present application, such as Fig.14 As shown, the device includes an acquisition module 1402, which is used to acquire a retrieval instruction, wherein the retrieval instruction is used to instruct to retrieve a legal address that meets the retrieval condition in the address pool, the retrieval instruction carries the retrieval condition, the address pool includes N address segments, N is an integer greater than or equal to 1, and the address segment includes a start address and an end address; a conversion module 1404, which is used to poll each address segment in the address pool, convert the start address in the address segment currently polled into a start array, and convert the end address into a end array; a control module 1406, which is used to control M parameters to perform a self-increment operation according to a loop condition corresponding to the retrieval condition, and determine the legal address in the address segment currently polled, wherein M is an integer greater than or equal to 1, and the legal address includes M parameter values, the first parameter performs the self-increment operation starting from the first element in the start array, and when the value of the first parameter is greater than the first element in the end array, the self-increment operation is terminated.

[0244] As an optional implementation, the above-mentioned device is also used to control the first parameter to perform the self-increment operation starting from the first element in the starting array when the retrieval condition is empty and the number of legal addresses currently retrieved is less than a preset number threshold; according to the value of the jth parameter among the M parameters, control the j+1th parameter to perform the self-increment operation to obtain M parameter values, where j is an integer greater than or equal to 1 and less than M; and assemble the M parameter values ​​into the legal address.

[0245] As an optional embodiment, the above-mentioned device is also used to determine whether the current value of the j-th parameter is equal to the j-th element in the starting array; if they are equal, the j+1-th parameter is controlled to perform the self-increment operation starting from the j+1-th element in the starting array; if they are not equal, the j+1-th parameter is controlled to perform the self-increment operation starting from 0.

[0246] As an optional implementation, the above-mentioned device is also used to control the first parameter to perform the self-increment operation starting from the first element in the starting array when the search condition is S characters and the S characters do not contain dots, and the number of legal addresses currently retrieved is less than a preset number threshold, wherein S is an integer greater than or equal to 1; determine a first string array, wherein the first string array includes an element consisting of S characters; determine M matching positions; determine whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, control the M parameters to perform the self-increment operation, and obtain M parameter values; assemble the M parameter values ​​into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0247] As an optional embodiment, the above-mentioned device is also used to determine whether the current value of the kth parameter is equal to the kth element in the starting array when the current matching position is the kth matching position and the current value of the kth parameter contains the one element, where k is an integer greater than or equal to 1 and less than M; if they are equal, controlling the k+1th parameter to perform the self-increment operation starting from the k+1th element in the starting array; if they are not equal, controlling the k+1th parameter to perform the self-increment operation starting from 0.

[0248] As an optional implementation, the above-mentioned device is also used to assemble the M parameter values ​​into the legal address when the current matching position is the Mth matching position and the value of the Mth parameter contains the one element.

[0249] As an optional implementation, the above-mentioned device is also used to control the first parameter to perform the self-increment operation starting from the first element in the starting array when the search condition is T characters, the T characters contain a dot, and the number of legal addresses currently retrieved is less than a preset number threshold, wherein T is an integer greater than 1; divide the T characters to obtain a second string array, wherein the second string array includes two elements, the element corresponding to the dot at the first or last position of the T characters is empty, and the other elements are strings; determine M-1 matching positions; determine whether the values ​​of the M parameters start or end with an element in the second string array according to the M-1 matching positions; control the j+1th parameter to perform the self-increment operation to obtain M parameter values; assemble the M parameter values ​​into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0250] As an optional embodiment, the above-mentioned device is also used to control the current value of the first parameter to perform an increment operation when the current matching position is the first matching position, the first element in the second string array is not empty, and the current value of the first parameter does not end with the first element in the second string array; otherwise, determine whether the current value of the first parameter is equal to the first element in the starting array; if they are equal, control the second parameter to perform the self-increment operation starting from the second element in the starting array; if they are not equal, control the second parameter to perform the self-increment operation starting from 0.

[0251] As an optional embodiment, the above-mentioned device is also used to control the current value of the second parameter to perform the increment operation after controlling the second parameter to perform the increment operation, when the current matching position is the first matching position, the second element in the second string array is not empty, and the current value of the second parameter does not start with the second element in the second string array, or when the current matching position is the second matching position, the first element in the second string array is not empty, and the current value of the second parameter does not end with the first element in the second string array; otherwise, determine whether the current value of the second parameter is equal to the second element in the starting array; if they are equal, control the third parameter to perform the increment operation starting from the third element in the starting array; if they are not equal, control the third parameter to perform the increment operation starting from 0.

[0252] As an optional embodiment, the above-mentioned device is also used to control the current value of the second parameter to perform the increment operation after controlling the third parameter to perform the increment operation, when the current matching position is the second matching position, the second element in the second string array is not empty, and the value of the third parameter does not start with the second element in the second string array, or when the current matching position is the third matching position, the first element in the second string array is not empty, and the value of the third parameter does not end with the first element in the second string array; otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; if they are equal, control the fourth parameter to perform the increment operation starting from the fourth element in the starting array; if they are not equal, control the fourth parameter to perform the increment operation from 0.

[0253] As an optional embodiment, the above-mentioned device is also used to control the fourth parameter to perform the self-increment operation. When the current matching position is the third matching position, the second element in the second string array is not a null character, and the value of the fourth parameter does not start with the second element in the second string array, control the value of the fourth parameter to perform an increment operation; otherwise, assemble the M parameter values ​​into the legal address.

[0254] As an optional implementation, the above-mentioned device is also used to control the first parameter to perform the self-increment operation from the first element in the starting array when the search condition is R characters, the R characters contain two dots, and the number of legal addresses currently retrieved is less than a preset number threshold, wherein R is an integer greater than 2; divide the R characters into a third string array, wherein the third string array includes three elements, the element corresponding to the dot at the first or last position of the T characters is empty, and the other elements are strings; determine M-2 matching positions; determine whether the values ​​of the M parameters start or end with an element in the third string array according to the M-2 matching positions; control the j+1th parameter to perform the self-increment operation to obtain M parameter values; assemble the M parameter values ​​into the legal address, wherein the first element in the legal address is the value of the first parameter.

[0255] As an optional embodiment, the above-mentioned device is also used to control the value of the first parameter to perform an increment operation when the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array; otherwise, determine whether the current value of the first parameter is equal to the first element in the starting array; if they are equal, control the second parameter to perform the self-increment operation starting from the second element in the starting array; if they are not equal, control the second parameter to perform the self-increment operation starting from 0.

[0256] As an optional implementation, the above-mentioned device is also used to, after controlling the second parameter to perform the self-increment operation, set the first minimum value to the second element in the termination array and determine the first maximum value as the second element in the termination array when the current value of the first parameter is equal to the first element in the starting array, otherwise set the first minimum value to 0 and determine the first maximum value to 255; when the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array, control the value of the first parameter to perform the addition operation; otherwise, set the current value of the second parameter to the second element in the third string array; when the current value of the second parameter is greater than or equal to the first minimum value and less than or equal to the first maximum value, determine whether the current value of the second parameter is equal to the second element in the termination array; if they are equal, control the third parameter to perform the self-increment operation starting from the third element in the starting array; if they are not equal, control the third parameter to perform the self-increment operation starting from 0.

[0257] As an optional embodiment, the above-mentioned device is also used to control the value of the third parameter to perform the increment operation after controlling the third parameter to perform the increment operation, if the third element in the third string array is not empty and the current value of the third parameter does not start with the third element in the third string array; otherwise, determine whether the current value of the third parameter is equal to the third element in the termination array; if they are equal, control the fourth parameter to perform the increment operation starting from the fourth element in the starting array; if they are not equal, control the fourth parameter to perform the increment operation starting from 0.

[0258] As an optional embodiment, the above-mentioned device is also used to control the second parameter to perform the self-increment operation starting from the first minimum value when the current matching position is not the first matching position; when the first element in the third string array is not empty and the current value of the second parameter does not end with the first element in the third string array, control the value of the second parameter to perform the addition operation; otherwise, if the current value of the second parameter is equal to the second element in the starting array, set the second minimum value to the third element in the starting array, otherwise set the second minimum value to 0; if the current value of the second parameter is equal to the second element in the ending array, set the second maximum value to the third element in the ending array, otherwise set the second maximum value to 255.

[0259] As an optional embodiment, the above-mentioned device is also used to set the current value of the third parameter to the second element in the third string array; when the current value of the third parameter is less than the second minimum value or greater than the second maximum value, control the value of the first parameter to perform an increment operation; otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; if they are equal, control the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; if they are not equal, control the fourth parameter to perform the self-increment operation starting from 0.

[0260] As an optional embodiment, the above-mentioned device is also used to control the fourth parameter to perform the self-increment operation. When the third element in the third string array is not empty and the current value of the fourth parameter does not start with the third element in the third string array, control the value of the fourth parameter to perform the addition operation; otherwise, assemble the M parameter values ​​into the legal address.

[0261] As an optional implementation, the above-mentioned device is also used to control the first parameter to perform the self-increment operation from the first element in the starting array when the search condition is X characters, the X characters include three dots, and the number of legal addresses currently retrieved is less than a preset number threshold, wherein X is an integer greater than 3; divide the X characters to obtain a fourth string array, wherein the fourth string array includes four elements, the element corresponding to the dot located at the first or last position of the T characters is empty, and the other elements are strings; when the first element in the fourth string array is not empty and the current value of the first parameter does not end with the first element in the fourth string array, control the value of the first parameter to perform an increment operation; otherwise, when the current value of the first parameter is equal to the first element in the starting array, set the third minimum value to the second element in the starting array, otherwise set the third minimum value to 0; if the current value of the first parameter is equal to the first element in the terminating array, set the third maximum value to the second element in the terminating array, otherwise set the third maximum value to 255.

[0262] As an optional implementation, the above-mentioned device is also used to set the value of the second parameter to the second element in the fourth string array; when the current value of the second parameter is less than the third minimum value or greater than the third maximum value, determine whether there is a next address segment in the address pool; if the next address segment exists, poll the next address segment and determine the legal address in the next address segment; otherwise, if the current value of the second parameter is equal to the second element in the starting array, set the fourth minimum value to the third element in the starting array, otherwise set the fourth minimum value to 0; if the current value of the second parameter is equal to the second element in the ending array, set the fourth maximum value to the third element in the ending array, otherwise set the fourth maximum value to 255.

[0263] As an optional implementation, the above-mentioned device is also used to set the value of the third parameter to the fourth element in the fourth string array; when the current value of the third parameter is less than the fourth minimum value and or greater than the fourth maximum value, determine whether there is a next address segment in the address pool; when the next address segment exists, poll the next address segment and determine the legal address in the next address segment; otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; when they are equal, control the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; when they are not equal, control the fourth parameter to perform the self-increment operation starting from 0.

[0264] As an optional embodiment, the above-mentioned device is also used to control the fourth parameter to perform the self-increment operation starting from 0, and when the fourth element in the fourth string array is not empty and the current value of the fourth parameter does not start with the fourth element in the fourth string array, control the value of the fourth parameter to perform an increment operation; otherwise, assemble the M parameter values ​​into the legal address.

[0265] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0266] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0267] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0268] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0269] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0270] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0271] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0272] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for retrieving an address, characterized in that: include: Obtain a search instruction, wherein the search instruction is used to instruct to search for a legal address that meets a search condition in an address pool, the search instruction carries the search condition, the address pool includes N address segments, N is an integer greater than or equal to 1, and the address segment includes a start address and an end address; Polling each address segment in the address pool, converting the start address in the address segment currently polled into a start array, and converting the end address into an end array; Controlling M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition, and determining the legal address in the address segment currently polled, wherein M is an integer greater than or equal to 1, and the legal address includes M parameter values, and the first parameter starts to perform the self-increment operation from the first element in the starting array, and ends the self-increment operation when the value of the first parameter is greater than the first element in the ending array; The step of controlling the M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address includes: When the search condition is S characters, and the S characters do not contain a dot, and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array, wherein S is an integer greater than or equal to 1; Determine a first string array, wherein the first string array includes an element consisting of S characters; Determine M matching positions; Determine whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, and control the M parameters to perform the self-increment operation to obtain M parameter values; The M parameter values ​​are assembled into the legal address, wherein the first element in the legal address is the value of the first parameter.

2. The method according to claim 1, characterized in that Controlling the M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address, further comprising: When the search condition is empty and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array; According to the value of the jth parameter among the M parameters, control the j+1th parameter to perform the self-increment operation to obtain M parameter values, where j is an integer greater than or equal to 1 and less than M; The M parameter values ​​are assembled into the legal address.

3. The method according to claim 2, characterized in that The step of controlling the j+1th parameter to perform the self-increment operation according to the value of the jth parameter among the M parameters includes: Determine whether the current value of the j-th parameter is equal to the j-th element in the starting array; If they are equal, controlling the j+1th parameter to perform the self-increment operation starting from the j+1th element in the starting array; In the case of inequality, the j+1th parameter is controlled to start from 0 to perform the self-increment operation.

4. The method according to claim 1, characterized in that: Determining whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, controlling the M parameters to perform the self-increment operation, and obtaining M parameter values, including: When the current matching position is the k-th matching position and the current value of the k-th parameter includes the one element, determining whether the current value of the k-th parameter is equal to the k-th element in the starting array, where k is an integer greater than or equal to 1 and less than M; If they are equal, controlling the k+1th parameter to perform the self-increment operation starting from the k+1th element in the starting array; In the case of inequality, the k+1th parameter is controlled to start from 0 to perform the self-increment operation.

5. The method according to claim 1, characterized in that Assembling the M parameter values ​​into the legal address includes: When the current matching position is the Mth matching position and the value of the Mth parameter includes the one element, the M parameter values ​​are assembled into the legal address.

6. The method according to claim 1, characterized in that In the case where M=4, controlling the M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address also includes: When the search condition is T characters, the T characters contain a dot, and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array, wherein T is an integer greater than 1; The T characters are divided to obtain a second string array, wherein the second string array includes two elements, the element corresponding to the first or last point of the T characters is empty, and the other elements are strings; Determine M-1 matching positions; Determine whether the values ​​of the M parameters start or end with an element in the second string array according to the M-1 matching positions, and control the j+1th parameter to perform the self-increment operation to obtain M parameter values; The M parameter values ​​are assembled into the legal address, wherein the first element in the legal address is the value of the first parameter.

7. The method according to claim 6, characterized in that Determining whether the values ​​of the M parameters start or end with an element in the second string array according to the M-1 matching positions, controlling the j+1th parameter to perform the self-increment operation, and obtaining M parameter values, including: When the current matching position is the first matching position, the first element in the second string array is not empty, and the current value of the first parameter does not end with the first element in the second string array, control the current value of the first parameter to perform an increment operation; Otherwise, determine whether the current value of the first parameter is equal to the first element in the starting array; If they are equal, controlling the second parameter to perform the self-increment operation starting from the second element in the starting array; In the case of inequality, the second parameter is controlled to start the self-increment operation from 0.

8. The method according to claim 7, characterized in that After controlling the second parameter to perform the self-increment operation, the method further includes: When the current matching position is the first matching position, the second element in the second string array is not empty, and the current value of the second parameter does not start with the second element in the second string array, or when the current matching position is the second matching position, the first element in the second string array is not empty, and the current value of the second parameter does not end with the first element in the second string array, control the current value of the second parameter to perform an increment operation; Otherwise, determine whether the current value of the second parameter is equal to the second element in the starting array; If they are equal, controlling the third parameter to perform the self-increment operation starting from the third element in the starting array; In the case of inequality, the third parameter is controlled to start the self-increment operation from 0.

9. The method according to claim 8, characterized in that After controlling the third parameter to perform the self-increment operation, the method further includes: When the current matching position is the second matching position, the second element in the second string array is not empty, and the value of the third parameter does not start with the second element in the second string array, or when the current matching position is the third matching position, the first element in the second string array is not empty, and the value of the third parameter does not end with the first element in the second string array, the current value of the second parameter is controlled to perform an increment operation; Otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; If they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; If they are not equal, the fourth parameter is controlled to perform the self-increment operation from 0.

10. The method according to claim 6, characterized in that After controlling the fourth parameter to perform the self-increment operation, the method further includes: When the current matching position is the third matching position, the second element in the second string array is not a blank character, and the value of the fourth parameter does not start with the second element in the second string array, control the value of the fourth parameter to perform an increment operation; Otherwise, the M parameter values ​​are assembled into the legal address.

11. The method according to claim 6, characterized in that In the case where M=4, controlling the M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address also includes: When the search condition is R characters, the R characters contain two dots, and the number of legal addresses currently retrieved is less than a preset number threshold, the first parameter is controlled to perform the self-increment operation starting from the first element in the starting array, wherein R is an integer greater than 2; The R characters are divided to obtain a third character string array, wherein the third character string array includes three elements, the element corresponding to the first or last point of the T characters is empty, and the other elements are character strings; Determine M-2 matching positions; Determine whether the values ​​of the M parameters start or end with an element in the third string array according to the M-2 matching positions, and control the j+1th parameter to perform the self-increment operation to obtain M parameter values; The M parameter values ​​are assembled into the legal address, wherein the first element in the legal address is the value of the first parameter.

12. The method according to claim 11, characterized in that Determining whether the values ​​of the M parameters start or end with an element in the third string array according to the M-2 matching positions, controlling the j+1th parameter to perform the self-increment operation, and obtaining M parameter values, including: When the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array, the value of the first parameter is controlled to perform an increment operation; Otherwise, determine whether the current value of the first parameter is equal to the first element in the starting array; If they are equal, controlling the second parameter to perform the self-increment operation starting from the second element in the starting array; In the case of inequality, the second parameter is controlled to start the self-increment operation from 0.

13. The method according to claim 12, characterized in that After controlling the second parameter to perform the self-increment operation, the method further includes: When the current value of the first parameter is equal to the first element in the starting array, the first minimum value is set to the second element in the ending array, and the first maximum value is determined to be the second element in the ending array; otherwise, the first minimum value is set to 0, and the first maximum value is determined to be 255; When the current matching position is the first matching position, the first element in the third string array is not empty, and the current value of the first parameter does not end with the first element in the third string array, controlling the value of the first parameter to perform an increment operation; Otherwise, the current value of the second parameter is set to the second element in the third string array; When the current value of the second parameter is greater than or equal to the first minimum value and less than or equal to the first maximum value, determining whether the current value of the second parameter is equal to the second element in the termination array; If they are equal, controlling the third parameter to perform the self-increment operation starting from the third element in the starting array; In the case of inequality, the third parameter is controlled to start the self-increment operation from 0.

14. The method according to claim 13, characterized in that After controlling the third parameter to perform the self-increment operation, the method further includes: When the third element in the third string array is not empty and the current value of the third parameter does not start with the third element in the third string array, controlling the value of the third parameter to perform an increment operation; Otherwise, determine whether the current value of the third parameter is equal to the third element in the termination array; If they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; In the case of inequality, the fourth parameter is controlled to start the self-increment operation from 0.

15. The method according to claim 12, characterized in that The method further comprises: When the current matching position is not the first matching position, controlling the second parameter to start the self-increment operation from the first minimum value; When the first element in the third string array is not empty and the current value of the second parameter does not end with the first element in the third string array, controlling the value of the second parameter to perform an increment operation; Otherwise, if the current value of the second parameter is equal to the second element in the starting array, the second minimum value is set to the third element in the starting array, otherwise the second minimum value is set to 0; If the current value of the second parameter is equal to the second element in the termination array, the second maximum value is set to the third element in the termination array; otherwise, the second maximum value is set to 255.

16. The method according to claim 15, characterized in that The method further comprises: Set the current value of the third parameter to the second element in the third string array; When the current value of the third parameter is less than the second minimum value or greater than the second maximum value, control the value of the first parameter to perform an addition operation; otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; If they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; In the case of inequality, the fourth parameter is controlled to start the self-increment operation from 0.

17. The method according to claim 16, characterized in that After controlling the fourth parameter to perform the self-increment operation, the method further includes: When the third element in the third string array is not empty and the current value of the fourth parameter does not start with the third element in the third string array, controlling the value of the fourth parameter to perform an increment operation; Otherwise, the M parameter values ​​are assembled into the legal address.

18. The method according to claim 6, characterized in that In the case where M=4, controlling the M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition to obtain the legal address also includes: When the search condition is X characters, the X characters include three dots, and the number of legal addresses currently retrieved is less than a preset number threshold, controlling the first parameter to perform the self-increment operation starting from the first element in the starting array, wherein X is an integer greater than 3; The X characters are divided to obtain a fourth character string array, wherein the fourth character string array includes four elements, the element corresponding to the first or last point of the T characters is empty, and the other elements are character strings; When the first element in the fourth string array is not empty and the current value of the first parameter does not end with the first element in the fourth string array, controlling the value of the first parameter to perform an increment operation; Otherwise, if the current value of the first parameter is equal to the first element in the starting array, the third minimum value is set to the second element in the starting array, otherwise the third minimum value is set to 0; If the current value of the first parameter is equal to the first element in the termination array, the third maximum value is set to the second element in the termination array; otherwise, the third maximum value is set to 255.

19. The method according to claim 18, characterized in that The method further comprises: Setting the value of the second parameter to the second element in the fourth string array; When the current value of the second parameter is less than the third minimum value or greater than the third maximum value, determine whether the address pool has a next address segment; when the next address segment exists, poll the next address segment and determine the legal address in the next address segment; Otherwise, if the current value of the second parameter is equal to the second element in the starting array, the fourth minimum value is set to the third element in the starting array; otherwise, the fourth minimum value is set to 0; If the current value of the second parameter is equal to the second element in the termination array, the fourth maximum value is set to the third element in the termination array; otherwise, the fourth maximum value is set to 255.

20. The method according to claim 19, characterized in that The method further comprises: Setting the value of the third parameter to the fourth element in the fourth string array; When the current value of the third parameter is less than the fourth minimum value and or greater than the fourth maximum value, determine whether the address pool has a next address segment; if the next address segment exists, poll the next address segment and determine the legal address in the next address segment; Otherwise, determine whether the current value of the third parameter is equal to the third element in the starting array; If they are equal, controlling the fourth parameter to perform the self-increment operation starting from the fourth element in the starting array; In the case of inequality, the fourth parameter is controlled to start the self-increment operation from 0.

21. The method according to claim 20, characterized in that After controlling the fourth parameter to perform the self-increment operation from 0, the method further includes: When the fourth element in the fourth string array is not empty and the current value of the fourth parameter does not start with the fourth element in the fourth string array, controlling the value of the fourth parameter to perform an increment operation; Otherwise, the M parameter values ​​are assembled into the legal address.

22. A device for retrieving an address, characterized in that: include: An acquisition module, used for acquiring a search instruction, wherein the search instruction is used for instructing to search for a legal address that meets a search condition in an address pool, the search instruction carries the search condition, the address pool includes N address segments, N is an integer greater than or equal to 1, and the address segment includes a start address and an end address; A conversion module, used for polling each address segment in the address pool, converting the start address in the address segment currently polled into a start array, and converting the end address into an end array; A control module, used for controlling M parameters to perform a self-increment operation according to a loop condition corresponding to the search condition, and determining the legal address in the address segment currently polled, wherein M is an integer greater than or equal to 1, and the legal address includes M parameter values, and the first parameter starts to perform the self-increment operation from the first element in the starting array, and ends the self-increment operation when the value of the first parameter is greater than the first element in the ending array; The device is also used to control the first parameter to perform the self-increment operation starting from the first element in the starting array when the search condition is S characters and the S characters do not contain a dot, and the number of legal addresses currently retrieved is less than a preset number threshold, wherein S is an integer greater than or equal to 1; determine a first string array, wherein the first string array includes an element consisting of S characters; determine M matching positions; determine whether the values ​​of the M parameters include the one element in the first string array according to the M matching positions, control the M parameters to perform the self-increment operation, and obtain M parameter values; assemble the M parameter values ​​into the legal address, wherein the first element in the legal address is the value of the first parameter.

23. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 21 when executed by a processor.

24. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 21 are implemented.

25. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 21 are implemented.