Domain name proxy method and device of mobile terminal, mobile terminal and storage medium

By setting up a domain name proxy device and resolution library at the system service layer of the mobile terminal, the problem of traffic surge caused by repeated domain name resolution of multiple applications is solved, and the traffic cost is reduced and the resolution speed is improved.

CN120639743APending Publication Date: 2025-09-12GUANGZHOU XIAOPENG MOTORS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510920209.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

When multiple applications on a mobile terminal request resolution for the same domain name, traffic surges, increases traffic costs, and is not conducive to traffic management.

Method used

A domain name proxy device is set up in the system service layer of the mobile terminal, and the domain name resolution library is used to store the correspondence between domain names and IP addresses. Through inter-process communication, multiple applications can share the locally stored resolution results to avoid repeated requests.

Benefits of technology

It reduces traffic costs, increases domain name resolution speed, reduces traffic consumption, and improves traffic management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120639743A_ABST
    Figure CN120639743A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a domain name proxy method and device for a mobile terminal, the mobile terminal and a storage medium, and the method comprises the steps: receiving an HTTPDNS request message sent by a target application, and enabling the HTTPDNS request message to carry a target domain name; judging whether a target IP address corresponding to the target domain name is found in a domain name resolution library or not; the domain name resolution library is used for storing the corresponding relationship between the domain name and the IP address; when the target IP address is found in the domain name resolution library, a first response message is returned to the target application, and the first response message carries the target IP address; the IP address is stored through the locally cached domain name resolution library, and can be shared to all applications of the application layer, so that the flow cost is reduced, and the domain name resolution speed can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology for mobile terminals, and in particular to a domain name proxy method and device for a mobile terminal, a mobile terminal, and a storage medium. Background Art

[0002] The HTTP-based Domain Name System (HTTPDNS) can directly send domain name resolution requests to an HTTPDNS server via the HTTP protocol, bypassing traditional local DNS servers and reducing the risk of DNS hijacking. For example, when an application on a mobile terminal accesses a webpage, it first obtains the webpage's domain name, generates an HTTPDNS request based on the domain name, and sends the HTTPDNS request, which carries the domain name, to the HTTPDNS server to obtain the IP address corresponding to the domain name. The IP address is then returned to the application on the mobile terminal, allowing it to access the webpage via the IP address.

[0003] In actual application, it is found that when each application in the mobile terminal requests to access a web page, it needs to request domain name resolution from the HTTPDNS server to obtain the IP address. If multiple applications request resolution for the same domain name, each application will send a request, causing a surge in traffic, increasing traffic costs, and hindering traffic management. Summary of the Invention

[0004] The embodiments of the present application disclose a domain name proxy method, device, mobile terminal and storage medium for a mobile terminal, which are beneficial to reducing traffic costs and improving domain name resolution processing speed.

[0005] In a first aspect, an embodiment of the present application discloses a domain name proxy method for a mobile terminal, which is applied to a domain name proxy device of a mobile terminal, wherein the domain name proxy device of the mobile terminal is arranged in a system service layer of the mobile terminal, and the method includes:

[0006] Receive an HTTP DNS request message sent by a target application, wherein the HTTP DNS request message carries a target domain name;

[0007] Determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library; the domain name resolution library is used to store the correspondence between domain names and IP addresses;

[0008] When the domain name resolution library finds the target IP address, a first response message is returned to the target application, where the first response message carries the target IP address.

[0009] In a second aspect, an embodiment of the present application discloses a domain name proxy device for a mobile terminal, wherein the domain name proxy device for the mobile terminal is provided at a system service layer of the mobile terminal, and includes:

[0010] A communication module, configured to receive an HTTP / DNS request message sent by a target application, wherein the HTTP / DNS request message carries a target domain name;

[0011] A cache management module, configured to determine whether a target IP address corresponding to the target domain name is found in a domain name resolution library; the domain name resolution library is configured to store the correspondence between domain names and IP addresses;

[0012] The communication module is further configured to return a first response message to the target application when the domain name resolution library finds the target IP address, where the first response message carries the target IP address.

[0013] In a third aspect, an embodiment of the present application discloses a mobile terminal, which may include:

[0014] a memory storing executable program code;

[0015] a processor coupled to the memory;

[0016] The processor calls the executable program code stored in the memory to execute a domain name proxy method for a mobile terminal disclosed in the first aspect of the embodiment of the present application.

[0017] In a fourth aspect, an embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute a domain name proxy method for a mobile terminal disclosed in the first aspect of the embodiment of the present application.

