CN114095472B - Address management method, terminal, electronic device and computer readable storage medium - Google Patents

Address management method, terminal, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN114095472B
CN114095472B CN202111388713.6A CN202111388713A CN114095472B CN 114095472 B CN114095472 B CN 114095472B CN 202111388713 A CN202111388713 A CN 202111388713A CN 114095472 B CN114095472 B CN 114095472B
Authority
CN
China
Prior art keywords
address
byte
type
queried
matching data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111388713.6A
Other languages
Chinese (zh)
Other versions
CN114095472A (en
Inventor
陈涛
回保亮
林聪�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Knownsec Information Technology Co Ltd
Original Assignee
Beijing Knownsec Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Knownsec Information Technology Co Ltd filed Critical Beijing Knownsec Information Technology Co Ltd
Priority to CN202111388713.6A priority Critical patent/CN114095472B/en
Publication of CN114095472A publication Critical patent/CN114095472A/en
Application granted granted Critical
Publication of CN114095472B publication Critical patent/CN114095472B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames

Abstract

The embodiment of the application provides an address management method, a terminal, electronic equipment and a computer readable storage medium, which belong to the technical field of network communication, wherein the method is applied to the management terminal, and the management terminal is in communication connection with a plurality of user terminals, and comprises the following steps: the method comprises the steps of receiving a storage instruction sent by any user side, extracting an IP address in the storage instruction, converting the IP address into an integer IP, processing the integer IP into a byte IP, and storing the byte IP in a database, wherein the type of the IP address is not required to be judged, and the address can be stored without judging, splitting and other processes by using prefix matching and suffix matching modes, so that the storage step is greatly simplified, and the processing efficiency of address storage can be improved.

Description

Address management method, terminal, electronic device and computer readable storage medium
Technical Field
The present application relates to the field of network communication technologies, and in particular, to an address management method, a terminal, an electronic device, and a computer readable storage medium.
Background
With the rapid development of networks, the IP address allocated by the internet protocol version 4 (Internet Protocol version, ipv 4) technology which has been widely used is gradually exhausted due to the increase of the number of global hosts, so that the IP address is short-circuited. Currently, the problem of IP address shortage of IPv4 technology is solved by using the internet protocol version6 (Internet Protocol version, IPv 6) technology to be able to provide more IP addresses.
IPv6 is a next-generation IP protocol designed by the Internet Engineering Task Force (IETF) to replace current IPv4, solving the problem of IPv4 address exhaustion. Since the application of IPv6 is a sequential and asymptotic process, both IPv4 networks and IPv6 networks exist for a long time, and in many cases, storage and retrieval of data need to support both IPv4 and IPv6.
The storage modes of the IPv4 and IPv6 addresses directly influence the fusion and query efficiency of the IPv4 addresses and the IPv6 addresses, and particularly the query efficiency of the business needing to store massive IP addresses. However, in the existing IP address storage method, prefix matching and suffix matching are generally used for IPv4 and IPv6, so that complex processing flows such as judgment and splitting are required, which results in lower processing efficiency.
Disclosure of Invention
In view of the above, an object of the present application is to provide an address management method, a terminal, an electronic device, and a computer readable storage medium, which can solve the problem that the existing IP address storage method generally uses prefix matching and suffix matching, and thus requires complex processing flows such as judgment and splitting, resulting in lower processing efficiency.
In order to achieve the above object, the following technical solutions are adopted in the embodiments of the present application.
In a first aspect, the present application provides an address management method, which adopts the following technical scheme.
An address management method is applied to a management terminal, the management terminal is in communication connection with a plurality of user terminals, and the method comprises the following steps:
receiving a storage instruction sent by any user side, and extracting an IP address in the storage instruction;
converting the IP address into integer IP, processing the integer IP into byte IP and storing the byte IP in a database.
In a possible embodiment, the method further comprises a step of address querying, the step comprising:
receiving a query instruction sent by any user side, extracting an address to be queried in the query instruction, and obtaining an address form of the address to be queried; the address form comprises an IP address, an IP segment address and an IP mask address;
converting the address to be queried by adopting a conversion rule corresponding to the address form to obtain byte-type matching data;
and matching the matching data with the byte type IP in the database to obtain and return a query result.
In a possible implementation manner, when the address form is an IP address, the step of converting the address to be queried by using a conversion rule corresponding to the address form to obtain byte-type matching data includes:
converting the address to be queried into integer IP, and processing the integer IP into byte IP to be used as matching data;
the step of matching the matching data with the byte type IP in the database to obtain and return a query result comprises the following steps:
comparing the matching data with each byte type IP in the database, if the byte type IP is consistent with the matching data, returning the byte type IP as a query result, otherwise, failing the query result.
In a possible implementation manner, when the address form is an IP address, the step of converting the address to be queried by using a conversion rule corresponding to the address form to obtain byte-type matching data includes:
converting the address to be queried into integer IP, and processing the integer IP into byte IP to be used as matching data;
the step of matching the matching data with the byte type IP in the database to obtain and return a query result comprises the following steps:
comparing the matching data with each byte type IP in the database, if the byte type IP is consistent with the matching data, returning the byte type IP as a query result, otherwise, failing the query result.
In a possible implementation manner, when the address form is a mask address, the step of converting the address to be queried by using a conversion rule corresponding to the address form to obtain byte-type matching data includes:
after converting the address to be queried into an IP type, splitting the address to be queried to obtain a starting address and an end address;
after integer conversion and byte conversion are carried out on the initial address and the terminal address, the obtained byte initial address and byte terminal address are used as matching data;
the step of matching the matching data with the byte type IP in the database to obtain and return a query result comprises the following steps:
inquiring whether the byte type IP is located between the byte type starting address and the byte type end address in the database, if so, returning the byte type IP as an inquiry result, otherwise, failing the inquiry result.
In a possible implementation, the step of converting the IP address into an integer IP includes:
and after the IP address of the character string type is processed into the IP type, converting the IP address into integer IP.
In one possible implementation, the IP address includes an IPv4 address and an IPv6 address.
In a second aspect, the present application provides a management terminal, which adopts the following technical scheme.
A management terminal, comprising a receiving module and a storage module;
the receiving module is used for receiving a storage instruction sent by any user side and extracting an IP address in the storage instruction;
the storage module is used for converting the IP address into integer IP, processing the integer IP into byte IP and storing the byte IP in a database.
In a possible implementation manner, the management terminal further comprises a query module;
the inquiry module is used for receiving an inquiry instruction sent by any user side, extracting an address to be inquired in the inquiry instruction, and obtaining an address form of the address to be inquired, wherein the address form comprises an IP address, an IP segment address and an IP mask address; and the method is also used for converting the address to be queried by adopting a conversion rule corresponding to the address form to obtain byte type matching data, and matching the matching data with the byte type IP in the database to obtain and return a query result.
In a third aspect, the present application provides an electronic device, which adopts the following technical scheme.
An electronic device comprising a processor and a memory storing machine executable instructions executable by the processor to implement the address management method of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium, which adopts the following technical scheme.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the address management method according to the first aspect.
According to the address management method provided by the embodiment of the application, the IP address is converted into the integer IP without judging the type of the IP address by extracting the IP address in the storage instruction sent by the user side, and finally the IP address is stored in a byte form after being converted into the byte type IP, and the processes of judging, splitting and the like of the address are stored without adopting prefix matching and suffix matching, so that the storage step is greatly simplified, and the processing efficiency of address storage can be improved.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 shows a block schematic diagram of an electronic device according to an embodiment of the present application.
Fig. 2 is a block diagram of an address management system according to an embodiment of the present application.
Fig. 3 is a schematic flow chart of an address management method according to an embodiment of the present application.
Fig. 4 is a schematic diagram of a second flow of an address management method according to an embodiment of the present application.
Fig. 5 shows a partial flow diagram of S203 and S205 in fig. 4.
Fig. 6 shows another partial flow diagram of S203 and S205 in fig. 4.
Fig. 7 shows a further partial flow diagram of S203 and S205 in fig. 4.
Fig. 8 shows a block schematic diagram of a management terminal according to an embodiment of the present application.
Icon: 100-an electronic device; 110-memory; a 120-processor; 130-a communication module; 140-an address management system; 150-user side; 160-a management terminal; 170-a receiving module; 180-a memory module; 190-a query module.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to fall within the scope of the present application.
It is noted that relational terms such as "first" and "second", and the like, are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
With the rapid development of networks, the IP address allocated by the internet protocol version 4 (Internet Protocol version, ipv 4) technology which has been widely used is gradually exhausted due to the increase of the number of global hosts, so that the IP address is short-circuited. Currently, the problem of IP address shortage of IPv4 technology is solved by using internet protocol version6 (Internet Protocol version, IPv 6) technology to be able to provide more IP addresses.
IPv6 is a next-generation IP protocol designed by the Internet Engineering Task Force (IETF) to replace current IPv4, solving the problem of IPv4 address exhaustion. Since the application of IPv6 is a sequential and asymptotic process, both IPv4 networks and IPv6 networks exist for a long time, and in many cases, storage and retrieval of data need to support both IPv4 and IPv6.
The storage modes of the IPv4 and IPv6 addresses directly influence the fusion and query efficiency of the IPv4 addresses and the IPv6 addresses, and particularly the query efficiency of the business needing to store massive IP addresses. The IPv4 address is identified by 32 bits, and the IPv6 address is identified by 128 bits, and because of the difference in length, in the prior art, the IPv4 address and the IPv6 address are stored in respective storage modes. For example, the IPv4 address is stored as an integer, and for the IPv6 address, there are two storage modes: firstly, storing an IPv6 address as a character string; secondly, after the IPv6 address is processed by a summarization algorithm, an integer is calculated to identify the IPv6 address, and the calculated integer is stored.
For convenience of unified processing, IPV4 and IPV6 are stored as int (integer) types, but IPV6 needs 128 bits, so that it is stored in two int64, high order is stored in prefix field, low order is stored in suffix field, corresponding IPV4 prefix field is emptied, and suffix field is stored. When inquiring, the IPv4 and the IPv6 are needed to be judged firstly, and if the IPv4 is the IPv4, the inquiry is directly carried out in the suffix field. If it is IPv6, the upper 64 bits and the lower 64 bits need to be divided for matching respectively. Thus, the processing efficiency for address storage and query is low.
Based on the above considerations, the present application provides an address management method, a terminal, an electronic device, and a computer-readable storage medium.
Referring to fig. 1, a block diagram of an electronic device 100 is shown. The electronic device 100 includes a memory 110, a processor 120, and a communication module 130. The memory 110, the processor 120, and the communication module 130 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
Wherein the memory 110 is used for storing programs or data. The Memory 110 may be, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
The processor 120 is configured to read/write data, computer programs or machine executable instructions stored in the memory 110 and perform corresponding functions. Also, execution of computer programs or machine-executable instructions in memory 110 by processor 120 implements the address management methods provided by the present application.
The communication module 130 is used for establishing a communication connection between the electronic device 100 and other communication terminals through a network, and for transceiving data through the network.
It should be understood that the structure shown in fig. 1 is merely a schematic diagram of the structure of the electronic device 100, and that the electronic device 100 may include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
The electronic device 100 may be, but is not limited to, a computer, a server cluster, a notebook, etc. The user terminal 150 may be a mobile phone, an iPad, a personal computer, a notebook computer, a mobile internet device, etc.
Referring to fig. 2, fig. 2 is a block diagram of an address management system 140, and the address management method provided by the present application can be applied to the address management system 140. The address management system 140 includes a management terminal 160 and a user terminal 150, the user terminal 150 is plural, the management terminal 160 and the user terminal 150 can be connected through network communication, and the management terminal 160 further includes a database. The management terminal 160 may be a server, a server cluster, or the electronic device 100 described above.
In an embodiment, please refer to fig. 3, which is a flow chart of an address management method according to the present application. This embodiment is mainly exemplified by the application of the method to the management terminal 160 in fig. 2. In this embodiment, the method may include the following steps.
S101, receiving a storage instruction sent by any user terminal, and extracting an IP address in the storage instruction.
Specifically, each ue 150 sends the IP address to be stored to the management terminal 160 in a storage instruction manner, and the management terminal 160 receives the storage instruction of the ue 150 and extracts the IP address in the storage instruction.
S103, converting the IP address into integer IP, processing the integer IP into byte IP and storing the byte IP in a database.
Specifically, the management terminal 160 converts the IP address into an integer IP, processes the integer IP into a byte IP, and stores the byte IP in the database. Wherein integer IP refers to IP of int type, and byte type IP refers to IP of bytes type.
In the address management method, the IP address is converted into the integer IP by extracting the IP address in the storage instruction sent by the user terminal 150, and finally converted into the byte IP, and then the IP address is stored in the form of bytes, so that the type of the IP address is not required to be judged, and processes such as judging and splitting the address are not required to be stored in a prefix matching and suffix matching mode, thereby greatly simplifying the storage step and improving the processing efficiency of address storage. And, help to improve address inquiry performance and inquiry efficiency.
It should be understood that the IP address in the above address management method may be an IPv4 address or an IPv6 address.
Since communication between electronic devices 100 is generally performed in the form of a character string, for example, the IP address in the stored instruction is in the form of: "192.168.0.1".
Therefore, further, with respect to "convert IP address to integer IP" in step S103, processing can be performed by: after the IP address of the character string type is processed into the IP type, the IP address is converted into integer IP.
Specifically, an address processing module (IPy) may be called for the management terminal 160 to process the IP address of the character string type into the IP type. For example, the IP address "192.168.0.1" of the character string type is processed as the IP type, and then: 192.168.0.1.
based on the storage steps of S101-S103 of the address management method provided above, the address management method provided by the present application further includes an address storage step, referring to fig. 4, based on the storage method, the address storage step includes the following procedures.
S201, receiving a query instruction sent by any user terminal, extracting an address to be queried in the query instruction, and obtaining an address form of the address to be queried.
Wherein the address form includes an IP address, an IP segment address, and an IP mask address.
Specifically, the user sends a query instruction to the management terminal 160 through the user terminal 150 to query the query instruction. After receiving the query instruction sent by any user terminal 150, the management terminal 160 extracts the address to be queried in the query instruction, and determines the address form of the address to be queried according to the integrity and the form of the address to be queried.
S203, converting the address to be queried by adopting a conversion rule corresponding to the address form to obtain byte type matching data.
Specifically, the management terminal 160 converts the address to be queried according to the address form of the address to be queried by adopting a conversion rule corresponding to the address form, so as to obtain byte-type matching data.
S205, matching the matching data with byte type IP in the database to obtain and return a query result.
Specifically, the management terminal 160 matches the matching data with the byte type IP in the database to obtain a query result, and returns the query result to the user terminal 150.
In the above steps S201 to S205, after converting the address to be queried in the instruction to be queried into byte type matching data based on the conversion rule corresponding to the address form to which the address belongs, matching the matching data with the stored byte type IP based on the database stored in the steps S101 to S103 to quickly obtain a matching result, without judging the type of the address to be queried or performing prefix matching and suffix matching, so that the query flow is greatly reduced, and the address query efficiency can be improved.
When the address forms of the addresses to be queried are different, the adopted conversion rules are different.
Specifically, when the address is in the form of an IP address, i.e. a complete IP address, please refer to fig. 5, fig. 5 includes a flow chart of partial sub-steps of step S203.
S203-1, converting the address to be queried into integer IP, and processing the integer IP into byte IP to be used as matching data.
At this time, with continued reference to fig. 5, step S205 may include the following steps.
S205-1, the matching data is compared with each byte type IP in the database.
S205-2, if the byte type IP is consistent with the matching data, returning the byte type IP as a query result, otherwise, failing the query result.
Namely, when the address to be queried in the query instruction is a complete IP address, the accurate query is performed through S203-1, S205-1 to S205-2, and the byte type IP in the database is returned as the query result under the condition that the byte type IP in the database is consistent with the matching data. In other embodiments, the IP address of the IP type corresponding to the byte-type IP may be returned as the query result. This query approach may also be referred to as an exact query.
For example, the byte-type IP stored in the database is: ip_bin=b '10000'. When a certain address to be queried is converted into byte type matching data, the matching data is b '10000', then byte type IP of b '10000' exists in the database, so that the query is successful. If the address to be queried is converted into byte type matching data, the matching data is b '20000'. Then there is no byte-type IP in the database of b '20000' and thus the query fails.
When the address is in the form of a segment address, i.e. a non-complete IP address, please refer to fig. 6, fig. 6 includes a flowchart of another sub-step of step S203.
S203-2, splitting the address to be queried into a starting address and an end address.
S203-3, after IP type conversion, integer conversion and byte type conversion are carried out on the starting address and the end address, the obtained byte type starting address and byte type end address are used as matching data.
The IP type conversion refers to converting an address to be queried into an IP type address, the integer conversion refers to converting the IP type address to be queried into an integer type address, and the byte type conversion refers to converting the integer type address to be queried into a byte type address.
With continued reference to fig. 6, another partial flow diagram including the sub-steps of step S205 includes the following steps.
S205-3, inquiring whether the byte type IP is located between the byte type starting address and the byte type end address in the database.
S205-4, if yes, returning the byte type IP as a query result, otherwise, losing the query result.
When the address to be queried is a segment address, splitting the address to be queried into a start address and an end address, converting the start address and the end address into byte types, using the byte types as matching data, and then returning byte type IP (Internet protocol) between the byte type start address and the byte type end address in the database as a query result.
For example, the byte-type IP stored in the database remains: ip_bin=b '10000'. After the start address and the end address obtained by splitting the segment address to be queried are converted, the start address is b '5000', and the end address is b '20000', namely, ip_start=b '5000', ip_end=b '20000'. The query result ip_bin=b '10000' can be obtained by matching with ip_start < = ip_bin < = ip_end (b '5000' <= ip_bin < = b '20000').
If the start address and the end address obtained by splitting the segment address to be queried are converted, the start address is b '5000', and the end address is b '6000', namely ip_start=b '5000', ip_end=b '6000'. With ip_start < = ip_bin < = ip_end (b '5000' <= ip_bin < = b '6000'), then there is no byte IP in the database at this time, so the query fails.
When the address form of the address to be queried is the mask address, it is the mask address, please refer to fig. 7, fig. 7 includes a flowchart of a further sub-step of step S203.
S203-4, after the address to be queried is converted into the IP type, splitting the address to be queried to obtain a starting address and a destination address.
S203-5, after integer conversion and byte conversion are carried out on the starting address and the terminal address, the obtained byte starting address and byte ending address are used as matching data.
With continued reference to fig. 7, fig. 7 includes a schematic flow chart of a further sub-step of step S205, including the following steps.
S205-5, inquiring whether the byte type IP is located between the byte type starting address and the byte type end address in the database.
S205-6, if yes, returning the byte type IP as a query result, otherwise, failing the query result.
When the address to be queried is a mask address, converting the address to be queried into an IP type, obtaining a start address and an end address, processing the start address and the end address into byte types, obtaining matching data, and returning byte type IP between the byte type start address and the byte type end address in the database as a query result.
For example, the byte-type IP stored in the database remains: ip_bin=b '10000'. When the mask address to be queried is 192.168.0.0/24, the starting address and the end address obtained by splitting are as follows: ip_start=192.168.0.0, ip_end= 192.168.0.255. After conversion, the start address is b 'c' representing data), and the end address is b'd' (representing a numerical value), i.e., ip_start=b 'c', ip_end=b'd'. And (3) carrying out matching by using the IP_start < = IP_bin < = IP_end (b 'c' <= IP_bin < = b'd'), if b '10000' is positioned between b 'c' and b'd', the query result is b '10000', otherwise, the query result is failure.
The query when the address to be queried is a mask address may also be referred to as CIDR query.
It should be understood that in all the above steps, before the IP address is converted to the integer IP, if the IP address is not of the IP type, it is necessary to convert the IP address of the character string type to the IP type by using IPy or the like.
In the address management method provided by the application, different types of IP addresses (including IPv4 and IPv 6) can be converted into byte type IP and then uniformly stored, front section storage and back section storage are not needed to be divided, and search query can be quickly subjected to range matching in a byte size comparison mode, so that the storage flow and query flow are greatly simplified, and the management efficiency of address storage and address query is improved.
It should be understood that, although the steps in the flowcharts of fig. 3 to 7 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps of fig. 3-7 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or stages are performed necessarily occur in sequence, but may be performed alternately or alternately with at least a portion of other steps or sub-steps or stages of other steps.
In order to perform the corresponding steps in the above embodiments and the various possible ways, an implementation of the management terminal 160 is given below, and alternatively, the management terminal 160 may employ the device structure of the electronic device 100 shown in fig. 1 and described above. Further, referring to fig. 8, fig. 8 is a functional block diagram of a management terminal 160 according to an embodiment of the present application. It should be noted that, the basic principle and the technical effects of the management terminal 160 provided in this embodiment are the same as those of the foregoing embodiment, and for brevity, reference may be made to the corresponding content in the foregoing embodiment. The management terminal 160 includes: a receiving module 170 and a storage module 180.
The receiving module 170 is configured to receive the storage instruction sent by any user terminal 150, and extract the IP address in the storage instruction.
The storage module 180 is configured to convert the IP address into an integer IP, process the integer IP into a byte IP, and store the byte IP in the database.
Further, the management terminal 160 further includes a query module 190.
The query module 190 is configured to receive a query instruction sent by any user terminal 150, extract an address to be queried in the query instruction, and obtain an address form of the address to be queried.
Wherein the address form includes an IP address, an IP segment address, and an IP mask address.
The query module 190 is further configured to convert the address to be queried by using a conversion rule corresponding to the address form, obtain byte-type matching data, match the matching data with byte-type IP in the database, and obtain and return a query result.
Alternatively, the above modules may be stored in the memory 110 shown in fig. 1 or solidified in an Operating System (OS) of the electronic device 100 in the form of software or Firmware (Firmware), and may be executed by the processor 120 in fig. 1. Meanwhile, data, codes of programs, and the like, which are required to execute the above-described modules, may be stored in the memory 110.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above description is only of the preferred embodiments of the present application and is not intended to limit the present application, and various modifications and variations may be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (8)

