Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
An embodiment of the present invention provides a data processing method, which is mainly applied to a client side, and as shown in fig. 1, the method mainly includes:
101. and acquiring the domain name to be accessed and the current environment information of the terminal.
When a user wants to access a certain website on the client, the client can be triggered to access the website by clicking a link or inputting the website through a website input field. When a user clicks a link in a webpage or inputs a website in a website input field and the link is performed, the client can acquire a domain name to be accessed from the accessed website, and after the domain name is acquired, current environment information of the terminal is determined so as to search a required IP address based on the environment information.
Specifically, the environment information mainly includes a geographical location and a network type. The network types mainly include a 2G (The2rd Generation Telecommunication, second Generation mobile communication technology) network, a 3G (The 3rd Generation Telecommunication, third Generation mobile communication technology) network, a 4G (The 4rd Generation Telecommunication, fourth Generation mobile communication technology) network, and a WiFi (Wireless Fidelity) network.
102. And searching an IP address corresponding to the domain name and matched with the environmental information from a preset storage space.
Specifically, after determining the current environment information of the terminal to which the client belongs, the client may first search for the IP address corresponding to the domain name to be accessed from the preset storage space, and if the IP address corresponding to the domain name is searched from the preset storage space, search for the IP address matching the current environment information of the terminal from the searched IP address, so that after searching for the IP address matching both the two conditions, step 103 is executed.
103. And if the IP address is found, performing quality sequencing on the IP address based on a preset IP quality sequencing algorithm so as to perform connection operation according to the quality sequencing result after the quality sequencing result is obtained.
Specifically, if the IP address corresponding to the domain name to be accessed and matching with the current environment information of the terminal is found from the preset storage space, in order to enable the client to quickly and successfully establish connection with one of the IP addresses, quality sequencing is performed on the obtained IP addresses based on a preset IP quality sequencing algorithm, and then connection is sequentially tried to be established with the IP addresses with the quality from high to low according to the quality sequencing result until the connection with the one IP address is successful.
The data processing method provided by the embodiment of the invention can determine the current environment information of the terminal after obtaining the domain name to be accessed, then search the IP address corresponding to the domain name and matched with the environment information from the preset storage space, if the IP address is searched, perform quality sorting on the IP addresses based on the preset IP quality sorting algorithm, and perform connection operation according to the quality sorting result after obtaining the quality sorting result. Compared with the prior art that the IP address corresponding to the domain name in the preset storage space is directly used as the IP address to be connected, the IP address which simultaneously meets the two conditions of corresponding to the domain name to be accessed and matching with the environment information is determined as the IP address to be connected, so that the IP addresses acquired from the preset storage space are all the IP addresses which can be connected under the current environment (including the geographic position and the network type) of the terminal, and the phenomenon that the connection time is long and even the connection fails because the connection time is over is avoided when the IP address corresponding to the domain name stored in the preset storage space is not the IP address under the current environment of the terminal and is also connected with the IP addresses. Therefore, the invention can quickly acquire a group of IP addresses which are easy to connect by the client at present, and then try to connect in sequence according to the quality of the group of IP addresses, thereby further improving the efficiency of connecting the IP addresses.
Further, according to the embodiment shown in fig. 1, another embodiment of the present invention further provides a data processing method, as shown in fig. 2, the method mainly includes:
201. and acquiring the domain name to be accessed and the current environment information of the terminal.
202. And searching an IP address corresponding to the domain name and matched with the environmental information from a preset storage space.
The specific implementation manner of the step can be as follows:
and A1, searching the IP address corresponding to the domain name from the preset storage space.
And A2, if the IP address corresponding to the domain name is found, matching the environment information with a terminal environment identifier for describing the terminal environment information when the IP address is stored.
This step can be specifically subdivided into:
a1, obtaining the geographic position and network type in the terminal environment identification of the IP address.
a2, determining the position range corresponding to the geographic position according to a preset position range algorithm.
Since the IP addresses of the server are a group of the same IP addresses within a certain location range, when determining whether the geographic location in the terminal environment identifier matches the current geographic location of the terminal, it is necessary to determine the location range corresponding to the geographic location in the terminal environment identifier according to a preset location range algorithm, and then determine whether the current geographic location of the terminal is within the location range, thereby determining whether the current geographic location of the terminal matches the geographic location of the IP address corresponding to the domain name in the preset storage space.
For example, a circle determined by taking the geographic position in the terminal environment identifier as a center of a circle and taking a preset radius (for example, 5KM) as a radius may be used as the position range corresponding to the geographic position in the terminal environment identifier.
a3, judging whether the geographic position in the environment information is in the position range and whether the network type in the environment information is the same as the network type in the terminal environment identification.
a4, if the geographic position in the environment information is in the position range and the network type in the environment information is the same as the network type in the terminal environment identifier, determining that the environment information is successfully matched with the terminal environment identifier of the IP address; and if the geographic position in the environment information is not in the position range or the network type in the environment information is different from the network type in the terminal environment identifier, determining that the environment information is unsuccessfully matched with the terminal environment identifier of the IP address.
Illustratively, the preset storage space stores IP addresses corresponding to 4 domain names to be accessed, which are IP1, IP2, IP3 and IP4, respectively. Wherein, the terminal environment of the IP1 is identified as "geographical location: beijing station; the network type: WiFi ", the terminal environment of IP2 is identified as" geographical location: a Shijiazhuang station; the network type: 4G ", the terminal environment of IP3 is identified as" geographical location: beijing west station; the network type: WiFi "and IP4 are identified as" geographical location: hangzhou West lake; the network type: 2G'. The current environment information of the terminal is' geographical position: three miles; the network type: and WiFi' respectively determining the position range corresponding to the geographic position in the terminal environment identifier of each IP address, then respectively matching the geographic position and the network type in the current environment information of the terminal with the position range and the network type corresponding to each IP address, and finally determining that the matching of IP1 and IP3 is successful and the matching of IP2 and IP4 is failed.
And A3, determining the IP address successfully matched as the IP address corresponding to the domain name and matched with the environment information.
In addition, the preset storage space comprises a memory and/or a database. When only the IP address is stored in the memory or the database, the client may directly search for the IP address corresponding to the domain name to be accessed and matching the environment information from the memory or the database. When the preset storage space for storing the IP address comprises a memory and a database, the client can firstly search the IP address from the memory; if the IP address is searched from the memory, the IP address is directly obtained from the memory; and if the IP address is not searched from the memory, performing secondary search from a database.
203. And if the IP address is found, performing quality sequencing on the IP address based on a preset IP quality sequencing algorithm so as to perform connection operation according to the quality sequencing result after the quality sequencing result is obtained.
The specific implementation manner of performing quality sequencing on the IP addresses based on a preset IP quality sequencing algorithm is as follows: acquiring a weight value of each dimension in a preset dimension set and a dimension value of each dimension corresponding to the IP address; calculating the quality of the IP address according to a preset quality calculation formula, the dimension value of each dimension and the weight value of each dimension; after the quality of each IP address is obtained, a quality sorting operation is performed.
The preset dimensionality set comprises a Time To Live (TTL) value, historical speed measurement success times, historical speed measurement failure times, last connection success Time and actual connection success times.
Specifically, the TTL value is a connection establishment duration, the larger the TTL value is, the smaller the connection speed is, and the worse the IP quality is, and since the TTL value can basically determine whether a corresponding IP address can be successfully connected when a subsequent client performs a connection operation, the weight value of the TTL value in the above dimension is large, for example, may be 50%. In practical application, the client can measure the speed of each IP address stored in the preset storage space at regular time to obtain a corresponding TTL value; when the speed measurement is successful once, the historical speed measurement success frequency is accumulated by 1, and when the speed measurement is failed once, the historical speed measurement failure frequency is accumulated by 1; the TTL value of the number of successful historical speed tests is smaller than the weighted value of the number of failed historical speed tests, and may be, for example, 10%. The last successful connection time is the time of successfully connecting a certain IP address for the last time; after the user feeds back that a certain IP address is successfully connected, the last successful connection time is updated to be the feedback time; the smaller the difference between the time when the quality sorting is performed and the last connection success time is, the higher the IP address quality is, and the weight value of the dimension may be 10%. The actual connection success times are the accumulated times of successfully connecting a certain IP address fed back by the user, namely after the user knows that the certain IP address is successfully connected, the user feeds back the IP address to the client through the client interface, and after the client obtains the IP address, the actual connection success times corresponding to the IP address are added by 1; since the actual connection success frequency can reflect the actual situation of the connection operation performed by the client and the IP address corresponding to a certain domain name, the weight of the actual connection success frequency is greater than the historical speed measurement success frequency, the historical speed measurement failure frequency, and the like, and may be 20%, for example.
In practical application, the calculation method of the preset mass calculation formula mainly comprises the following steps: and firstly, calculating the quality score of each dimension according to the dimension value and the weight value of each dimension, and then summing the quality scores of the dimensions to obtain the final quality of the IP address.
For example, the quality score of the number of successful actual connections may be calculated by:wherein n isxFor the actual number of successful connections of the current IP address, nmaxThe maximum value of the actual connection success times in all the IP addresses to be sequenced is defined, m is the weighted value of the actual connection success times, such as when nxIs 5, nmax50, m is 20%, the quality score of the actual connection success times is 2.
It should be noted that, compared with the prior art, the embodiment of the present invention increases the dimension of the number of times of successful actual connection, so that the IP quality ranking result is more accurate.
In addition, the cloud server can monitor the actual connection condition of each client, increase or reduce dimensionality according to the actual connection condition of each client, or adjust the weighted value of the existing dimensionality, and issue an update instruction carrying the dimensionality information to each client; after the client receives the update instruction sent by the cloud server, the preset dimension set and/or the weighted value of the dimensions can be updated according to the dimension information carried in the update instruction, so that the accuracy of quality sequencing is improved, and the efficiency of connecting the subsequent clients with the IP addresses is improved.
204. And if the IP address is not found, sending a domain name resolution request carrying the domain name to a domain name resolution server.
The domain name resolution server may be a domain name resolution server of an operator, or a domain name resolution server specially serving the client.
When the client determines that there is no IP address corresponding to the domain name and matching the environmental information in the preset storage space, a domain name resolution request carrying the domain name may be sent to the domain name resolution server, so that the domain name resolution server resolves the domain name after receiving the domain name resolution request, and obtains a corresponding IP address.
205. And receiving the IP address corresponding to the domain name sent by the domain name resolution server.
206. And performing quality sequencing on the received IP addresses based on the preset IP quality sequencing algorithm so as to perform connection operation according to the quality sequencing result after obtaining the quality sequencing result.
This step is consistent with the specific implementation manner of step 203, and is not described herein again.
Furthermore, since the storage space of the terminal is limited, the preset storage space needs to be cleaned regularly or irregularly, so as to reduce the burden of the terminal and ensure the normal operation of the terminal. Therefore, the client can clear the IP address in the preset storage space according to the preset clearing rule.
Specifically, as some domain names are not visited again after being visited for one or two times, the unused IP addresses in the preset time period can be cleared; because the client tries to connect according to the sequence of the quality of the IP addresses from high to low, the client can successfully connect a certain IP address with higher quality under the general condition without trying to connect the IP address with lower quality, and the IP address with the quality smaller than a preset threshold value can be cleaned; because the IP address of the server may be changed, the client may also delete the IP address whose storage duration is greater than the preset duration threshold, so as to subsequently obtain the latest IP address corresponding to the same domain name from the domain name resolution server side.
In addition, for the same domain name, since servers corresponding to different network types may be the same in a certain location range, or a location range including the same group of IP addresses determined by the client is smaller than an actual location range, IP addresses having the same IP address content and different terminal environment identifiers may appear in a preset storage space, and thus, a plurality of the same IP addresses in the preset storage space may be cleared into one IP address, and the terminal environment identifiers having the same IP addresses are merged.
For example, 3 IPs 4 (e.g. 192.168.1.1) are stored in the preset storage space, and the terminal environment identifiers of the respective IPs 4 are "geographical location: the rising area of Beijing; the network type: WiFi "," geographic location: the rising area of Beijing; the network type: 3G "and" geographic location: the Hai lake district of Beijing; the network type: 3G ", 2 192.168.1.1 can be deleted, and then 3 terminal environment identities are merged into: "geographical location: the Chaoyang district of Beijing and the Hai lake district of Beijing; the network type: WiFi and 3G ".
Further, according to the above method embodiment, another embodiment of the present invention further provides a data processing apparatus, as shown in fig. 3, the apparatus mainly includes: an acquisition unit 31, a lookup unit 32, and a sorting unit 33. Wherein,
an obtaining unit 31, configured to obtain a domain name to be accessed and current environment information of a terminal;
a searching unit 32, configured to search, from a preset storage space, an internet protocol IP address that corresponds to the domain name and matches the environment information;
a sorting unit 33, configured to, when the IP address is found by the finding unit 32, perform quality sorting on the IP address based on a preset IP quality sorting algorithm, so as to perform a connection operation according to a quality sorting result after the quality sorting result is obtained.
The data processing device provided by the embodiment of the invention can determine the current environment information of the terminal after obtaining the domain name to be accessed, then search the IP address corresponding to the domain name and matched with the environment information from the preset storage space, if the IP address is searched, perform quality sorting on the IP addresses based on the preset IP quality sorting algorithm, and perform connection operation according to the quality sorting result after obtaining the quality sorting result. Compared with the prior art that the IP address corresponding to the domain name in the preset storage space is directly used as the IP address to be connected, the IP address which simultaneously meets the two conditions of corresponding to the domain name to be accessed and matching with the environment information is determined as the IP address to be connected, so that the IP addresses acquired from the preset storage space are all the IP addresses which can be connected under the current environment (including the geographic position and the network type) of the terminal, and the phenomenon that the connection time is long and even the connection fails because the connection time is over is avoided when the IP address corresponding to the domain name stored in the preset storage space is not the IP address under the current environment of the terminal and is also connected with the IP addresses. Therefore, the invention can quickly acquire a group of IP addresses which are easy to connect by the client at present, and then try to connect in sequence according to the quality of the group of IP addresses, thereby further improving the efficiency of connecting the IP addresses.
Further, as shown in fig. 4, the apparatus further includes:
a sending unit 34, configured to send a domain name resolution request carrying the domain name to a domain name resolution server when the IP address is not found by the searching unit 32;
a first receiving unit 35, configured to receive an IP address corresponding to the domain name sent by the domain name resolution server;
the sorting unit 33 is further configured to perform quality sorting on the IP addresses received by the first receiving unit based on the preset IP quality sorting algorithm, so as to perform a connection operation according to a quality sorting result after the quality sorting result is obtained.
Further, as shown in fig. 4, the apparatus further includes:
an adding unit 36, configured to add a terminal environment identifier including the environment information to the received IP address after the first receiving unit 35 receives the IP address corresponding to the domain name sent by the domain name resolution server;
the storage unit 37 is configured to store the IP address and the domain name obtained after the terminal environment identifier is added by the adding unit 36 in the preset storage space.
Further, as shown in fig. 4, the search unit 32 includes:
a searching subunit 321, configured to search, from the preset storage space, an IP address corresponding to the domain name;
a matching subunit 322, configured to, when the searching subunit 321 finds the IP address corresponding to the domain name, match the environment information with a terminal environment identifier used for describing the terminal environment information when the IP address is stored;
a determining subunit 323, configured to determine, as the IP address corresponding to the domain name and matching the environment information, the IP address successfully matched by the matching subunit 322.
Further, as shown in fig. 4, the matching subunit 322 includes:
an obtaining module 3221, configured to obtain a geographic location and a network type in the terminal environment identifier of the IP address;
the determining module 3222 is configured to determine, according to a preset location range algorithm, a location range corresponding to the geographic location acquired by the acquiring module 3221;
a determining module 3223, configured to determine whether the geographic location in the environment information is within the location range and whether the network type in the environment information is the same as the network type in the terminal environment identifier;
the determining module 3222 is further configured to determine that, when the determination result of the determining module 3223 is that the geographic location in the environment information is within the location range and the network type in the environment information is the same as the network type of the IP address, the environment information is successfully matched with the terminal environment identifier in the terminal environment identifier, and when the determination result of the determining module 3223 is that the geographic location in the environment information is not within the location range or the network type in the environment information is different from the network type of the IP address, it is determined that the environment information is unsuccessfully matched with the terminal environment identifier in the terminal environment identifier.
Further, as shown in fig. 4, the apparatus further includes:
and a cleaning unit 38, configured to clean the IP address in the preset storage space according to a preset cleaning rule.
Further, as shown in fig. 4, the cleaning unit 38 includes:
a first cleaning subunit 381 configured to clean an IP address that is not used within a preset time period;
a second cleaning subunit 382, configured to clean an IP address whose quality is smaller than a preset threshold;
a third cleaning subunit 383, configured to clean the IP address whose storage duration is greater than the preset duration threshold;
and the duplicate removal subunit 384 is configured to perform duplicate removal processing on the IP addresses in the preset storage space, where the duplicate removal processing is configured to clean up a plurality of same IP addresses into one IP address, and merge terminal environment identifiers of the plurality of same IP addresses.
Further, as shown in fig. 4, the sorting unit 33 includes:
an obtaining subunit 331, configured to obtain a weight value of each dimension in a preset dimension set and a dimension value of each dimension corresponding to the IP address, where the preset dimension set includes a time to live TTL value, a historical speed measurement success number, a historical speed measurement failure number, a last connection success time, and an actual connection success number;
a calculating subunit 332, configured to calculate a quality of the IP address according to a preset quality calculation formula, a dimension value of each dimension, and a weight value of each dimension;
a sorting subunit 333, configured to perform a quality sorting operation after obtaining the quality of each IP address.
Further, as shown in fig. 4, the apparatus further includes:
a second receiving unit 39, configured to receive an update instruction sent by the cloud server;
an updating unit 310, configured to update the preset dimension set and/or the weight value of a dimension according to the dimension information carried in the update instruction received by the second receiving unit 310.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the method and apparatus described above are referred to one another. In addition, "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent merits of the embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of a data processing apparatus according to an embodiment of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.