[0018] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0019] In an embodiment of the present application, a domain name proxy device is provided at the system service layer of the mobile terminal to receive an HTTPDNS request message sent by a target application, the HTTPDNS request message carries the target domain name, and determines whether the target IP address corresponding to the target domain name is found in the domain name resolution table. The domain name resolution table is used to store the correspondence between domain names and IP addresses. When the target IP address corresponding to the target domain name is found in the domain name resolution library, a first response message is returned to the target application, and the first response message carries the target IP address. It can be seen that in an embodiment of the present application, a domain name proxy device of the mobile terminal is provided at the system service layer of the mobile terminal, and a domain name resolution library is provided to store the correspondence between domain names and IP addresses. Therefore, when the target application of the mobile terminal requests to resolve the domain name, it will first search in the domain name resolution library, so that multiple applications in the mobile terminal share the locally stored domain name resolution results (IP addresses). Different applications do not need to repeatedly request resolution of the same domain name from the corresponding server of the domain name, which can reduce the number of requests, thereby reducing traffic costs, and improving the domain name resolution speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0021] Figure 1 This is a system architecture diagram of the domain name proxy method for a mobile terminal disclosed in an embodiment of the present application;

[0022] Figure 2 This is a flow chart of the domain name proxy method for a mobile terminal disclosed in Example 1 of the present application;

[0023] Figure 3 This is a flow chart of the domain name proxy method for a mobile terminal disclosed in Example 2 of this application;

[0024] Figure 4 This is a flow chart of the domain name proxy method for a mobile terminal disclosed in Example 3 of this application;

[0025] Figure 5 This is a structural diagram of the domain name proxy device for a mobile terminal disclosed in Example 1 of the present application;

[0026] Figure 6 This is a schematic diagram of the structure of the mobile terminal disclosed in the embodiment of the present application. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0028] It should be noted that the terms "first," "second," "third," and "fourth" in the specification and claims of this application are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having," as well as any variations thereof, in the embodiments of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatuses.

[0029] The Domain Name System (DNS) is a core service of the Internet. It converts domain names into Internet Protocol (IP) addresses that computers can recognize. IP addresses are used for communication on the Internet and are a string of numbers, such as 192.168.1.1. In order to solve the problem of difficult to remember IP addresses, DNS came into being. DNS allows users to use easy-to-remember domain names (such as www.xiao.com) to visit websites. The DNS system will convert domain names into corresponding IP addresses.

[0030] HTTPDNS is an optimization and supplementary solution for DNS resolution technology. It sends domain name resolution requests directly to the HTTPDNS server through the HTTP protocol. The HTTPDNS server will return an optimal IP address for the user based on the user's geographic location, network type and other information, combined with its own IP address library. If its own IP address library is not found, it will initiate a standard DNS query to the superior DNS server to obtain the resolution result. The resolution result carries the IP address, and then returns it to the mobile terminal in sequence.

[0031] Binder inter-process communication (Binder IPC) is a very important inter-process communication mechanism in the Android system. Binder IPC adopts a client / server (C / S) architecture, with the process providing the service acting as the server and the process requesting the service acting as the client. In addition, there is a Binder driver, which is the core of the entire mechanism and runs in kernel space. It is responsible for managing Binder devices and handling inter-process communication requests.

[0032] See also Figure 1 , Figure 1 This is a system architecture diagram of the domain name proxy method for a mobile terminal disclosed in an embodiment of the present application; Figure 1 As shown, Figure 1 Taking the mobile terminal as an Android system as an example, a domain name proxy device (hereinafter referred to as the device) of the mobile terminal is set in the system service layer of the Android system. As the server of the system architecture, a cache management module and an application programming interface (Application Programming Interface, API) are correspondingly set. The cache management module is used to manage the domain name resolution library in the local memory of the mobile terminal. The domain name resolution library is used to store the resolved domain name and the corresponding IP address. The API interface can realize direct communication between the device and the HTTPDNS server, and the device and HTTPDNS communicate through HTTP. Each application in the application layer acts as a client, and a domain name resolution module is set. Figure 1In the figure, application 1, application 2, and application 3 of the application layer are taken as an example. Based on Binder IPC, the device communicates with each application. First, when the process corresponding to the device is started, it registers the domain name proxy service provided by itself with the Binder driver. The Binder driver will assign a unique identifier (Binder reference) to the device and return it to the device process. If the application of the application layer needs to use the domain name proxy service provided by the device, it will request the Binder driver to obtain the Binder reference of the service through the domain name resolution module. The Binder driver will pass the Binder reference corresponding to the device to the application according to the application's request. After the application obtains the Binder reference, it sends an HTTPDNS request message to the device through the Binder reference. The device will use the cache management module to search the domain name resolution library for the IP address corresponding to the domain name carried in the HTTPDNS request message, and then it can return the IP address to the application. Among them, the IP address stored in the domain name resolution library is obtained by requesting the HTTPDNS server when the device receives the HTTPDNS request message for the domain name for the first time, and then cached in the domain name resolution library corresponding to the IP address. Later, when other applications also send HTTPDNS request messages for the domain name, the device can find the IP address corresponding to the domain name in the domain name resolution library and quickly return it to the application. There is no need to send domain name resolution requests to the HTTPDNS server, which can reduce traffic and reduce costs. For example, when 10 applications request resolution for the same domain name in succession, the corresponding IP address is obtained and saved in the domain name resolution library when the first application requests resolution. Then, there is no need to repeatedly request resolution from the HTTPDNS server for the other 9 applications, which can reduce traffic by 90%, reduce traffic costs, and also increase the speed of domain name resolution processing.