1. An address management method, applied to a management terminal, where the management terminal is communicatively connected to a plurality of clients, the method comprising:
receiving a storage instruction sent by any user side, and extracting an IP address in the storage instruction;
converting the IP address into an integer IP, processing the integer IP into a byte IP, and storing the byte IP in a database;
the method further comprises the step of address querying, the step comprising:
receiving a query instruction sent by any user side, extracting an address to be queried in the query instruction, and obtaining an address form of the address to be queried; the address form comprises an IP address, an IP segment address and an IP mask address;
converting the address to be queried by adopting a conversion rule corresponding to the address form to obtain byte-type matching data;
matching the matching data with the byte type IP in the database to obtain and return a query result;
when the address form is a segment address, the step of converting the address to be queried by adopting a conversion rule corresponding to the address form to obtain byte-type matching data comprises the following steps:
splitting the address to be queried into a starting address and an end address, performing IP type conversion, integer conversion and byte type conversion on the starting address and the end address, and taking the obtained byte type starting address and byte type end address as matching data;
the step of matching the matching data with the byte type IP in the database to obtain and return a query result comprises the steps of;
inquiring whether the byte type IP is located between the byte type starting address and the byte type end address in the database, if so, returning the byte type IP as an inquiry result, otherwise, failing the inquiry result.
2. The method for address management according to claim 1, wherein when the address form is an IP address, the step of converting the address to be queried using a conversion rule corresponding to the address form to obtain byte-type matching data includes:
converting the address to be queried into integer IP, and processing the integer IP into byte IP to be used as matching data;
the step of matching the matching data with the byte type IP in the database to obtain and return a query result comprises the following steps:
comparing the matching data with each byte type IP in the database, if the byte type IP is consistent with the matching data, returning the byte type IP as a query result, otherwise, failing the query result.
3. The method for address management according to claim 1, wherein when the address form is a mask address, the step of converting the address to be queried using a conversion rule corresponding to the address form to obtain byte-type matching data includes:
after converting the address to be queried into an IP type, splitting the address to be queried to obtain a starting address and an end address;
after integer conversion and byte conversion are carried out on the initial address and the terminal address, the obtained byte initial address and byte terminal address are used as matching data;
the step of matching the matching data with the byte type IP in the database to obtain and return a query result comprises the following steps:
inquiring whether the byte type IP is located between the byte type starting address and the byte type end address in the database, if so, returning the byte type IP as an inquiry result, otherwise, failing the inquiry result.
4. A method of address management according to any one of claims 1 to 3, wherein the step of converting the IP address to integer IP comprises:
and after the IP address of the character string type is processed into the IP type, converting the IP address into integer IP.
5. A method of address management according to any one of claims 1 to 3, wherein the IP address comprises an IPv4 address and an IPv6 address.
6. The management terminal is characterized by being in communication connection with the user terminal, and comprises a receiving module, a storage module and a query module;
the receiving module is used for receiving a storage instruction sent by any user side and extracting an IP address in the storage instruction;
the storage module is used for converting the IP address into integer IP, processing the integer IP into byte IP and storing the byte IP in a database;
the query module is configured to:
receiving a query instruction sent by any user side, extracting an address to be queried in the query instruction, and obtaining an address form of the address to be queried; the address form comprises an IP address, an IP segment address and an IP mask address;
converting the address to be queried by adopting a conversion rule corresponding to the address form to obtain byte-type matching data;
matching the matching data with the byte type IP in the database to obtain and return a query result;
the query module is further configured to:
splitting the address to be queried into a starting address and an end address, performing IP type conversion, integer conversion and byte type conversion on the starting address and the end address, and taking the obtained byte type starting address and byte type end address as matching data;
the step of matching the matching data with the byte type IP in the database to obtain and return a query result comprises the steps of;
inquiring whether the byte type IP is located between the byte type starting address and the byte type end address in the database, if so, returning the byte type IP as an inquiry result, otherwise, failing the inquiry result.
7. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor to implement the address management method of any of claims 1-5.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the address management method according to any of claims 1-5.
CN202111388713.6A 2021-11-22 2021-11-22 Address management method, terminal, electronic device and computer readable storage medium Active CN114095472B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111388713.6A CN114095472B (en) 2021-11-22 2021-11-22 Address management method, terminal, electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111388713.6A CN114095472B (en) 2021-11-22 2021-11-22 Address management method, terminal, electronic device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN114095472A CN114095472A (en) 2022-02-25
CN114095472B true CN114095472B (en) 2023-11-28

