CN108573018B - IP library generation method and device, electronic equipment and computer readable storage medium - Google Patents

IP library generation method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN108573018B
CN108573018B CN201810030614.2A CN201810030614A CN108573018B CN 108573018 B CN108573018 B CN 108573018B CN 201810030614 A CN201810030614 A CN 201810030614A CN 108573018 B CN108573018 B CN 108573018B
Authority
CN
China
Prior art keywords
line
information
library
keyword
identifier
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
CN201810030614.2A
Other languages
Chinese (zh)
Other versions
CN108573018A (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 Jinxun Ruibo Network Technology Co Ltd
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Jinxun Ruibo Network Technology Co Ltd
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud 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 Jinxun Ruibo Network Technology Co Ltd, Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Jinxun Ruibo Network Technology Co Ltd
Priority to CN201810030614.2A priority Critical patent/CN108573018B/en
Publication of CN108573018A publication Critical patent/CN108573018A/en
Application granted granted Critical
Publication of CN108573018B publication Critical patent/CN108573018B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/668Internet protocol [IP] address subnets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/69Types of network addresses using geographic information, e.g. room number

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention provides an IP library generation method, an IP library generation device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: determining a first line to which an IP section corresponding to each piece of first information belongs, and generating an IP library by using each first line and the IP section belonging to each first line, wherein the first line to which the IP section corresponding to each piece of first information belongs is determined in the following way: judging whether a keyword matched with the first information exists in the keyword table or not as a target keyword; if so, obtaining a line identifier corresponding to the first information as a first line identifier by using the obtained identifier and weight of the geographic position corresponding to each target keyword and the identifier and weight of the operator; and searching the line table to obtain a line corresponding to the first line identification, and determining that the obtained line is the first line to which the IP section corresponding to the first information belongs. By applying the technical scheme provided by the embodiment of the invention, the efficiency of generating the IP library is improved.

Description

IP library generation method and device, electronic equipment and computer readable storage medium
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to a method and an apparatus for generating an IP library, an electronic device, and a computer-readable storage medium.
Background
With the development of internet services, the demand for optimizing internet services by obtaining the geographic location of a user is increasing, for example, a CDN (Content Delivery Network) optimizes a scheduling service by obtaining the geographic location of the user, so as to quickly and accurately respond to a user request, thereby improving user experience.
In order to obtain the geographic location of the user, an IP (Internet Protocol, Protocol for interconnecting networks) library is developed. The IP library, also called IP address database, is a database used to store IP segments and their corresponding operators and/or geographical locations. The IP segment includes a plurality of IP addresses ranging from a starting IP address to an ending IP address, for example, 192.168.0.1-192.168.0.254 are IP segments with a starting IP address of 192.168.0.1 and an ending IP address of 192.168.0.254, the operator refers to a provider providing network services, for example, telecommunications, communications, mobility, and the like, each operator corresponds to one or more IP segments, and the operator can divide the IP segments corresponding to different geographic locations by regions from the corresponding one or more IP segments, so as to provide users in different regions with access to the network through the IP segments.
Because the dimensions of the lines required by the services are different under different service requirements, the lines can be one or a combination of operators and geographic positions, that is, some lines required by the services are the operators, some are the geographic positions, and some are the combination of the operators and the geographic positions. In order to generate an IP library that meets multiple service requirements at the same time, it is usually necessary to write a line as a keyword into an IP library configuration file in advance, where one IP library configuration file is used to store a keyword corresponding to a line of one dimension, for example, if the line corresponding to the IP library configuration file a is an operator, the keyword in the IP library configuration file a is a name of the operator, such as telecommunications, communications, mobility, and the like.
At present, the generation method of the IP library is: reading each IP library configuration file stored in the local computer; and for each IP library configuration file, traversing the primary source IP library to obtain an IP section corresponding to a line matched with each keyword in the IP library configuration file, determining that the IP section corresponding to the line matched with the keyword belongs to the keyword for each keyword, and forming the IP library by using each keyword and the IP section of each keyword after determining the IP section of each keyword in each IP library configuration file, thereby completing the generation of the IP library.
Therefore, in the existing IP library generation method, in order to simultaneously satisfy multiple service requirements, multiple IP library configuration files need to be preset for an IP library to be generated, and a source IP library needs to be traversed once for each IP library configuration file, so that the source IP library needs to be traversed for multiple times to obtain an IP segment of each keyword in each IP library configuration file, which results in low efficiency of generating the IP library.
Disclosure of Invention
The embodiment of the invention aims to provide an IP library generation method, an IP library generation device, electronic equipment and a computer readable storage medium, so as to improve the efficiency of generating an IP library.
In a first aspect, an embodiment of the present invention provides an IP library generation method, which is applied to an electronic device, and the method includes:
determining a first line to which an IP section corresponding to each piece of first information in the corresponding relation recorded by the source IP library belongs, and generating the IP library by using each determined first line and the IP section belonging to each determined first line, wherein the first information comprises a geographical position and/or an operator, and the corresponding relation is as follows: the corresponding relation between the first information and the IP section;
determining a first line to which an IP section corresponding to each piece of first information in a source IP library belongs by the following method:
judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword; the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, and identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords;
if yes, acquiring the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
searching in a preset line table to obtain a line corresponding to the first line identification, and determining that the obtained line is a first line to which the IP section corresponding to the first information belongs; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
Optionally, before the step of searching in the preset route table to obtain the first route corresponding to the first route identifier when the keyword matched with the first information does not exist in the preset keyword table, the method further includes:
and setting the line identifier corresponding to the first information as a preset line identifier.
Optionally, obtaining the line identifier corresponding to the first information by using the obtained identifier and weight of each geographic location and the obtained identifier and weight of each operator, includes:
calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers;
and searching in a preset mapping table to obtain a line identifier corresponding to the first information identifier as the line identifier corresponding to the first information, wherein the mapping table is used for storing a mapping relation between the information identifier and the line identifier.
Optionally, after determining that no keyword matched with the first information exists in the preset keyword table, the method further includes:
generating a new keyword report, wherein the new keyword report is used for prompting a user whether a keyword matched with the first information is added;
and after receiving an indication of confirming that the keyword matched with the first information is newly added, acquiring the keyword matched with the first information, and updating the keyword matched with the first information to a keyword table.
Optionally, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, and before the step of determining that the obtained line is a first line to which the IP segment corresponding to the first information belongs, the method further includes:
judging whether second information matched with the first information exists in all the second information or not as target second information; if yes, judging whether the IP section corresponding to the first information conflicts with the IP section corresponding to the target second information; and if the conflict exists, resetting the IP section corresponding to the first information as the IP section corresponding to the target second information.
Optionally, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, and before the step of generating an IP library by using each determined first line and the IP segment belonging to each determined first line, the method further includes:
determining a second line to which the IP section corresponding to each piece of second information belongs;
judging whether a second line identical to the first line exists in all the determined second lines as a target second line aiming at each determined first line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, the IP segment belonging to the first line is reset to the IP segment belonging to the target second line.
Optionally, before the step of generating the IP library by using each determined first line and the IP segment belonging to each determined first line, the method further includes:
obtaining an IP segment range formed of IP segments belonging to the determined respective first lines;
verifying whether the range of the IP section is equal to the range of a preset IP section or not;
if so, a step of generating an IP library using the determined respective first lines and the IP sections belonging to the determined respective first lines is performed.
Optionally, before the step of generating the IP library by using each determined first line and the IP segment belonging to each determined first line, the method further includes:
and converting the representation form of the IP section belonging to the determined first line into a preset IP section representation form.
Optionally, after the step of generating an IP library by using each determined first line and an IP segment belonging to each determined first line, the method further includes:
generating the version number of the IP library;
backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a copy IP library; and marks the duplicate IP library with a version number.
In a second aspect, an embodiment of the present invention provides an IP library generating apparatus, which is applied to an electronic device, and the apparatus includes:
the determining module is used for determining a first line to which the IP section corresponding to each piece of first information belongs in the corresponding relation recorded by the source IP library;
a generation module for generating an IP library by using the determined first lines and the IP sections belonging to the determined first lines;
the first information comprises a geographical position and/or an operator, and the corresponding relation is the corresponding relation between the first information and the IP section;
the determining module determines a first line to which an IP section corresponding to each piece of first information belongs in a source IP library in the following mode:
judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword; the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords;
if yes, acquiring the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
searching in a preset line table to obtain a line corresponding to the first line identification, and determining that the obtained line is a first line to which the IP section corresponding to the first information belongs; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
Optionally, the determining module is further configured to:
and under the condition that the keyword matched with the first information does not exist in the preset keyword table, searching in the preset route table, and setting the route identification corresponding to the first information as the preset route identification before obtaining the first route corresponding to the first route identification.
Optionally, the determining module obtains the line identifier corresponding to the first information by using the obtained identifier and weight of each geographic location and the obtained identifier and weight of each operator, specifically:
calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers;
and searching in a preset mapping table to obtain a line identifier corresponding to the first information identifier as the line identifier corresponding to the first information, wherein the mapping table is used for storing a mapping relation between the information identifier and the line identifier.
Optionally, the determining module is further configured to:
generating a new keyword report after judging that the keyword matched with the first information does not exist in the preset keyword table, wherein the new keyword report is used for prompting a user whether to newly add the keyword matched with the first information;
and after receiving an indication of confirming that the keyword matched with the first information is newly added, acquiring the keyword matched with the first information, and updating the keyword matched with the first information to a keyword table.
Optionally, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, and the determining module is further configured to:
before the obtained line is determined to be the first line to which the IP section corresponding to the first information belongs, judging whether second information matched with the first information exists in all the second information to serve as target second information; if yes, judging whether the IP section corresponding to the first information conflicts with the IP section corresponding to the target second information; and if the conflict exists, resetting the IP section corresponding to the first information as the IP section corresponding to the target second information.
Optionally, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, and the determining module is further configured to:
determining a second line to which the IP section corresponding to each piece of second information belongs before generating an IP library by using each determined first line and the IP sections belonging to each determined first line;
judging whether a second line identical to the first line exists in all the determined second lines as a target second line aiming at each determined first line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, the IP segment belonging to the first line is reset to the IP segment belonging to the target second line.
Optionally, the generating module is further configured to:
obtaining an IP segment range formed by the IP segments belonging to the determined respective first lines before generating an IP library using the determined respective first lines and the IP segments belonging to the determined respective first lines;
verifying whether the range of the IP section is equal to the range of a preset IP section or not;
and if so, generating an IP library by using each determined first line and the IP sections belonging to each determined first line.
Optionally, the generating module is further configured to:
before generating an IP library using the determined respective first lines and the IP segments belonging to the determined respective first lines, converting a representation form of the IP segments belonging to the determined respective first lines into a preset IP segment representation form.
Optionally, the generating module is further configured to:
generating a version number of the IP library after generating the IP library using the determined respective first lines and the IP sections belonging to the determined respective first lines;
backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a copy IP library; and marks the duplicate IP library with a version number.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes: a processor and a memory, wherein,
a memory for storing a computer program;
and a processor for implementing any of the steps of the IP library generation method described above when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the IP library generation methods described above.
In a fifth aspect, an embodiment of the present invention provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any one of the IP library generation methods described above.
In a sixth aspect, an embodiment of the present invention provides a computer program, which when run on a computer, causes the computer to execute any one of the IP library generation methods described above.
By applying the method provided by the embodiment of the invention, the first line to which the IP section corresponding to each piece of first information belongs in the corresponding relation recorded by the source IP library is determined, and the IP library is generated by using each determined first line and the IP section belonging to each determined first line, wherein the first line to which the IP section corresponding to each piece of first information belongs is determined in the following way: judging whether a keyword matched with the first information exists in the keyword table or not as a target keyword; if so, obtaining a line identifier corresponding to the first information as a first line identifier by using the obtained identifier and weight of the geographic position corresponding to each target keyword and the identifier and weight of the operator; and searching the line table to obtain a line corresponding to the first line identification, and determining that the obtained line is the first line to which the IP section corresponding to the first information belongs.
Therefore, in the process of generating the IP library, the source IP library does not need to be traversed for many times, and the efficiency of generating the IP library is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for generating an IP library according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a relationship of a data table according to an embodiment of the present invention;
FIG. 3 is a relational diagram of another data table according to an embodiment of the invention;
FIG. 4 is a schematic diagram of a data table according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating a method for updating the general _ ipbin table in FIG. 2 according to an embodiment of the present invention;
fig. 6 is another schematic flow chart of a method for generating an IP library according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an IP library generating apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to improve the efficiency of generating an IP library, embodiments of the present invention provide a method and an apparatus for generating an IP library, an electronic device, and a computer-readable storage medium.
First, a method for generating an IP library according to an embodiment of the present invention is described below.
It should be noted that the execution subject of the IP library generation method provided in the embodiment of the present invention may be an IP library generation apparatus, specifically, the IP library generation apparatus may be located in an electronic device, and the electronic device may be a server, a mobile terminal, and the like, which is not limited herein.
Referring to fig. 1, an IP library generation method provided in an embodiment of the present invention is applied to an electronic device, and includes the following steps:
s101, determining a first line to which an IP section corresponding to each first information in the corresponding relation recorded by the source IP library belongs;
and S102, generating an IP library by using the determined first lines and the IP sections belonging to the determined first lines.
The first information comprises a geographical position and/or an operator, and the corresponding relation recorded by the source IP library is the corresponding relation between the first information and the IP section;
determining a first line to which an IP segment corresponding to each first information in the source IP library belongs by the following method, which may include steps a1-a4, as follows:
step A1, judging whether a keyword matched with the first information exists in a preset keyword list, and using the keyword as a target keyword; if so, perform step A2;
step A2, obtaining the identification and weight of the geographic position corresponding to each target keyword and the identification and weight of the operator from the keyword list; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
step A3, searching in a preset route table to obtain a route corresponding to a first route identifier;
step A4, determining that the obtained line is a first line to which the IP section corresponding to the first information belongs;
the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
The source IP library records the corresponding relation between the first information and the IP section, and after the source IP library is obtained, the first information and the IP section corresponding to the first information can be obtained from the source IP library. The source IP repository may be an IP repository provided by a third party. The embodiment of the present invention does not limit the manner in which the electronic device obtains the source IP library, for example, the manner may be: and sending an acquisition request to the third party every preset time period or every time a preset time point is reached, so as to obtain a source IP library fed back by the third party aiming at the acquisition request. In this way, the source IP library in the electronic equipment can be updated regularly to improve the real-time performance and accuracy of the obtained source IP library.
Exemplarily, assuming that the preset time period is 1 hour, sending an acquisition request to a third party every 1 hour, and acquiring a source IP library fed back by the third party for the acquisition request; and assuming that the preset time points are 9:00, 14:00 and 18:00, sending an acquisition request to the third party every 9:00, 14:00 and 18:00 of each day, and acquiring a source IP library fed back by the third party according to the acquisition request.
The first information includes a geographical location and/or an operator, it being understood that the first information may be information consisting of a geographical location and an operator, such as Guangzhou telecom; or information consisting of geographical location, such as Hubei Wuhan; or information consisting of operators, such as mobility; it may also be information consisting of other information and geographical location and/or operator, for example, the first information consisting of Hubei and university of science and technology in China.
Each piece of first information corresponds to an IP segment, and the representation form of the IP segment corresponding to the first information is not limited in the embodiment of the present invention, and specifically, the representation form of the IP segment may be a form of a segment of IP address range, for example: 162.105.113.1-162.105.1.254, may also be in the form of an IP address plus a subnet mask, e.g., 192.168.1.0/24.
In this application, a line refers to a party to which an IP segment belongs, that is, an IP segment belongs to one or more lines, and a line may include one or more IP segments. Routes may have different dimensions, e.g. some routes are operators, some are geographical locations, and also a combination of operators and geographical locations.
Illustratively, the geographic location to which the IP segments 162.105.113.1-162.105.1.254 belong is Guangzhou, the operator to which the IP segments belong is telecom, and when the line is an operator, the line to which the IP segments 162.105.113.1-162.105.1.254 belong is telecom; when the route is a geographical position, the route to which 162.105.113.1-162.105.1.254 belongs is Guangzhou; when the line is a combination of operator and geographic location, the line to which 162.105.113.1-162.105.1.254 belongs is Guangzhou telecommunications.
In the process of determining the first line to which the IP segment corresponding to each piece of first information belongs, specifically, determining whether a keyword matched with the first information exists in a preset keyword table may be: matching each keyword in the keyword list by using the first information by adopting a preset matching algorithm, and judging that the keyword matched with the first information exists in the preset keyword list if the first information is successfully matched with one or more keywords; otherwise, judging that the keyword matched with the first information does not exist in the preset keyword list. In addition, the matching algorithm adopted in the present invention is not limited, and for example, the matching algorithm may be one or a combination of a regular matching algorithm, a fuzzy matching algorithm, a pattern matching algorithm, and the like.
In the present application, the keywords may be any natural language, for example, may be beijing, wuhan university, shanghai mobile, jinshan software, etc., and in the keyword table, each keyword corresponds to: the system comprises a geographical position identifier, a geographical position weight, an operator identifier and an operator weight, wherein the geographical position identifier is used for uniquely identifying the geographical position, the operator identifier is used for uniquely identifying the operator, the geographical position weight is used for representing the matching degree of the geographical position corresponding to the keyword and the line corresponding to the keyword, and the operator weight is used for representing the matching degree of the operator corresponding to the keyword and the line corresponding to the keyword.
The representation of the geographical location and the identifier of the operator may be the same or different, for example, the identifier of the geographical location may be composed of one or more of numbers, letters, underlines, etc., and the identifier of the operator may also be composed of one or more of numbers, letters, underlines, etc. The weight of the geographical location and the weight of the operator may be any natural number.
In addition, the embodiment of the present invention does not limit the manner of setting the identifier of the geographic location and the identifier of the operator, for example, in order to facilitate a user to quickly know the geographic location through the identifier of the geographic location, in a specific implementation manner, a telephone area code of a region where the geographic location is located may be used as the identifier of the geographic location.
For example, since the area code of beijing is 010 and the area code of hebeishi house is 0311, the id of beijing can be 010 and the id of hebeishi house can be 0311.
Further, since there is a possibility that a plurality of regions share one area code, for example, the area code of hainan haikou city is 0898, and the area code of hainan saint is also 0898, in order to avoid the situation that the identifier of one geographical location corresponds to a plurality of geographical locations, a bit may be reserved on the basis of the area code, for example, the identifier of hainan haikou city may be set to be 08980, and the identifier of hainan saint is set to be 08981.
The keyword list may be set according to a user requirement, that is, each keyword included in the keyword list, the identifier and weight of the geographic location corresponding to each keyword, and the identifier and weight of the operator may be set in advance.
For example, if the keyword is beijing and the identifier of beijing is 010, the identifier of the geographic location corresponding to the keyword may be set to be 010: since the geographic position corresponding to the keyword is beijing, the route whose geographic position is beijing can be completely matched with the geographic position corresponding to the keyword through the geographic position corresponding to the keyword, so that the weight of the geographic position corresponding to the keyword can be set to be very large, such as 90, and since the keyword does not embody information of an operator, a specific route cannot be matched through the operator corresponding to the keyword, the identifier of the operator corresponding to the keyword can be set to be a preset default identifier, and the weight of the geographic position corresponding to the keyword is set to be very small, such as 10.
Furthermore, if the preset keyword table has the keyword matched with the first information, the identifier and the weight of the geographic position corresponding to each target keyword and the identifier and the weight of the operator can be obtained from the keyword table; and obtaining a line identifier corresponding to the first information as the first line identifier by using the obtained identifier and weight of each geographic position and the identifier and weight of each operator, wherein the target keyword is a keyword matched with the first information in the keyword list.
In a specific embodiment, obtaining the route identifier corresponding to the first information by using the obtained identifier and weight of each geographic location and the obtained identifier and weight of each operator may include the following steps:
step B1, calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the maximum weight and the identifier of the operator with the maximum weight in the obtained identifiers;
and step B2, searching in a preset mapping table to obtain a line identifier corresponding to the first information identifier as the line identifier corresponding to the first information.
The mapping table is used for storing the mapping relation between the information identifier and the line identifier.
Because one or more keywords may exist in the keyword table to be matched with the first information, that is, there may be one or more target keywords, when there is only one target keyword, the identifier of the geographic location and the identifier of the operator corresponding to the target keyword may be directly obtained; when there are a plurality of target keywords, the identifier of the geographical location with the largest weight and the identifier of the operator with the largest weight in the identifiers can be obtained.
For example, the keywords matched with the first information include L, M, N, the identifiers and weights of the geographic positions corresponding to the keywords L and the identifiers and weights of the operators are 010, 90, 139 and 10 respectively, the identifiers and weights of the geographic positions corresponding to the keywords M and the identifiers and weights of the operators are 012, 60, 139 and 50 respectively, the identifiers and weights of the geographic positions corresponding to the keywords N and the identifiers and weights of the operators are 014, 100, 139 and 0 respectively, since the weight of the geographic position corresponding to the keyword N is the largest and the weight of the operator corresponding to the keyword M is the largest, the identifier of the geographic position with the largest weight is obtained as the identifier of the geographic position corresponding to the keyword N, namely 014, and the identifier of the operator with the largest weight is the identifier of the operator corresponding to the keyword M, namely 139.
Specifically, the information identifier corresponding to the first information is calculated by using the identifier of the geographical location with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers, and may be: and linearly superposing the identifier of the geographical position with the maximum weight in the obtained identifiers and the identifier of the operator with the maximum weight to obtain the information identifier corresponding to the first information. Of course, other calculation manners may also be adopted in practical applications, and the specific calculation manner is not limited in the embodiment of the present invention.
For example, the identifier of the geographical location with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers are area _ id and isp _ id, respectively, and then the information identifier sv _ id corresponding to the first information may be: sv _ id + isp _ id b, where a and b are arbitrary numbers, respectively. For example, a is 100, 90, 80, 70, etc., and b is 1, 2, 3, 4, 5, etc. .
The line identifier is used to uniquely identify a line, and it can be understood that one line corresponds to one line identifier, the mapping table is used to store a mapping relationship between the information identifier and the line identifier, and the specific mapping relationship between the information identifier and the line identifier may be: one information identifier corresponds to one line identifier.
After the information identifier corresponding to the first information is obtained, that is, after the first information identifier is obtained, the line identifier corresponding to the first information identifier is obtained and is used as the line identifier corresponding to the first information, and then the line identifier corresponding to the first information identifier can be obtained by searching in a preset line table, and the line corresponding to the first line identifier is obtained, and the obtained line is determined to be the first line to which the IP segment corresponding to the first information belongs.
And the mapping table and the line table are utilized, so that a user can adjust the line according to the actual condition, and the management of an IP library is facilitated. The concrete expression is as follows: when the lines in the line table need to be updated, that is, the lines in the line table need to be added, modified or deleted, only the mapping table and the line table need to be updated, so that the management process of the IP library is simplified.
Illustratively, after an IP library is generated, if a guangzhou telecommunication line needs to be added, a line identifier corresponding to the guangzhou telecommunication and the guangzhou telecommunication is added in a line table, then an information identifier is calculated by using an identifier of a geographic location corresponding to the guangzhou and an identifier of an operator corresponding to the telecommunication, and a mapping relation between the calculated information identifier and the line identifier corresponding to the guangzhou telecommunication is added in a mapping table, so that the guangzhou telecommunication line is added in the generated IP library; if the Guangzhou telecommunication line needs to be deleted, the line identifier corresponding to the Guangzhou telecommunication in the mapping table can be modified into the line identifier corresponding to the Guangdong telecommunication, so that when the mapping table is searched by using the information identifier corresponding to the Guangzhou telecommunication, the obtained line identifier is: and the line identification corresponding to the Guangdong telecommunication line realizes the deletion of the Guangzhou telecommunication line in the generated IP library.
After the first line to which the IP segment corresponding to each piece of first information belongs is determined, an IP library may be generated using each determined first line and the IP segment belonging to each determined first line.
Therefore, by applying the technical scheme provided by the embodiment of the invention, the source IP library does not need to be traversed for many times in the process of generating the IP library, thereby improving the efficiency of generating the IP library.
It should be noted that, by applying the method provided by the embodiment of the present invention, the keyword table may store keywords corresponding to lines of each dimension, and the keywords may be any natural language.
For example, the first information includes north Hu and university of science and technology in China, if the prior art is adopted, since the keyword in the configuration file is a line, that is, the keyword is only one or a combination of an operator and a geographic location, the keyword in the configuration file is matched with the first information to be north Hu, so that the IP section corresponding to the first information is attributed to north Hu, and by applying the present application, the first information can be matched with the keyword in the keyword table to be university of science and technology in China, and then the identifier of the geographic location corresponding to the university of science and technology in China is obtained as: the identifier of Hubei Wuhan is that the identifier of the operator is: the identification of the education network, so that the IP section corresponding to the first information belongs to the Hubei Wuhan education network, compared with the prior art that the IP section corresponding to the first information belongs to Hubei, the accurate matching of the first information is realized, and the fineness and the accuracy of the generated IP library are improved.
In addition, in order to further improve the efficiency of generating the IP library, in a specific embodiment, an asynchronous processing mode may be adopted to obtain each first information identifier, and store the obtained each first information identifier, the first information corresponding to each first information identifier, and the IP segment corresponding to each first information into an analysis table, where the analysis table is a data table established in advance, and the data table is used to store each first information identifier, the first information corresponding to each first information identifier, and the IP segment corresponding to each first information.
Illustratively, the source IP library obtained by parsing in an idle period (for example, 12:00-5:00 in the morning) is used to obtain each first information identifier, first information corresponding to each first information identifier, and an IP segment corresponding to each first information; and storing the obtained first information identifications, the first information corresponding to the first information identifications and the IP sections corresponding to the first information into an analysis table, and specifically comprising the following steps:
step C1, analyzing the obtained source IP library to obtain each first information recorded by the source IP library and an IP section corresponding to each first information;
step C2, aiming at each first message, judging whether a keyword matched with the first message exists in a preset keyword list to be used as a target keyword; if yes, acquiring the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers;
step C3, storing the obtained first information identifications, the first information corresponding to the first information identifications, and the IP segments corresponding to the first information into an analysis table.
By applying the embodiment of the invention, when the IP library is generated in the working period (for example, 8:00-18:00), the data stored in the analysis table is directly used, and the source IP library is not required to be analyzed in the process of generating the IP library, so that the efficiency of generating the IP library is greatly improved.
In addition, in a specific embodiment, the electronic device may obtain a plurality of source IP libraries, may establish a corresponding analysis table in advance for each source IP library, and may store the analysis result in the analysis table corresponding to the source IP library after analyzing the source IP libraries through steps C1-C3.
In this case, in the process of generating the IP library, for each source IP library, the data in the analysis table corresponding to the source IP library may be used to determine the first line to which the IP segment corresponding to each piece of first information belongs in the correspondence relationship recorded in the source IP library. Since the information in each source IP repository may be different, the first line to which the same IP segment, as determined by different source IP repositories, belongs may be different.
Illustratively, the source IP library includes: the library A, the library B and the library C determine that the IP section belonging to the Beijing telecommunication line is 1.1.1.1-1.1.1.255 by utilizing the data in the analysis table corresponding to the library A; determining that the IP section belonging to the Hebei telecommunication line is 1.1.1.4-1.1.1.128 by using the data in the analysis table corresponding to the library B; determining the IP section belonging to the Tianjin telecommunication line to be 1.1.1.25-1.1.1.192 by utilizing the data in the analysis table corresponding to the C base; that is, using the library A, it can be determined that 1.1.1.4-1.1.1.128 belongs to the Beijing telecommunication line; and 1.1.1.4-1.1.1.128 can be determined to belong to Hebei telecommunication line by using the B library; determining 1.1.1.25-1.1.1.128 as belonging to the Hebei telecommunication line by using a B library; and with the C library it can be determined 1.1.1.25-1.1.1.128 as belonging to an tianjin telecommunication line.
It can be seen that the first line to which different source IP repositories determine its home may be different for the same IP segment. Therefore, in order to avoid that the accuracy of the generated IP library is affected due to the non-uniform information of each source IP library, specifically, after determining the first line to which the IP segment corresponding to each first information belongs in the correspondence relationship recorded in each source IP library, the method for generating the IP library by using each determined first line and the IP segment belonging to each determined first line may include the following steps:
all IP sections recorded by the active IP library are obtained and divided into non-overlapping sub-IP sections;
for each sub-IP section, determining a source IP library with the highest priority from each source IP library recorded with the sub-IP section as a target source IP library, and taking a line to which the sub-IP section determined by using the target source IP library belongs as a first line to which the sub-IP section belongs;
and generating an IP library by using each determined first line and the sub IP sections belonging to each determined first line.
Specifically, all IP segments may be divided into sub-IP segments that do not overlap with each other as follows:
obtaining an IP address with the minimum initial IP address in all IP sections as a first IP address, and obtaining an IP address with the minimum difference value with the first IP address in all IP sections except the first IP address as a second IP address; judging whether the first IP address and the second IP address are recorded in the same source IP library or not; if so, taking the first IP address as the initial IP address of the first sub-IP section, taking the second IP address as the terminal IP address of the first sub-IP section, and taking the next IP address of the second IP address as the third IP address; otherwise, the first IP address is used as the initial IP address of the first sub-IP section, the previous IP address of the second IP address is used as the termination IP address of the first sub-IP section, and the second IP address is used as the third IP address;
obtaining an IP address with the minimum difference value with the third IP address in all IP addresses except the first IP address, the second IP address and the third IP address in all IP sections as a fourth IP address; judging whether the third IP address and the fourth IP address are recorded in the same source IP library or not; if so, taking the third IP address as the initial IP address of the second sub-IP section, taking the fourth IP address as the terminal IP address of the second sub-IP section, and taking the next IP address of the fourth IP address as the fifth IP address; otherwise, the third IP address is used as the initial IP address of the second sub-IP section, the previous IP address of the fourth IP address is used as the terminal IP address of the second sub-IP section, and the fourth IP address is used as the fifth IP address;
and the analogy is repeated until the terminating IP address of the last sub-IP section is: the IP address with the largest terminating IP address in all IP segments.
Assume that obtaining all IP segments of all active IP library records includes: 1.1.1.1-1.1.1.1.255 from bank a, 1.1.1.4-1.1.1.128 from bank B and 1.1.1.25-1.1.1.192 from bank C, all IP segments are divided into non-overlapping sub-IP segments according to the above method, and the first, second, third and fourth sub-IP segments are: 1.1.1.1-1.1.1.3, 1.1.1.4-1.1.1.24, 1.1.1.25-1.1.1.192, and 1.1.1.193-1.1.1.255.
In a specific embodiment, after obtaining each sub-IP segment, for each sub-IP segment, a source IP library with the highest priority may be determined from each source IP library in which the sub-IP segment is recorded, and used as a target source IP library, and a line to which the sub-IP segment determined by using the target source IP library belongs is used as a first line to which the sub-IP segment belongs.
On the basis of the two examples, the divided non-overlapping sub-IP segments are respectively: 1.1.1.1-1.1.1.3, 1.1.1.4-1.1.1.24, 1.1.1.25-1.1.1.192, 1.1.1.193-1.1.1.255, records 1.1.1.1-1.1.3 of source IP as bank A, records 1.1.1.4-1.1.1.24 of source IP as bank A and bank B, records 1.1.1.25-1.1.1.192 of source IP as bank A and bank C, records 1.1.1.193-1.1.255 of source IP as bank A, and the priority of bank A, bank B and bank C is increased in turn, then it is determined that 1.1.1.1-1.1.3 belongs to Beijing telecommunication line, 1.1.1.4-1.1.1.24 belongs to Hebei telecommunication line, it is determined that 1.1.1.25-1.1.1.192 belongs to Tianjin telecommunication line, and it is determined that 1.1.1.193-1.1.1.1.1.1.255 belongs to Beijing telecommunication line.
In addition, since the types of the first lines to which the same IP segment belongs may be different, which are determined by different source IP repositories, for example, the same IP segment, the geographic location to which the same IP segment belongs may be determined by one source IP repository, and the operator to which the same IP segment belongs may be determined by another source IP repository, in which case, the determined geographic location to which the IP segment belongs and the determined operator may be combined to serve as the first line to which the IP segment belongs.
For example, using the A library it can be determined that 1.1.1.12-1.1.1.15 is due to Tianjin, using the B library it can be determined that 1.1.1.12-1.1.1.15 is due to Tianjin, and finally it is determined that 1.1.1.12-1.1.1.15 is due to Tianjin telecom.
It should be noted that the source IP library may be from a third party, or from the electronic device itself, the source IP library may be a full IP library, or may be a non-full IP library, where the full IP library means that the IP segment range included in the IP library is 0.0.0.0-255.255.255.255, that is, the IP library covers all IP addresses, and the non-full IP library means that the IP segment range included in the IP library is not 0.0.0.0-255.255.255.255, that is, the IP library does not cover all IP addresses.
In addition, in order to make the generated IP library a full IP library, in a specific embodiment, all IP segments recorded in all source IP libraries may form a full IP segment.
The priority of each source IP library may be set in advance according to user requirements, which is not limited in the embodiment of the present invention.
For example, the priority may be set according to the reliability of the provider of the source IP library, for example, the higher the reliability of the provider of the source IP library is, the higher the priority of the source IP library is set; the priority may also be set according to the IP segment range contained in the source IP library, for example, the larger the IP segment range contained in the source IP library is, the higher the priority of the source IP library is set; the priority may also be set in accordance with the fineness of the first information recorded in the source IP repository, for example, the higher the fineness of the first information recorded in the source IP repository, the higher the priority of the source IP repository is set.
In order to deal with the situation that there is no keyword matching the first information in the keyword table, in a specific embodiment, in the case that there is no keyword matching the first information in the preset keyword table, before step a3, that is, before the step of performing a lookup in the preset route table to obtain the first route corresponding to the first route identification, the method may further include:
and setting the line identifier corresponding to the first information as a preset line identifier.
The preset route identifier is used for indicating that no keyword matched with the first information exists in the preset keyword table, and the preset route identifier may be set according to a user requirement, for example, 0000, 1111, and the like.
It can be seen that, by applying the embodiment of the present invention, the line identifier corresponding to the first information can be obtained no matter whether the keyword table has the keyword matched with the first information.
In addition, in order to make the keywords included in the keyword table more comprehensive, after determining that no keyword matching the first information exists in the preset keyword table, the method may further include the following steps:
step D1, generating a newly added keyword report;
and D2, after receiving the indication of confirming the newly added keyword matched with the first information, obtaining the keyword matched with the first information, and updating the keyword matched with the first information to a keyword list.
The newly-added keyword report is used for prompting the user whether a keyword matched with the first information is newly added or not;
the embodiment of the present invention does not limit the way for the electronic device to obtain the keyword matched with the first information, for example, the way may be: after the electronic equipment generates the newly added keyword report, the newly added keyword report can be displayed, so that a user can judge whether the keyword matched with the first information needs to be newly added or not after seeing the newly added keyword report; if the keyword matched with the first information needs to be added newly, the user can select an option for confirming the newly added keyword matched with the first information from options provided by the electronic equipment and input the keyword matched with the first information, so that the electronic equipment can receive an indication for confirming the newly added keyword matched with the first information and obtain the keyword matched with the first information.
It can be seen that after the electronic device determines that the keyword matched with the first information does not exist in the preset keyword table, the electronic device can obtain the keyword matched with the first information and update the keyword matched with the first information to the keyword table, so that the updated keyword table has the keyword matched with the first information, and the keyword contained in the keyword table is more comprehensive.
In order to improve the accuracy of the generated IP library, in a specific embodiment, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, before step a4, that is, before the step of determining that the obtained line is a first line to which the IP segment corresponding to the first information belongs, the method further includes:
step A31, judging whether second information matched with the first information exists in all the second information, and using the second information as target second information; if yes, judging whether the IP section corresponding to the first information conflicts with the IP section corresponding to the target second information; and if the conflict exists, resetting the IP section corresponding to the first information as the IP section corresponding to the target second information.
It should be noted that the second information is the same type of information as the first information, that is, the second information includes a geographic location and/or an operator, and the reference table may store the correspondence between the second information and the IP segment that has been confirmed to be correct.
In addition, the embodiment of the present invention does not limit the manner of determining whether the IP segment corresponding to the first information conflicts with the IP segment corresponding to the target second information. For example, the method may be: when the IP section corresponding to the first information is different from the IP section corresponding to the target second information, judging that the IP section corresponding to the first information conflicts with the IP section corresponding to the target second information; and when the IP section corresponding to the first information is the same as the IP section corresponding to the target second information, judging that the IP section corresponding to the first information does not conflict with the IP section corresponding to the target second information.
For example, the first information is the beijing telecommunications, the second information matched with the first information is the beijing telecommunications, the IP segment corresponding to the beijing telecommunications stored in the reference table is 1.1.1.0-1.1.1.255, and the IP segment corresponding to the first information recorded in the source database is: 192.168.0.1-192.168.0.254, it is determined that the IP segment corresponding to the first message conflicts with the IP segment corresponding to the target second message, and the IP segment corresponding to the first message is reset to: 1.1.1.0-1.1.1.255.
It can be seen that, by applying the embodiment of the present invention, the reference table is utilized to reset the corresponding relationship between the first information obtained from the source database and the IP segment, and the corresponding relationship between the first information obtained from the source database and the IP segment can be corrected before the IP library is generated, thereby improving the accuracy of the generated IP library.
In order to improve the accuracy of the generated IP library, in another specific embodiment, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, before step S102, that is, before the step of generating the IP library by using the determined first lines and the IP segments belonging to the determined first lines, the method may further include:
s1011, determining a second line to which the IP section corresponding to each piece of second information belongs;
s1012, for each determined first line, determining whether there is a second line identical to the first line in all the determined second lines, as a target second line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, the IP segment belonging to the first line is reset to the IP segment belonging to the target second line.
The manner of determining the second line to which the IP segment corresponding to each piece of second information belongs is the same as the manner of determining the first line to which the IP segment corresponding to each piece of first information belongs, and the specific process may refer to steps a1-a4, which is not described herein again.
The manner of determining whether the IP segment belonging to the first line conflicts with the IP segment belonging to the target second line is the same as the manner of determining whether the IP segment corresponding to the first information conflicts with the IP segment corresponding to the target second information, and the specific process may refer to the description of relevant parts in step a31, which is not described herein again.
It can be seen that, by applying the embodiment of the present invention, the second line to which the IP segment corresponding to each second information belongs can be determined by using each second information stored in the reference table and the IP segment corresponding to each second information, and further, in a case where the IP segment belonging to the first line conflicts with the IP segment belonging to the target second line, the IP segment belonging to the first line can be reset to the IP segment belonging to the target second line, so as to correct the obtained IP segments belonging to each determined first line, thereby improving the accuracy of the generated IP library.
In order to ensure that the range of IP segments included in the generated IP library can meet the user requirement, in a specific embodiment, before generating the IP library by using the determined first lines and the IP segments belonging to the determined first lines, the method may further include:
step E1 of obtaining an IP segment range formed by the IP segments belonging to the determined respective first lines;
step E2, verifying whether the IP section range is equal to the preset IP section range; if so, go to step E3;
step E3, using each of the determined first lines and the IP sections belonging to each of the determined first lines, generating an IP library
The preset IP segment range may be set according to a user requirement, which is not limited in the embodiment of the present invention, for example, the preset IP segment range may be: 0.0.0.0-255.255.255.255.
It can be seen that, by applying the embodiment of the present invention, the step of generating the IP library by using the determined first lines and the IP segments belonging to the determined first lines is executed only when the IP segment range is verified to be equal to the preset IP segment range, so that it is ensured that the IP segment range included in the generated IP library can satisfy the user requirement.
In order to ensure that the representation of the IP segments contained in the generated IP library can satisfy the user requirement, in a specific embodiment, before the step of generating the IP library by using the determined first lines and the IP segments belonging to the determined first lines, the method may further include:
and converting the representation form of the IP section belonging to the determined first line into a preset IP section representation form.
The preset IP segment format may be set according to a user requirement, which is not limited in the embodiment of the present invention, for example, the preset IP segment may be represented in the form of: a segment of the IP address range may also be in the form of an IP address plus a subnet mask.
Therefore, by applying the embodiment of the present invention, before generating the IP library by using each determined first line and the IP segment belonging to each determined first line, the representation form of the IP segment belonging to each determined first line is converted into the preset IP segment representation form, and the preset IP segment format can be set according to the user requirement, so that the representation form of the IP segment contained in the generated IP library can be ensured to meet the user requirement.
In order to facilitate the subsequent processing procedure to obtain the generated IP library, after the step of generating the IP library by using the determined respective first lines and the IP segments belonging to the determined respective first lines, the method may further include:
generating the version number of the IP library;
backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a copy IP library; and marks the duplicate IP library with a version number.
The version numbers are used to uniquely identify the IP libraries, and IP libraries generated at different times are labeled with different version numbers.
Therefore, by applying the embodiment of the invention, the IP libraries generated at different periods can be quickly acquired through the version number. In addition, if a problem occurs in the process of generating the current IP library, so that the current IP library cannot be generated, the version number can be used for returning to the previously generated IP library to search the reason of the problem, so as to find a solution for solving the problem, and thus the generation of the current IP library is completed.
Further, in order to facilitate the user to know the reason for generating the IP library, the electronic device may further display a prompt message before generating the version number of the IP library, where the prompt message is used to prompt the user to input a remark, and the remark is used to indicate the reason for generating the IP library; after seeing the prompt information, the user can input the remark through the electronic equipment, and therefore the electronic equipment can obtain the remark input by the user. And the obtained remarks are saved. The embodiment of the present invention does not limit the specific content of the remarks, for example, the content included in the remarks may be: adding lines, changes in data in the source IP on which the previously generated IP library depends, etc.
The following presents a simplified summary of an embodiment of the invention by way of a specific example.
The IP library generation method provided by the embodiment of the present invention is applied to a certain electronic device, and as shown in fig. 2 to 4, the following data tables, namely, the provision table, the area table, the isp table, the key _ words table, the general _ ipbinfo table, the verified _ ipbinfo table, the view table, the sub _ view table, the sv _ view _ map table and the version table, are created in advance in a MySO L (MySQ L is an open source code relational database management system) database, wherein,
provice table: the system is used for storing the name and the identification of the Chinese province-level geographical location and the names and the identifications of other countries, wherein providence _ id represents the identification of the Chinese province-level geographical location/other countries, cn _ name represents the Chinese name of the Chinese province-level geographical location/other countries, en _ name represents the English name of the Chinese province-level geographical location/other countries, and group _ name represents the large area of the Chinese province-level geographical location/other countries, for example, providence _ id is 0715, cn _ name is Hubei, en _ name is Hubei, and group _ name is the middle area;
area table: the system comprises a storage module, a display module and a display module, wherein the storage module is used for storing names and identifications of Chinese market-level geographic positions and identifications of Chinese province-level geographic positions to which the Chinese market-level geographic positions belong, area _ id represents the identifications of the Chinese market-level geographic positions, cn _ name represents the Chinese names of the Chinese market-level geographic positions, en _ name represents the English names of the Chinese market-level geographic positions, provice _ id (FK) represents the identifications of the Chinese province-level geographic positions to which the Chinese market-level geographic positions belong, and a foreign key is provice _ id, namely, an area table is associated with a provice table through the provice _ id;
isp table: the system comprises a storage module, a storage module and a display module, wherein the storage module is used for storing the name and the identification of an operator, isp _ id represents the identification of the operator, cn _ name represents the Chinese name of the operator, and en _ name represents the English name of the operator;
key _ words table: the system comprises a storage module, a processing module, a display module and a display module, wherein the storage module is used for storing the name and the identification of the keyword, the identification and the weight of the geographic position corresponding to the keyword, and the identification and the weight of the operator, wherein key _ id represents the identification of the keyword, isp _ id (FK) represents the identification of the operator corresponding to the keyword, and isp _ id is a foreign key, namely, the key _ words table and the area table are associated through the isp _ id, area _ id (FK) represents the identification of the geographic position corresponding to the keyword, and area _ id is a foreign key, namely, the key _ name represents the name of the keyword, area _ weight represents the weight of the geographic position corresponding to the keyword, and isp _ weight represents the weight of the operator corresponding to the keyword;
general _ ipbin table: the system is used for storing one or more first information records, each first information record is composed of an identifier of the first information record, a first information identifier, first information corresponding to the first information identifier and an IP section corresponding to the first information, wherein the first information comprises: geographic location and operator, the geographic location in the first information comprising: country, province, city, continent, isp represents an operator in the first information, id represents an identifier of the first information record, startip and endip together represent an IP segment corresponding to the first information, startip represents a start address of the IP segment corresponding to the first information, endip represents an end address of the IP segment corresponding to the first information, and the first information identifier includes: isp _ id (fk) and area _ id (fk), isp _ id (fk) representing the identity of the operator in the first information and isp _ id being a foreign key, i.e. associating the general _ ipbin table with the isp table by isp _ id, area _ id (fk) representing the identity of the geographical location in the first information and area _ id being a foreign key, i.e. associating the general _ ipbin table with the area table by area _ id;
fixed _ ipbin table: the system is used for storing one or more second information records, each second information record is composed of an identifier of the second information record, a second information identifier, second information corresponding to the second information identifier, and an IP section corresponding to the second information, wherein the second information comprises: geographic location and operator, the geographic location in the second information comprising: country, province, city, continent, isp represents an operator in the second information, id represents an identifier of the second information record, startip and endip together represent an IP segment corresponding to the second information, startip represents a start address of the IP segment corresponding to the second information, endip represents an end address of the IP segment corresponding to the second information, and the second information identifier includes: isp _ id (fk) and area _ id (fk) isp _ id (fk) denote the identity of the operator in the second information and isp _ id is a foreign key, i.e. a fixed _ ipbin table is associated with the isp table by isp _ id, area _ id (fk) denotes the identity of the geographical location in the second information and area _ id is a foreign key, i.e. a fixed _ ipbin table is associated with the area table by area _ id;
view table: the system comprises a storage module, a line identifier, a view _ id, a cn _ name and an en _ name, wherein the storage module is used for storing the corresponding relation between the line and the line identifier, the view _ id represents the line identifier, the cn _ name represents the Chinese name of the line, and the en _ name represents the English name of the line;
sub _ view table: the information storage device is used for storing information identification, and the information corresponding to the information identification is as follows: the information (hereinafter referred to as combined information) composed of the geographical location and the operator is also used for storing the identifier of the geographical location in the combined information, the identifier of the operator in the combined information, and the name of the combined information, wherein sv _ id represents the information identifier, cn _ name represents the chinese name of the combined information, en _ name represents the english name of the combined information, area _ id represents the identifier of the geographical location in the combined information, and isp _ id represents the identifier of the operator in the combined information;
sv _ view _ map table: the mapping record is used for storing one or more mapping records, each mapping record is composed of a mapping relation between an information identifier and a line identifier, wherein map _ id represents the identifier of the mapping record, sv _ id (FK) represents the information identifier, and a foreign key is sv _ id, namely, an sv _ view _ map table is associated with a sub _ view table through sv _ id, view _ id (FK) represents the line identifier, and a foreign key is view _ id, namely, an sv _ view _ map table is associated with a view table through view _ id, sv _ name represents the Chinese name/name of the combined information, and view _ name represents the Chinese name/name of the line;
version table: the system comprises a version number, a remark and generation time, wherein the version _ id represents the version number, the remarks represents the remark, and the create _ time represents the generation time;
it should be noted that the data in the provice table, the area table, the isp table, and the sub _ view table generally do not need to be adjusted; updating data in the view table and the sv _ view _ map table after adding/deleting/modifying lines contained in the generated IP library; updating the data in the key _ words table after adding/deleting/modifying the key words; updating data in the general _ ipbinfo table after analyzing the source IP library; updating the data in the verified _ ipbin table after adding/deleting/modifying the second information record; and updating the data in the version table after the IP library is generated.
After the data table is created, the data in the general _ ipbin table may be updated according to the flow shown in fig. 5, where the specific flow is as follows:
s301, calling an API (Application Programming interface) of a source IP library provided by a third party;
s302, judging whether the source IP library is successfully obtained by calling the API; if not, executing S303; if so, executing S304;
s303, generating a first alarm report and ending the process; wherein, the first alarm report is used for indicating that the source IP library is not successfully obtained;
s304, analyzing the obtained source IP library to obtain each piece of first information recorded by the source IP library and an IP section corresponding to each piece of first information;
s305, judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword according to each piece of first information; if yes, executing S306; if not, go to S309;
s306, acquiring the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers;
s307, storing each obtained first information identifier, first information corresponding to each first information identifier and an IP section corresponding to each first information into a general _ ipbin table;
s308, judging whether the storage is successfully carried out to the general _ ipbin table or not; if the success is achieved, the flow is ended; if the alarm is unsuccessful, generating a second alarm report and ending the process; the second alarm report is used for indicating that the second alarm report is not successfully stored in the general _ ipbin table;
s309, generating a new keyword report;
s310, after receiving the instruction of confirming that the keyword matched with the first information is newly added, obtaining the keyword matched with the first information, and updating the keyword matched with the first information to a keyword list.
When the line of the IP library to be generated is a combination of the operator and the geographic location of the city of china, the generation of the IP library can be completed according to the flow shown in fig. 6, which is specifically as follows:
s401, generating remark input prompt information and acquiring remarks input by a user aiming at the remark input prompt information; the remark input prompt information is used for prompting a user to input the remark; then, S402 and S403 are executed in parallel;
s402, determining a first line to which the IP section corresponding to each piece of first information belongs by using data in a general _ ipinfo table, an sv _ view _ map table and a view table, judging whether the first line to which the IP section corresponding to each piece of first information belongs is successfully determined, and if not, executing S404; if yes, go to S406;
s403, determining a second line to which the IP section corresponding to each piece of second information belongs by using the data in the secured _ ipbin table, the sv _ view _ map table and the view table; judging whether the second line to which the IP section corresponding to each piece of second information belongs is successfully determined, if not, executing S405; if yes, go to S406;
s404, generating a first line failure report and ending the process; the first line failure report is used for indicating that the first line to which the IP segment corresponding to each piece of first information belongs is not successfully determined, that is, indicating that the IP segment corresponding to the first information has an IP segment to which the line to which the IP segment belongs cannot be determined;
s405, generating a second line failure report and ending the process; the second line failure report is used for indicating that the second line to which the IP segment corresponding to each piece of second information belongs is not successfully determined, that is, indicating that the IP segment corresponding to the second information has an IP segment to which the line to which the IP segment belongs cannot be determined;
s406, judging whether a second line identical to the first line exists in all the determined second lines as a target second line aiming at each determined first line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, resetting the IP section belonging to the first line to the IP section belonging to the target second line;
s407, obtaining an IP section range formed by the IP sections belonging to the determined first lines; verifying whether the range of the IP section is equal to the range of the preset IP section or not; if not, executing S408; if yes, executing S409;
s408, generating an IP section range error report and ending the process, wherein the IP section range error report is used for indicating that the IP section range is not equal to the preset IP section range;
s409, converting the representation forms of the IP sections belonging to the determined first lines into preset IP section representation forms;
s410, generating an IP library by using each determined first line and the IP sections belonging to each determined first line;
s411, generating the version number of the IP library; storing the version number and the obtained remarks into a version table; backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a copy IP library; and marks the duplicate IP library with a version number.
In addition, when the line of the IP library to be generated is an operator, the generation of the IP library may be completed according to the following procedure:
s501, generating remark input prompt information and acquiring remarks input by a user according to the remark input prompt information; the remark input prompt information is used for prompting a user to input the remark; then, S502 and S503 are executed in parallel;
s502, acquiring the identifier of the operator in each piece of first information by using a general _ ipinfo table, searching an isp table for the identifier of the operator in each piece of first information, acquiring the name of the operator corresponding to the identifier of the operator in the first information as a line corresponding to the identifier of the first information, and determining that the acquired line is the first line to which the IP section corresponding to the first information belongs;
s503, obtaining the identifier of the operator in each piece of second information by using the configured _ ipbinfo table, searching the isp table for the identifier of the operator in each piece of second information, obtaining the name of the operator corresponding to the identifier of the operator in the second information as a line corresponding to the identifier of the second information, and determining the obtained line as the second line to which the IP section corresponding to the second information belongs;
s504, aiming at each determined first line, judging whether a second line which is the same as the first line exists in all the determined second lines or not as a target second line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, resetting the IP section belonging to the first line to the IP section belonging to the target second line;
s505, obtaining an IP section range formed by the IP sections belonging to the determined first lines; verifying whether the range of the IP section is equal to the range of the preset IP section or not; if not, executing S506; if yes, executing S507;
s506, generating an IP section range error report and ending the process, wherein the IP section range error report is used for indicating that the IP section range is not equal to the preset IP section range;
s507, converting the representation forms of the IP sections belonging to the determined first lines into preset IP section representation forms;
s508, generating an IP library by using the determined first lines and the IP sections belonging to the determined first lines;
s509, generating a version number of the IP library; storing the version number and the obtained remarks into a version table; backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a copy IP library; and marks the duplicate IP library with a version number.
When the line of the IP library required to be generated is the geographical position of Chinese province, the generation of the IP library can be completed according to the following procedures:
s601, generating remark input prompt information and acquiring remarks input by a user aiming at the remark input prompt information; the remark input prompt information is used for prompting a user to input the remark; then, S602 and S603 are executed in parallel;
s602, obtaining the identification of the geographical position in each piece of first information by using a general _ ipinfo table, searching an area table aiming at the obtained identification of the geographical position in each piece of first information, obtaining the identification of the Chinese provincial geographical position corresponding to the identification of the geographical position in the first information, searching a provice table by using the obtained identification of the Chinese provincial geographical position, obtaining the name of the Chinese provincial geographical position corresponding to the identification of the Chinese provincial geographical position as a line corresponding to the first information identification, and determining that the obtained line is the first line to which the IP section corresponding to the first information belongs;
s603, obtaining the identification of the geographic position in each piece of second information by using a fixed _ ipbinfo table, searching an area table aiming at the obtained identification of the geographic position in each piece of second information, obtaining the identification of the Chinese provincial geographic position corresponding to the identification of the geographic position in the second information, searching a provice table by using the obtained identification of the Chinese provincial geographic position, obtaining the name of the Chinese provincial geographic position corresponding to the identification of the Chinese provincial geographic position, taking the name as a line corresponding to the second information identification, and determining that the obtained line is a second line to which the IP section corresponding to the second information belongs;
s604, judging whether a second line identical to the first line exists in all the determined second lines as a target second line aiming at each determined first line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, resetting the IP section belonging to the first line to the IP section belonging to the target second line;
s605, obtaining an IP section range formed by the IP sections belonging to the determined first lines; verifying whether the range of the IP section is equal to the range of the preset IP section or not; if not, executing S606; if so, go to S607;
s606, generating an IP section range error report and ending the process, wherein the IP section range error report is used for indicating that the IP section range is not equal to the preset IP section range;
s607, converting the representation form of the IP section belonging to each determined first line into a preset IP section representation form;
s608, generating an IP library by using the determined first lines and the IP sections belonging to the determined first lines;
s609, generating the version number of the IP library; storing the version number and the obtained remarks into a version table; backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a copy IP library; and marks the duplicate IP library with a version number.
It can be seen that, by applying the technical solution provided by the embodiment of the present invention, in the process of generating an IP library, it is not necessary to traverse the source IP library many times, thereby improving the efficiency of generating the IP library, and, by analyzing the source IP library using the keyword table, it is implemented to accurately analyze the source IP library, further, when generating the IP library, the data stored in the general _ ipbinfo table is directly used, it is not necessary to analyze the source IP library in the process of generating the IP library, thereby greatly improving the efficiency of generating the IP library, when adding/modifying/deleting the lines in the IP library, it is only necessary to update the mapping table and the line table, thereby simplifying the management process of the IP library, and in addition, if a problem occurs in the process of generating the current IP library, and the current IP library cannot be generated, it is possible to use the version number generated before to find the cause of the problem, and find a solution for the problem, therefore, the generation of the current IP library is completed, the independent management of the geographic position and the operator is realized by utilizing the provice table, the area table and the isp table, and the generated IP library can meet the line requirements of different dimensions.
Corresponding to the above IP library generation method embodiment, an embodiment of the present invention provides an IP library generation apparatus, which is applied to an electronic device, and as shown in fig. 7, corresponds to the flow shown in fig. 1, and the apparatus includes:
a determining module 501, configured to determine a first line to which an IP segment corresponding to each piece of first information in a correspondence relationship recorded in a source IP library belongs;
a generating module 502, which generates an IP library by using the determined first lines and the IP segments belonging to the determined first lines;
the first information comprises a geographical position and/or an operator, and the corresponding relation is the corresponding relation between the first information and the IP section;
the determining module 501 determines the first line to which the IP segment corresponding to each piece of first information in the source IP library belongs by:
judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword; the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords;
if yes, acquiring the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
searching in a preset line table to obtain a line corresponding to the first line identification, and determining that the obtained line is a first line to which the IP section corresponding to the first information belongs; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
Therefore, by applying the technical scheme provided by the embodiment of the invention, the source IP library does not need to be traversed for many times in the process of generating the IP library, thereby improving the efficiency of generating the IP library
Optionally, the determining module 501 is further configured to:
and under the condition that the keyword matched with the first information does not exist in the preset keyword table, searching in the preset route table, and setting the route identification corresponding to the first information as the preset route identification before obtaining the first route corresponding to the first route identification.
Optionally, the determining module 501 obtains the line identifier corresponding to the first information by using the obtained identifier and weight of each geographic location and the obtained identifier and weight of each operator, specifically:
calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers;
and searching in a preset mapping table to obtain a line identifier corresponding to the first information identifier as the line identifier corresponding to the first information, wherein the mapping table is used for storing a mapping relation between the information identifier and the line identifier.
Optionally, the determining module 501 is further configured to:
generating a new keyword report after judging that the keyword matched with the first information does not exist in the preset keyword table, wherein the new keyword report is used for prompting a user whether to newly add the keyword matched with the first information;
and after receiving an indication of confirming that the keyword matched with the first information is newly added, acquiring the keyword matched with the first information, and updating the keyword matched with the first information to a keyword table.
Optionally, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, and the determining module 501 is further configured to:
before the obtained line is determined to be the first line to which the IP section corresponding to the first information belongs, judging whether second information matched with the first information exists in all the second information to serve as target second information; if yes, judging whether the IP section corresponding to the first information conflicts with the IP section corresponding to the target second information; and if the conflict exists, resetting the IP section corresponding to the first information as the IP section corresponding to the target second information.
Optionally, a reference table is stored in the electronic device, where the reference table is used to store each piece of second information and an IP segment corresponding to each piece of second information, and the determining module 501 is further configured to:
determining a second line to which the IP section corresponding to each piece of second information belongs before generating an IP library by using each determined first line and the IP sections belonging to each determined first line;
judging whether a second line identical to the first line exists in all the determined second lines as a target second line aiming at each determined first line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, the IP segment belonging to the first line is reset to the IP segment belonging to the target second line.
Optionally, the generating module 502 is further configured to:
obtaining an IP segment range formed by the IP segments belonging to the determined respective first lines before generating an IP library using the determined respective first lines and the IP segments belonging to the determined respective first lines;
verifying whether the range of the IP section is equal to the range of a preset IP section or not;
and if so, generating an IP library by using each determined first line and the IP sections belonging to each determined first line.
Optionally, the generating module 502 is further configured to:
before generating an IP library using the determined respective first lines and the IP segments belonging to the determined respective first lines, converting a representation form of the IP segments belonging to the determined respective first lines into a preset IP segment representation form.
Optionally, the generating module 502 is further configured to:
generating a version number of the IP library after generating the IP library using the determined respective first lines and the IP sections belonging to the determined respective first lines;
backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a copy IP library; and marks the duplicate IP library with a version number.
An embodiment of the present invention further provides an electronic device, as shown in fig. 8, the electronic device includes: a processor 601 and a memory 602, wherein,
a memory 602 for storing a computer program;
the processor 601 is configured to implement the IP library generation method provided in the embodiment of the present invention when executing the program stored in the memory.
The IP library generation method comprises the following steps:
determining a first line to which an IP section corresponding to each piece of first information in the corresponding relation recorded by the source IP library belongs, and generating the IP library by using each determined first line and the IP section belonging to each determined first line, wherein the first information comprises a geographical position and/or an operator, and the corresponding relation is the corresponding relation between the first information and the IP section;
determining a first line to which an IP section corresponding to each piece of first information in a source IP library belongs by the following method:
judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword; the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords;
if yes, acquiring the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
searching in a preset line table to obtain a line corresponding to the first line identification, and determining that the obtained line is a first line to which the IP section corresponding to the first information belongs; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
Therefore, by applying the technical scheme provided by the embodiment of the invention, the source IP library does not need to be traversed for many times in the process of generating the IP library, thereby improving the efficiency of generating the IP library.
It should be noted that other embodiments of the IP library generation method implemented by the processor 601 executing the program stored in the memory 602 are the same as the embodiments of the IP library generation method mentioned in the foregoing method section, and are not described herein again.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
The embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the IP library generation method are implemented.
The IP library generation method comprises the following steps:
determining a first line to which an IP section corresponding to each piece of first information in the corresponding relation recorded by the source IP library belongs, and generating the IP library by using each determined first line and the IP section belonging to each determined first line, wherein the first information comprises a geographical position and/or an operator, and the corresponding relation is the corresponding relation between the first information and the IP section;
determining a first line to which an IP section corresponding to each piece of first information in a source IP library belongs by the following method:
judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword; the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords;
if yes, acquiring the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
searching in a preset line table to obtain a line corresponding to the first line identification, and determining that the obtained line is a first line to which the IP section corresponding to the first information belongs; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
Therefore, by applying the technical scheme provided by the embodiment of the invention, the source IP library does not need to be traversed for many times in the process of generating the IP library, thereby improving the efficiency of generating the IP library.
It should be noted that other embodiments of the IP library generation method implemented when the computer program is executed by the processor are the same as the embodiments of the IP library generation method mentioned in the foregoing method section, and are not described again here.
Embodiments of the present invention provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the IP library generation method provided in the above embodiments.
Embodiments of the present invention provide a computer program, which, when running on a computer, causes the computer to execute the IP library generation method provided in each of the above embodiments.
It is noted that, herein, relational terms such as first and second, and the like may be 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. Also, 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 an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, the computer-readable storage medium, the computer program product containing the instructions, and the computer program embodiment, since they are substantially similar to the method embodiment, the description is relatively simple, and it is sufficient to refer to the partial description of the method embodiment for the relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (20)

1. An IP library generation method applied to an electronic device, the method comprising:
determining a first line to which an IP section corresponding to each piece of first information in the corresponding relation recorded by the source IP library belongs, and generating the IP library by using each determined first line and the IP section belonging to each determined first line, wherein the first information comprises a geographical position and/or an operator, and the corresponding relation is the corresponding relation between the first information and the IP section;
determining a first line to which an IP section corresponding to each first information in the source IP library belongs by the following method:
judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword; the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, and identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords;
if yes, obtaining the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
searching in a preset line table to obtain a line corresponding to the first line identification, and determining that the obtained line is a first line to which the IP section corresponding to the first information belongs; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
2. The method of claim 1, wherein in the case that there is no keyword matching the first information in the preset keyword table, the method further comprises:
setting a line identifier corresponding to the first information as a preset line identifier, and taking the preset line identifier as a first line identifier;
and searching in a preset route table to obtain a first route corresponding to the first route identification.
3. The method according to claim 1, wherein the obtaining, by using the obtained identifier and weight of each geographic location and the obtained identifier and weight of each operator, a line identifier corresponding to the first information comprises:
calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers;
and searching in a preset mapping table to obtain a line identifier corresponding to the first information identifier as the line identifier corresponding to the first information, wherein the mapping table is used for storing a mapping relation between the information identifier and the line identifier.
4. The method of claim 1, wherein after determining that the keyword matching the first information does not exist in the preset keyword table, the method further comprises:
generating a new keyword report, wherein the new keyword report is used for prompting a user whether a keyword matched with the first information is newly added;
and after receiving an instruction of confirming that the keyword matched with the first information is newly added, acquiring the keyword matched with the first information, and updating the keyword matched with the first information to the keyword list.
5. The method according to any one of claims 1 to 4, wherein a reference table is stored in the electronic device, wherein the reference table is used for storing each second information and an IP segment corresponding to each second information, and before the step of determining that the obtained line belongs to the first line to which the IP segment corresponding to the first information belongs, the method further comprises:
judging whether second information matched with the first information exists in all the second information or not as target second information; if yes, judging whether the IP section corresponding to the first information conflicts with the IP section corresponding to the target second information; and if the conflict exists, resetting the IP section corresponding to the first information as the IP section corresponding to the target second information.
6. The method according to any one of claims 1 to 4, wherein a reference table is stored in the electronic device, wherein the reference table is used for storing each second information and an IP section corresponding to each second information, and before the step of generating an IP library by using the determined each first line and the IP section belonging to the determined each first line, the method further comprises:
determining a second line to which the IP section corresponding to each piece of second information belongs;
judging whether a second line identical to the first line exists in all the determined second lines as a target second line aiming at each determined first line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, the IP segment belonging to the first line is reset to the IP segment belonging to the target second line.
7. The method of claim 1, wherein prior to the step of generating an IP library using the determined respective first lines and the IP segments attributed to the determined respective first lines, the method further comprises:
obtaining an IP segment range formed of IP segments belonging to the determined respective first lines;
verifying whether the IP section range is equal to a preset IP section range or not;
if so, a step of generating an IP library using the determined respective first lines and the IP sections belonging to the determined respective first lines is performed.
8. The method of claim 1, wherein prior to the step of generating an IP library using the determined respective first lines and the IP segments attributed to the determined respective first lines, the method further comprises:
and converting the representation form of the IP section belonging to the determined first line into a preset IP section representation form.
9. The method of claim 1, wherein after the step of generating an IP library using the determined respective first lines and the IP segments attributed to the determined respective first lines, the method further comprises:
generating the version number of the IP library;
backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a duplicate IP library; and marking the duplicate IP library with the version number.
10. An IP library generation apparatus, applied to an electronic device, the apparatus comprising:
the determining module is used for determining a first line to which the IP section corresponding to each piece of first information belongs in the corresponding relation recorded by the source IP library;
a generation module for generating an IP library by using the determined first lines and the IP sections belonging to the determined first lines;
the first information comprises a geographical position and/or an operator, and the corresponding relation is the corresponding relation between the first information and the IP section;
the determining module determines a first line to which an IP section corresponding to each piece of first information in the source IP library belongs through the following modes:
judging whether a keyword matched with the first information exists in a preset keyword table or not as a target keyword; the keyword table is used for storing keywords corresponding to lines of all dimensions, identifications and weights of geographic positions corresponding to the keywords, identifications and weights of operators, the weights of the geographic positions corresponding to the keywords are used for representing the matching degree of the geographic positions corresponding to the keywords and the lines corresponding to the keywords, and the weights of the operators corresponding to the keywords are used for representing the matching degree of the operators corresponding to the keywords and the lines corresponding to the keywords;
if yes, obtaining the identification and the weight of the geographic position corresponding to each target keyword and the identification and the weight of an operator from the keyword table; obtaining line identifications corresponding to the first information as first line identifications by using the obtained identifications and weights of the geographic positions and the identifications and weights of the operators;
searching in a preset line table to obtain a line corresponding to the first line identification, and determining that the obtained line is a first line to which the IP section corresponding to the first information belongs; the line table is used for storing the corresponding relation between the lines of all dimensions and the line identifications.
11. The apparatus of claim 10, wherein the determining module is further configured to:
and under the condition that the keyword matched with the first information does not exist in the preset keyword list, setting the line identification corresponding to the first information as a preset line identification, taking the preset line identification as the first line identification, and searching in the preset line list to obtain the first line corresponding to the first line identification.
12. The apparatus according to claim 10, wherein the determining module obtains the route identifier corresponding to the first information by using the obtained identifier and weight of each geographic location and the obtained identifier and weight of each operator, specifically:
calculating an information identifier corresponding to the first information as a first information identifier by using the identifier of the geographical position with the largest weight and the identifier of the operator with the largest weight in the obtained identifiers;
and searching in a preset mapping table to obtain a line identifier corresponding to the first information identifier as the line identifier corresponding to the first information, wherein the mapping table is used for storing a mapping relation between the information identifier and the line identifier.
13. The apparatus of claim 10, wherein the determining module is further configured to:
generating a new keyword report after judging that no keyword matched with the first information exists in a preset keyword table, wherein the new keyword report is used for prompting a user whether a keyword matched with the first information is added;
and after receiving an instruction of confirming that the keyword matched with the first information is newly added, acquiring the keyword matched with the first information, and updating the keyword matched with the first information to the keyword list.
14. The apparatus according to any one of claims 10-13, wherein the electronic device stores a reference table, wherein the reference table is configured to store the second information and the IP segment corresponding to each second information, and the determining module is further configured to:
before the obtained line is determined to be the first line to which the IP section corresponding to the first information belongs, judging whether second information matched with the first information exists in all the second information to serve as target second information; if yes, judging whether the IP section corresponding to the first information conflicts with the IP section corresponding to the target second information; and if the conflict exists, resetting the IP section corresponding to the first information as the IP section corresponding to the target second information.
15. The apparatus according to any one of claims 10-13, wherein the electronic device stores a reference table, wherein the reference table is configured to store the second information and the IP segment corresponding to each second information, and the determining module is further configured to:
determining a second line to which the IP section corresponding to each piece of second information belongs before generating an IP library by using each determined first line and the IP sections belonging to each determined first line;
judging whether a second line identical to the first line exists in all the determined second lines as a target second line aiming at each determined first line; if yes, judging whether the IP section belonging to the first line conflicts with the IP section belonging to the target second line; if so, the IP segment belonging to the first line is reset to the IP segment belonging to the target second line.
16. The apparatus of claim 10, wherein the generating module is further configured to:
obtaining an IP segment range formed by the IP segments belonging to the determined respective first lines before generating an IP library by using the determined respective first lines and the IP segments belonging to the determined respective first lines;
verifying whether the IP section range is equal to a preset IP section range or not;
and if so, generating an IP library by using each determined first line and the IP sections belonging to each determined first line.
17. The apparatus of claim 10, wherein the generating module is further configured to:
before generating an IP library using the determined first lines and the IP segments belonging to the determined first lines, converting the representation form of the IP segments belonging to the determined first lines into a preset IP segment representation form.
18. The apparatus of claim 10, wherein the generating module is further configured to:
generating a version number of the IP library after the IP library is generated using the determined respective first lines and the IP segments belonging to the determined respective first lines;
backing up each determined first line and the IP sections belonging to each determined first line in the IP library to obtain a duplicate IP library; and marking the duplicate IP library with the version number.
19. An electronic device, characterized in that the electronic device comprises: a processor and a memory, wherein,
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, is adapted to perform the method steps of any of claims 1-9.
20. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-9.
CN201810030614.2A 2018-01-12 2018-01-12 IP library generation method and device, electronic equipment and computer readable storage medium Active CN108573018B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810030614.2A CN108573018B (en) 2018-01-12 2018-01-12 IP library generation method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810030614.2A CN108573018B (en) 2018-01-12 2018-01-12 IP library generation method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108573018A CN108573018A (en) 2018-09-25
CN108573018B true CN108573018B (en) 2020-08-07

Family

ID=63575863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810030614.2A Active CN108573018B (en) 2018-01-12 2018-01-12 IP library generation method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN108573018B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114465979B (en) * 2021-12-21 2024-01-02 天翼云科技有限公司 IP library generation method, system and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177000B (en) * 2011-12-21 2016-06-15 卓望数码技术(深圳)有限公司 The group technology of IP address or phone number and the querying method of ownership place
CN103716282B (en) * 2012-09-28 2017-10-10 北京新媒传信科技有限公司 A kind of method and system in amendment IP storehouses
CN104427519B (en) * 2013-08-23 2019-01-11 深圳市腾讯计算机系统有限公司 IP address ownership place management method and device
CN103678676A (en) * 2013-12-25 2014-03-26 乐视网信息技术(北京)股份有限公司 IP library processing method and system
CN106302843B (en) * 2015-05-26 2019-08-06 上海帝联信息科技股份有限公司 A kind of IP address library update method and device

Also Published As

Publication number Publication date
CN108573018A (en) 2018-09-25

Similar Documents

Publication Publication Date Title
CN109214785B (en) Workflow implementation method, server and system
US10064044B2 (en) Method and apparatus for determining roaming status of terminal, terminal, and server
CN112328760B (en) Service providing method, device and system
US9112965B2 (en) Managing cellular phone calls
CN109982257B (en) Method, device and system for determining mobile user home region
CN109658120B (en) Service data processing method and device
CN112437148B (en) Service request processing method and device, service server and system
CN109739938A (en) A kind of correlating method, device and the equipment of more accounts
CN105989457A (en) Information query method and apparatus thereof
CN110519810B (en) Service relay switching method, terminal equipment, storage medium and device
CN108573018B (en) IP library generation method and device, electronic equipment and computer readable storage medium
CN113660359B (en) Domain name resolution record management method and device, storage medium and electronic equipment
CN113612632B (en) Topology identification method and device applied to gateway equipment, gateway equipment and medium
TW202024964A (en) User position determination method and apparatus, device, and computer readable storage medium
CN114025027A (en) Data transmission script running method and device, storage medium and electronic device
CN111078773A (en) Data processing method and device
CN115774584A (en) Data processing method and device, electronic equipment and storage medium
CN113468446B (en) Method, system and equipment for supporting identification of third party two-dimensional code data
CN106713581A (en) Communication number identification method, terminal and system
CN112749169A (en) Address tree construction method, address planning specification method, device and electronic equipment
CN111367634A (en) Information processing method, information processing device and terminal equipment
CN114785862B (en) Processing method and related device for custom routing information
CN112416401B (en) Data updating method, device and equipment
CN107480286B (en) Message processing method and trusted system
CN118210799A (en) Index switching method, device and computer readable 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