[0033] In combination with the above introduction, the embodiments of the present application disclose a domain name proxy method, device, mobile terminal and storage medium for a mobile terminal, which is conducive to reducing traffic costs and improving domain name resolution processing speed. The technical solution of the present application will be described in detail below through specific embodiments.

[0034] See also Figure 2 , Figure 2 This is a flow chart of the domain name proxy method for a mobile terminal disclosed in Example 1 of this application; Figure 2 As shown, the domain name proxy method of the mobile terminal may include:

[0035] 201. Receive an HTTP DNS request message sent by a target application, where the HTTP DNS request message carries a target domain name.

[0036] The execution subject of the embodiment of the present application is the domain name proxy device of the mobile terminal. The domain name proxy device of the mobile terminal can be set in the system service layer of the mobile terminal. For example, the mobile terminal can be a mobile smart phone, a smart watch, a smart bracelet, etc. The mobile terminal can use the Android system, the iOS system, or the Hongmeng (HarmonyOS) system. The target application is any application in the application layer of the mobile terminal. For example, when the mobile terminal uses the Android system, it can be as follows: Figure 1 As shown in the system architecture, the domain name proxy device of the mobile terminal is Figure 1 The device shown serves as a server in the system service layer, and each application in the application layer serves as an independent client. The device is used to provide local domain name proxy services for all applications in the application layer.

[0037] Among them, the target application of the application layer (any application in the application layer) requires the device to provide domain name proxy service, sends an HTTPDNS request message to the device, and carries the target domain name in the HTTPDNS request message. The HTTPDNS request message is used to request the IP address corresponding to the target domain name.

[0038] 202. Determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library; the domain name resolution library is used to store the correspondence between domain names and IP addresses; when the domain name resolution library finds the target IP address, execute step 203; when the domain name resolution library does not find the target IP address, end this process.

[0039] The domain name resolution library is set in the local memory of the mobile terminal, that is, cached in the local memory, and the domain names queried by the application and the IP addresses are stored in the domain name resolution library. In the embodiment of the present application, by caching the domain names and IP addresses in a corresponding manner in the memory of the mobile terminal, the domain name resolution library can be shared when other applications send HTTPDNS request messages for the same domain name.

[0040] 203. Return a first response message to the target application, where the first response message carries the target IP address.

[0041] After finding the IP address corresponding to the target domain name in the domain name resolution library, the target IP address is directly obtained from the domain name resolution library and then carried in the first response message and returned to the target application.

[0042] Optionally, after receiving the first response message, the target application obtains the target IP address from the first response message, and accesses the corresponding website through the target IP address, thereby sharing the IP address across applications through the domain name resolution library in the memory, reducing the traffic caused by applying for domain name resolution upward, reducing traffic costs, and also helping to improve domain name resolution efficiency.

[0043] Optionally, the domain name resolution library can also be synchronously saved to the local disk of the mobile terminal. By utilizing the persistent storage feature of the disk, the domain name resolution library can be obtained from the local disk and cached in the memory after the process is restarted, without having to resend the HTTPDNS request message to the HTTPNS server to obtain the IP address.

[0044] It can be seen that, in the implementation of the embodiment of the present application, a domain name proxy device set at the system service layer of the mobile terminal receives an HTTPDNS request message sent by the target application, the HTTPDNS request message carries the target domain name, and determines whether the target IP address corresponding to the target domain name is found in the domain name resolution table. The domain name resolution table is used to store the correspondence between domain names and IP addresses. When the target IP address corresponding to the target domain name is found in the domain name resolution library, a first response message is returned to the target application, and the first response message carries the target IP address. It can be seen that in the embodiment of the present application, a domain name proxy device of the mobile terminal is set at the system service layer of the mobile terminal, and a domain name resolution library is set to store the correspondence between domain names and IP addresses. Therefore, when the target application of the mobile terminal requests to resolve the domain name, it will first search in the domain name resolution library, so that multiple applications in the mobile terminal share the locally stored domain name resolution results (IP address). Different applications do not need to repeatedly request resolution of the same domain name to the corresponding server of the domain name, which can reduce the number of requests, thereby reducing traffic costs, and improving the domain name resolution speed.