Family

ID=80302856

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111388713.6A Active CN114095472B (en) 2021-11-22 2021-11-22 Address management method, terminal, electronic device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114095472B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102024047A (en) * 2010-12-14 2011-04-20 青岛普加智能信息有限公司 Data searching method and device thereof
CN102223289A (en) * 2010-04-15 2011-10-19 杭州华三通信技术有限公司 Method and device for storing IPv4 (the Fourth Internet Protocol Version) address and IPv6 (the Sixth Internet Protocol Version) address
CN107682466A (en) * 2017-09-26 2018-02-09 小草数语(北京)科技有限公司 The regional information searching method and its device of IP address
CN111416880A (en) * 2019-01-08 2020-07-14 阿里巴巴集团控股有限公司 IP address addressing method and device, computer storage medium and electronic equipment
CN111859033A (en) * 2020-07-22 2020-10-30 北京金山云网络技术有限公司 IP library query method and device and IP library compression method and device
CN112347377A (en) * 2020-10-13 2021-02-09 咪咕视讯科技有限公司 IP address field searching method, service scheduling method, device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102223289A (en) * 2010-04-15 2011-10-19 杭州华三通信技术有限公司 Method and device for storing IPv4 (the Fourth Internet Protocol Version) address and IPv6 (the Sixth Internet Protocol Version) address
CN102024047A (en) * 2010-12-14 2011-04-20 青岛普加智能信息有限公司 Data searching method and device thereof
CN107682466A (en) * 2017-09-26 2018-02-09 小草数语(北京)科技有限公司 The regional information searching method and its device of IP address
CN111416880A (en) * 2019-01-08 2020-07-14 阿里巴巴集团控股有限公司 IP address addressing method and device, computer storage medium and electronic equipment
CN111859033A (en) * 2020-07-22 2020-10-30 北京金山云网络技术有限公司 IP library query method and device and IP library compression method and device
CN112347377A (en) * 2020-10-13 2021-02-09 咪咕视讯科技有限公司 IP address field searching method, service scheduling method, device and electronic equipment