[0045] See also Figure 3 , Figure 3 This is a flow chart of a domain name proxy method for a mobile terminal disclosed in Example 2 of the present application. The domain name proxy method for a mobile terminal is applied to a domain name proxy device for a mobile terminal, which is provided at a system service layer of the mobile terminal. The method may include:

[0046] 301. Receive an HTTPDNS request message sent by a target application through inter-process communication, where the HTTPDNS request message carries a target domain name.

[0047] The execution subject of the embodiment of the present application is a domain name proxy device of a mobile terminal, and the domain name proxy device of the mobile terminal can be set in the system service layer of the mobile terminal.

[0048] Among them, the device is set at the system service layer. When the target application sends an HTTPDNS request message to the device, the application process will send the HTTPDNS request message to the device through inter-process communication. Correspondingly, the device receives the HTTPDNS request message sent by the target application through inter-process communication.

[0049] For example, when the mobile terminal uses the Android system, the inter-process communication method can be Binder IPC, such as Figure 1 In the system architecture diagram shown, at the beginning, the device process starts and registers its domain name proxy service with the Binder driver. The Binder driver assigns a unique identifier (Binder reference) to the device and returns it to the device. When the target application wants to send an HTTP DNS request message, it first requests the Binder driver to obtain the Binder reference, then sends the HTTP DNS request message to the device using the Binder reference. In response, the device receives the HTTP DNS request message based on the Binder reference.

[0050] 302. Determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library; the domain name resolution library is used to store the correspondence between domain names and IP addresses; when the target IP address is found in the domain name resolution library, execute step 303; when the target IP address is not found in the domain name resolution library, execute step 304.

[0051] Optional, see Figure 1 A cache management module is provided in the device, and the cache management module in the device is used to determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library.

[0052] 303. Return a first response message to the target application through inter-process communication, where the first response message carries the target IP address.

[0053] Optionally, after finding the target IP address corresponding to the target domain name, the target IP address is carried in the first response message, and the device sends the first response message to the target application based on the Binder reference obtained by applying to the Binder driver.

[0054] 304. Send an HTTPDNS resolution request to the HTTPDNS server, where the HTTPDNS resolution request carries the target domain name.

[0055] In this embodiment of the present application, when the domain name resolution library fails to find the IP address, the device will send an HTTPDNS resolution request to the HTTPDNS server, and the HTTPDNS resolution request carries the target domain name.

[0056] Correspondingly, in the HTTPDNS server, the HTTPDNS server will first search the local IP address library to see whether there is a target IP address corresponding to the target domain name. If so, it will send a second response message carrying the target IP address to the device and execute step 305. If not, the HTTPDNS server will send the HTTPDNS resolution request to the superior DNS server, and the DNS server will resolve the target domain name, obtain the corresponding IP address list, and return it to the HTTPDNS server. The HTTPDNS server will select the IP address that meets the preset conditions (such as the preset condition is the best network status) and carry it in the second response message, and execute step 305.

[0057] Further optionally, in the IP address list sent by the DNS server, each IP address corresponds to network status information. After receiving the IP address list, the HTTPDNS server selects the IP address with the best network status from the IP address list according to the network status information (usually only one is selected), carries it in the second response message, and sends it to the device.

[0058] The above implementation method is helpful to ensure the success rate of applications accessing websites through IP addresses.

[0059] Optional, see Figure 1 , an API interface is also set in the device, and an HTTPDNS resolution request is sent to the HTTPDNS server through the API interface.

[0060] 305. Receive a second response message sent by the HTTPDNS server, where the second response message carries a target IP address corresponding to the target domain name.

[0061] Optional, see Figure 1 , the device will receive a second response message from the HTTPDNS server through the API interface, and the second response message carries the target IP address corresponding to the target domain name.

[0062] 306. Forward the second response message to the target application through inter-process communication.

[0063] In steps 305 and 306, the device receives the second response message and forwards the second response message to the target application. Thereafter, the device forwards the second response message to the target application based on the Binder reference obtained from the Binder driver application.

[0064] Correspondingly, the target application can obtain the target IP address from the second response message and access the corresponding website based on the target IP address.

[0065] Optional, see Figure 1The inter-process communication method can be Binder IPC, and the second response message is sent to the target application through the Binder reference.

[0066] 307. Obtain the target IP address from the second response message.

[0067] In step 307, after receiving the second response message, the device obtains the target IP address from the second response message.

[0068] 308. Establish a correspondence between the target IP address and the target domain name according to a preset corresponding format, and store them in a domain name resolution library.

[0069] The preset corresponding format may be <domain name, IP address>, and according to the preset corresponding format, the target domain name and the corresponding target IP address are stored in the domain name resolution library.

[0070] It can be seen from steps 307 and 308 that if the target IP address corresponding to the target domain name cannot be found in the domain name resolution library cached in the local memory, it is necessary to send an HTTPDNS resolution request to the HTTPDNS server, and the HTTPDNS server obtains the target IP address corresponding to the target domain name and then returns it to the device. After the device saves it, if other applications send HTTPDNS request messages for the same domain name to the device, the device can quickly find the corresponding IP address from the domain name resolution library and provide it to the application, thereby realizing the sharing of domain name resolution results (IP addresses) across applications in the mobile terminal.

[0071] For example, if 10 applications request IP addresses for the same domain name in succession, the first application needs to request the IP address from the HTTPDNS server, which consumes traffic once. The subsequent 9 applications do not need to send requests to the HTTPDNS server when requesting IP addresses for the domain name, and do not need to consume traffic, thereby reducing traffic consumption by 90%.

[0072] Therefore, in implementing the embodiments of the present application, a domain name proxy device of the mobile terminal is set at the system service layer of the mobile terminal, and a domain name resolution library is set to store the correspondence between domain names and IP addresses. Therefore, when the target application of the mobile terminal requests to resolve the domain name, it will first search in the domain name resolution library, so that multiple applications in the mobile terminal can share the locally stored domain name resolution results (IP address). Different applications do not need to repeatedly request resolution of the same domain name to the corresponding server of the domain name, which can reduce the number of requests, thereby reducing traffic costs and improving the domain name resolution speed.

[0073] See also Figure 4 , Figure 4This is a flow chart of the domain name proxy method for a mobile terminal disclosed in Example 3 of this application; Figure 4 In the embodiment, the domain name proxy method of the mobile terminal is applied to a domain name proxy device of the mobile terminal, and the domain name proxy device of the mobile terminal is set in the system service layer of the mobile terminal. The method includes:

[0074] 401. Receive an HTTP DNS request message sent by a target application, where the HTTP DNS request message carries a target domain name.

[0075] The execution subject of the embodiment of the present application is a domain name proxy device of a mobile terminal, and the domain name proxy device of the mobile terminal can be set in the system service layer of the mobile terminal.

[0076] 402. Determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library; the domain name resolution library is used to store the correspondence between domain names and IP addresses; wherein, when the domain name resolution library finds the target IP address, execute step 403; when the domain name resolution library does not find the target IP address, execute step 404.

[0077] 403. Return a first response message to the target application, where the first response message carries the target IP address.

[0078] 404. Send an HTTPDNS resolution request to the HTTPDNS server, where the HTTPDNS resolution request carries the target domain name.

[0079] 405. Receive a second response message sent by the HTTPDNS server, where the second response message carries the target IP address corresponding to the target domain name;

[0080] 406. Forward the second response message to the target application.

[0081] 407. Obtain the target IP address from the second response message;

[0082] 408. Obtain the cache validity period of the target IP address from the second response message. The cache validity period is used to indicate the validity period of the target IP address in the local cache.

[0083] In an embodiment of the present application, the domain name resolution library supports a time-to-live (TTL) expiration mechanism, which is obtained from the HTTPDNS server. The HTTPDNS server also carries the cache validity period of the target IP address in the second response message, that is, a TTL, indicating the length of time the target IP address can be cached in the mobile terminal, usually in seconds.

[0084] 409. According to a preset corresponding format, a corresponding relationship is established between the target IP address, cache validity period and target domain name, and the corresponding relationship is stored in a domain name resolution library.

[0085] Optionally, the preset corresponding format may also be <domain name, IP address, cache validity period>. After receiving the cache validity period, the target domain name, target IP address and cache validity period are correspondingly saved in the domain name resolution library.

[0086] In some optional implementations, the storage time of the target IP address in the domain name resolution library is detected; a determination is made as to whether the storage time matches the cache validity time; if so, the corresponding relationship of the target domain name is deleted from the domain name resolution library.

[0087] In the above embodiment, the storage time of a certain IP address in the domain name resolution library being cached in the mobile terminal is also detected in real time. The storage time generally starts when the HTTPDNS server sends the second response message, and then counts to a time length obtained by the current time. If the storage time obtained by timing is exactly equal to the cache validity period in the domain name resolution library, the corresponding correspondence is deleted from the domain name resolution library.

[0088] Further optionally, when the HTTPDNS server sends a second response message, the time tag is carried in the second response message, and the time tag is used to indicate the time point when the HTTPDNS server sends the second response message. After receiving the second response message, the device starts timing from the time point indicated by the time tag to the current time, obtains the storage time, and if the storage time is equal to the cache validity time, deletes the corresponding correspondence from the domain name resolution library.

[0089] Or, further optionally, when the device receives the second response message, it starts counting to the current time and obtains the storage time. If the storage time is equal to the cache validity time, the corresponding correspondence is deleted from the domain name resolution library.

[0090] In some optional implementations, if the storage time obtained by timing matches the cache validity time, an HTTPDNS resolution request carrying the corresponding domain name can be resent to the HTTPDNS server to re-obtain the resolution result from the HTTPDNS server, which may include the corresponding new IP address and the new cache validity time. Then, based on the new IP address and the new cache validity time, the corresponding relationship in the domain name resolution library is updated. Through this optional implementation, when the cache validity time arrives, a request can be automatically sent to the HTTPDNS server to complete the update of the domain name resolution library, so as to cache the resolution result in the mobile terminal, thereby improving the domain name resolution speed, reducing traffic consumption, and reducing traffic costs.

[0091] In some optional implementations, after establishing a correspondence between the target IP address, cache validity period, and target domain name in a preset corresponding format and storing them in a domain name resolution library in step 409, the method includes:

[0092] Receive network status indication information for the target IP address sent by the HTTPDNS server, where the network status indication information is used to indicate the current network status of the target domain name; and process the corresponding relationship of the target domain name in the domain name resolution library according to the network status indication information.

[0093] In the above embodiment, the HTTPDNS server will send network status indication information to the device when the network status of the target IP address changes. The device will process (update, delete, adjust, etc.) the corresponding relationship in the domain name resolution library based on the network status indication information, so as to realize timely processing of the corresponding relationship according to the network status and ensure that the IP address of the domain name resolution library is the latest and reliable.

[0094] Furthermore, according to the network status indication information, processing the corresponding relationship of the target domain name in the domain name resolution library includes:

[0095] When the network status indication information carries the new IP address and new cache validity period of the target domain name, the corresponding relationship of the target domain name in the domain name resolution library is updated according to the new IP address and the new cache validity period; when the network status indication information indicates that the login success rate of the target IP address is lower than the preset value, the cache validity period in the corresponding relationship of the target domain name in the domain name resolution library is adjusted.

[0096] In the above implementation, the corresponding relationship in the domain name resolution library can be processed according to the specific situation indicated by the network status indication information, so as to ensure the reliability and validity of the corresponding relationship in the domain name resolution library.

[0097] For example, the domain name proxy device of the mobile terminal in the embodiment of the present application integrates the software development kit (SDK) of the HTTPDNS service provider. The present application is implemented through the SDK, so that the present application can implement anti-hijacking and IP verification logic and other operations. The code of the domain name proxy device of the mobile terminal to implement the method of the embodiment of the present application is as follows:

[0098] / / Android system Service component example

[0099] public class HttpDnsLocalServer extends Service{

[0100] private Map<String,DnsCacheEntry> cache=new ConcurrentHashMap<>();

[0101] @Override

[0102] Public IBinder onBind(Intent intent){

[0103] return new HttpDnsBinder(); / / Expose the Binder interface

[0104] }

[0105] class HttpDnsBinder extends IHttpDnsService.Stub{

[0106] public String resolveDomain(String domain){

[0107] if(cache.containsKey(domain)&&!cache.isExpired()){

[0108] return cache.get(domain).ip; / / Return cache

[0109] }else{

[0110] String ip = queryHttpDnsProvider(domain); / / Call the cloud service API

[0111] Cache.put(domain, new DnsCacheEntry(ip, TTL));

[0112] return ip;

[0113] }

[0114] }

[0115] }

[0116] }

[0117] See also Figure 5 , Figure 5 This is a structural diagram of the domain name proxy device of the mobile terminal disclosed in the first embodiment of this application; Figure 5 As shown, the domain name proxy device of the mobile terminal is set in the system service layer of the mobile terminal and may include:

[0118] Communication module 501, configured to receive an HTTP DNS request message sent by a target application, wherein the HTTP DNS request message carries a target domain name;

[0119] The cache management module 502 is used to determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library; the domain name resolution library is used to store the correspondence between domain names and IP addresses;

[0120] The communication module 501 is further configured to return a first response message to the target application when the target IP address is found in the domain name resolution library, where the first response message carries the target IP address.

[0121] In some optional embodiments, the above-mentioned communication module 501 is also used to send an HTTPDNS resolution request to the HTTPDNS server when the cache management module 502 fails to find the target IP address in the domain name resolution library, and the HTTPDNS resolution request carries the target domain name; and receive a second response message sent by the HTTPDNS server, the second response message carrying the target IP address corresponding to the target domain name; and forward the second response message to the target application.

[0122] In this embodiment, when the IP address is not found in the domain name resolution library, the device will send an HTTPDNS resolution request to the HTTPDNS server, and the HTTPDNS resolution request carries the target domain name. In the HTTPDNS server, the HTTPDNS server will first search the local IP address library to see whether there is a target IP address corresponding to the target domain name. If so, it will send a second response message carrying the target IP address to the device. If not, the HTTPDNS server will send the HTTPDNS resolution request to the upper-level DNS server, and the DNS server will resolve the target domain name, obtain the corresponding IP address list, and return it to the HTTPDNS server. The HTTPDNS server will select the best IP address (i.e., the one with the best network status) and carry it in the second response message and return it to the device.

[0123] In some optional implementations, the communication module 501 receives the HTTPDNS request message sent by the target application in the following manner:

[0124] The HTTPDNS request message sent by the target application is received through inter-process communication.

[0125] In some optional implementations, after receiving the second response message sent by the HTTPDNS server, the communication module 501 obtains the target IP address from the second response message.

[0126] Then, the cache management module 502 is further configured to establish a correspondence between the target IP address and the target domain name according to a preset corresponding format, and store the correspondence in the domain name resolution library.

[0127] Further optionally, the above-mentioned cache management module 502 is also used to obtain the cache validity period of the target IP address from the second response message before establishing a correspondence between the target IP address and the target domain name in accordance with a preset corresponding format and storing it in the domain name resolution library. The cache validity period is used to indicate the length of time the target IP address is cached locally.

[0128] Furthermore, the cache management module 502 is used to establish a correspondence between the target IP address and the target domain name according to a preset corresponding format, and store the correspondence in the domain name resolution library in the following specific manner:

[0129] According to the preset corresponding format, a corresponding relationship is established between the target IP address, the cache validity time and the target domain name, and the corresponding relationship is stored in the domain name resolution library.

[0130] In some optional embodiments, the cache management module 502 is further configured to establish a correspondence between the target IP address, the cache validity period, and the target domain name according to the preset corresponding format, and store the correspondence in the domain name resolution library, and then detect the storage time of the target IP address in the domain name resolution library; determine whether the storage time matches the cache validity period; if so, delete the correspondence of the target domain name from the domain name resolution library.

[0131] Optionally, the domain name resolution library is respectively set in the memory and disk of the mobile terminal.

[0132] In some optional embodiments, the above-mentioned communication module 501 is also used to receive network status indication information for the target IP address sent by the HTTPDNS server after the cache management module 502 establishes a correspondence between the target IP address, the cache validity period and the target domain name according to the preset corresponding format and stores them in the domain name resolution library, and the network status indication information is used to indicate the current network status of the target domain name.

[0133] Furthermore, the cache management module 502 is further configured to process the corresponding relationship between the target domain name in the domain name resolution library according to the network status indication information.

[0134] Further optionally, the cache management module 502 is configured to process the corresponding relationship of the target domain name in the domain name resolution library according to the network status indication information in the following manner:

[0135] When the network status indication information carries the new IP address and new cache validity period of the target domain name, updating the corresponding relationship of the target domain name in the domain name resolution library according to the new IP address and the new cache validity period;

[0136] When the network status indication information indicates that the login success rate of the target IP address is lower than a preset value, the cache validity time in the corresponding relationship corresponding to the target domain name in the domain name resolution library is adjusted.

[0137] See also Figure 6 , Figure 6 A schematic diagram of the structure of a mobile terminal disclosed in an embodiment of the present application; Figure 6 The mobile terminal shown may include:

[0138] A memory 601 storing executable program code;

[0139] a processor 602 coupled to the memory 601;

[0140] The processor 602 calls the executable program code stored in the memory 601 and executes Figure 2 and Figure 4 Part of any method.

[0141] The present application also discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute Figure 2 and Figure 4 Any method that is public.

[0142] The present application also discloses a computer program product, which, when executed on a computer, enables the computer to execute Figure 2 and Figure 4 Part or all of the steps of any disclosed method.

[0143] The embodiment of the present application further discloses an application publishing platform, which is used to publish a computer program product, wherein when the computer program product is run on a computer, the computer executes Figure 2 and Figure 4 Part or all of the steps of any disclosed method.

[0144] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to set or store data.

[0145] The above is a detailed introduction to the domain name proxy method, device, mobile terminal and storage medium for a mobile terminal disclosed in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A domain name proxy method for a mobile terminal, characterized in that: A domain name proxy device applied to a mobile terminal, wherein the domain name proxy device of the mobile terminal is arranged in a system service layer of the mobile terminal, and the method includes: Receive an HTTP DNS request message sent by a target application, wherein the HTTP DNS request message carries a target domain name; Determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library; the domain name resolution library is used to store the correspondence between domain names and IP addresses; When the domain name resolution library finds the target IP address, a first response message is returned to the target application, where the first response message carries the target IP address.

2. The method according to claim 1, characterized in that The method further comprises: When the target IP address is not found in the domain name resolution library, an HTTP DNS resolution request is sent to the HTTP DNS server, where the HTTP DNS resolution request carries the target domain name; Receive a second response message sent by the HTTPDNS server, where the second response message carries the target IP address corresponding to the target domain name; Forward the second response message to the target application.

3. The method according to claim 2, characterized in that After receiving the second response message sent by the HTTPDNS server, the method further includes: Obtain the target IP address from the second response message; According to the preset corresponding format, a corresponding relationship is established between the target IP address and the target domain name, and the corresponding relationship is stored in the domain name resolution library.

4. The method according to claim 3, characterized in that Before establishing a correspondence between the target IP address and the target domain name according to a preset corresponding format and storing the correspondence in the domain name resolution library, the method further includes: Obtaining a cache validity period of the target IP address from the second response message, where the cache validity period indicates the length of time the target IP address is cached locally; The step of establishing a correspondence between the target IP address and the target domain name according to a preset corresponding format and storing the correspondence in the domain name resolution library includes: According to the preset corresponding format, a corresponding relationship is established between the target IP address, the cache validity time and the target domain name, and the corresponding relationship is stored in the domain name resolution library.

5. The method according to claim 4, characterized in that After establishing a correspondence between the target IP address, the cache validity period, and the target domain name according to the preset corresponding format and storing the correspondence in the domain name resolution library, the method includes: Detecting the storage time of the target IP address in the domain name resolution library; Determining whether the storage time matches the cache validity time; If there is a match, the corresponding relationship of the target domain name is deleted from the domain name resolution library.

6. The method according to any one of claims 1 to 5, characterized in that The domain name resolution library is respectively set in the memory and disk of the mobile terminal.

7. The method according to claim 4 or 5, characterized in that After establishing a correspondence between the target IP address, the cache validity period, and the target domain name according to the preset corresponding format and storing the correspondence in the domain name resolution library, the method includes: Receiving network status indication information for the target IP address sent by the HTTPDNS server, where the network status indication information is used to indicate a current network status of the target domain name; According to the network status indication information, the corresponding relationship of the target domain name in the domain name resolution library is processed.

8. The method according to claim 7, characterized in that The processing, according to the network status indication information, of the corresponding relationship between the target domain name in the domain name resolution library includes: When the network status indication information carries the new IP address and new cache validity period of the target domain name, updating the corresponding relationship of the target domain name in the domain name resolution library according to the new IP address and the new cache validity period; When the network status indication information indicates that the login success rate of the target IP address is lower than a preset value, the cache validity time in the corresponding relationship corresponding to the target domain name in the domain name resolution library is adjusted.

9. The method according to any one of claims 1 to 4, characterized in that The receiving of the HTTPDNS request message sent by the target application includes: The HTTPDNS request message sent by the target application is received through inter-process communication.

10. A domain name proxy device for a mobile terminal, wherein the domain name proxy device for the mobile terminal is arranged in a system service layer of the mobile terminal, characterized in that: include: A communication module, configured to receive an HTTP / DNS request message sent by a target application, wherein the HTTP / DNS request message carries a target domain name; A cache management module is used to determine whether the target IP address corresponding to the target domain name is found in the domain name resolution library; The domain name resolution library is used to store the correspondence between domain names and IP addresses; The communication module is further configured to return a first response message to the target application when the domain name resolution library finds the target IP address, where the first response message carries the target IP address.

11. A mobile terminal, characterized in that: include: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the domain name proxy method for the mobile terminal according to any one of claims 1 to 9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Sending processing method of DNS request, related method and related devices

    CN109618016A

  • HTTP-based domain name resolution method and system

    CN109618024A

  • Domain name processing method, apparatus, electronic device, and storage medium

    WO2020228038A1