Also Published As

Publication number Publication date
CN114095472A (en) 2022-02-25

Similar Documents

Publication Publication Date Title
EP4033729A1 (en) Message forwarding and domain name address query
EP2388956B1 (en) Ascertaining per-hop network characteristics
CN110166570B (en) Service session management method and device, and electronic device
CN108696492B (en) Method and device for processing IP message
CN106210155B (en) Method and device for connecting application server
CN107613039B (en) IP address attribution inquiry method, device, system and storage medium
CN113014692A (en) Network address translation method, device, equipment and storage medium
CN111416880A (en) IP address addressing method and device, computer storage medium and electronic equipment
CN111049947B (en) Message forwarding method and device, electronic equipment and storage medium
CN109698814B (en) Botnet discovery method and botnet discovery device
CN111107181A (en) NAT rule matching method and device, electronic equipment and storage medium
CN103825824A (en) Message processing method and message processing device
US20220217072A1 (en) Compression of route tables using key values
CN114500633A (en) Data forwarding method, related device, program product and data transmission system
CN114095472B (en) Address management method, terminal, electronic device and computer readable storage medium
CN117176796A (en) Message pushing method, device, computer equipment and storage medium
CN112822305B (en) Method, device, router and storage medium for processing DNS query request
CN107040616B (en) Conversion method and message receiving and transmitting method for TCP/DN/IP network compatible with TCP/IP network
CN111683036B (en) Data storage method and device and message identification method and device
CN111314505B (en) Network address conversion method and device
CN114157633A (en) Message forwarding method and device
CN106993036B (en) Running environment information processing method and switch
US11604877B1 (en) Nested courses of action to support incident response in an information technology environment
CN111787010A (en) Message processing method, device, equipment and readable storage medium
CN112286966A (en) Data stream processing method, data stream recovery method, data stream processing device, data stream recovery device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant