Domain name resolution method and apparatus, electronic device, and readable medium
By setting up local domain name caching on the client side and combining it with online domain name resolution services, the stability issues of mobile domain name resolution services in the event of network anomalies or server failures were resolved, thereby improving the stability and availability of the domain name resolution service.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2025-10-21
- Publication Date
- 2026-06-18
AI Technical Summary
In existing technologies, when a client accesses a mobile domain name resolution service, network anomalies or server failures can cause the resolution result to be empty, affecting the stability and availability of the domain name resolution service.
Configure a local domain name cache on the client to cache historical domain name resolution information, and request the online domain name resolution service when no result is found in the local cache. This ensures that domain name resolution information can still be obtained when the network conditions are poor, and updates the local cache to improve stability.
By combining local caching and online services, empty domain name resolution results are avoided, the stability and availability of domain name resolution services are improved, domain name hijacking is prevented, and the normal use of client services is ensured.
Smart Images

Figure CN2025128916_18062026_PF_FP_ABST
Abstract
Description
Domain name resolution methods, devices, electronic devices and readable media
[0001] Related applications
[0002] This application claims priority to Chinese patent application filed on December 13, 2024, with application number 202411845501.X, entitled "Domain name resolution method, apparatus, electronic device and readable medium", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application relates to the field of computer technology, and in particular to a domain name resolution method, apparatus, electronic device, and readable medium. Background Technology
[0004] Domain name resolution is the process of converting a domain name into a network address. Dedicated domain name resolution systems exist on the internet to provide this service. With the development of computer technology, the methods for providing domain name resolution services have become more diverse, but this has also led to problems such as domain name hijacking and other domain name resolution anomalies.
[0005] In related technologies, clients can access mobile domain name resolution services for domain name resolution. By accessing the domain name resolution service through the Hypertext Transfer Protocol (HTTP), they can bypass the domain name resolution service provided by network operators, thereby avoiding domain name hijacking.
[0006] However, in such solutions, if network anomalies or server failures occur during the access process of mobile DNS services, mobile DNS will fail, returning empty resolution results. This will prevent the client from using the service normally, affecting the stability and availability of the domain name resolution service. Summary of the Invention
[0007] This application provides a domain name resolution method, apparatus, electronic device, and readable medium.
[0008] According to one aspect of the embodiments of this application, a domain name resolution method is provided, executed by a domain name resolution application running on a client, including:
[0009] Obtain the domain name resolution request initiated by the client for the domain name to be resolved;
[0010] Based on the domain name resolution request, the domain name resolution information of the domain name to be resolved is searched in the local domain name cache. The domain name resolution information in the local domain name cache is obtained from the online domain name resolution service based on historical domain name resolution requests.
[0011] If the domain name resolution information for the domain name to be resolved is not found in the local domain name cache, then the domain name to be resolved is sent to the online domain name resolution service to obtain the domain name resolution information for the domain name to be resolved from the online domain name resolution service; and
[0012] Send the domain name resolution information of the domain name to be resolved to the client, and update the domain name resolution information of the domain name to be resolved in the local domain name cache.
[0013] According to one aspect of the embodiments of this application, a domain name resolution apparatus is provided, comprising:
[0014] The request retrieval module is configured to retrieve domain name resolution requests initiated by clients for the domain name to be resolved.
[0015] The DNS resolution query module is configured to search for the DNS resolution information of the domain name to be resolved in the local DNS cache based on the DNS resolution request. The DNS resolution information in the local DNS cache is obtained from the online DNS resolution service based on historical DNS resolution requests.
[0016] The DNS resolution request module is configured to send the domain name to be resolved to the online DNS service if the domain name resolution information for the domain name to be resolved is not found in the local domain name cache, so as to obtain the domain name resolution information for the domain name to be resolved from the online DNS service; and
[0017] The result sending module is configured to send the domain name resolution information of the domain name to be resolved to the client and update the domain name resolution information of the domain name to be resolved in the local domain name cache.
[0018] According to one aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the domain name resolution method as described above by executing the executable instructions.
[0019] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the domain name resolution method as described in the above technical solutions.
[0020] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the domain name resolution method provided in the various optional implementations described above.
[0021] Details of one or more embodiments of this application are set forth in the following drawings and description. Other features, objects, and advantages of this application will become apparent from the specification, drawings, and claims. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the published drawings without creative effort.
[0023] Figure 1 shows the system structure of the domain name resolution method of this application applied to a cloud host platform.
[0024] Figure 2 is a flowchart of a domain name resolution method according to an embodiment of this application.
[0025] Figure 3 is a flowchart of a domain name resolution method according to an embodiment of this application.
[0026] Figure 4 is a schematic flowchart of the domain name resolution process in an embodiment of this application.
[0027] Figure 5 is a schematic diagram of the data flow of domain name caching in an embodiment of this application.
[0028] Figure 6 is a schematic diagram of the online domain name resolution service address switching process in an embodiment of this application.
[0029] Figure 7 schematically shows a block diagram of the domain name resolution device in an embodiment of this application.
[0030] Figure 8 shows a schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application. Detailed Implementation
[0031] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0032] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0033] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement at least one module or unit. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in at least one hardware module or integrated circuit, or in different network and / or processor devices and / or microcontroller devices.
[0035] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0036] It should be understood that the solution proposed in this application can be applied to online domain name resolution systems, specifically to online domain name resolution services provided to mobile terminals. Domain name resolution is the process of resolving a domain name into a network address. A dedicated Domain Name System (DNS) is established on the Internet to provide this service. With the development of computer technology, the methods for providing domain name resolution services have become more diverse, but they also face challenges caused by domain name hijacking and other domain name resolution anomalies. Domain name hijacking refers to the situation where, during the domain name resolution process, attackers illegally tamper with the domain name resolution results, redirecting the domain name requested by the user to a malicious network address, thereby causing the user to access unexpected websites or services, resulting in security problems such as information leakage and financial loss. This is a common domain name resolution anomaly. Domain name resolution anomalies refer to various abnormal situations that occur during the domain name resolution process, such as domain name hijacking, cache pollution, network anomalies, and server failures. These anomalies can lead to inaccurate domain name resolution results, empty returned results, or interrupted resolution processes, affecting the client's normal access to the network resources corresponding to the domain name.
[0037] Unlike local DNS, which typically uses User Datagram Protocol (UDP) for communication, online domain name resolution systems usually provide domain name resolution services to clients via transport layer protocols such as HTTP or Hypertext Transfer Protocol Secure (HTTPS). Clients access the port of the online domain name resolution server via HTTP to request domain name resolution. The online domain name resolution server directly requests the network address corresponding to the domain name to be accessed from an authoritative domain name resolution system within the client's network and returns it to the client. This avoids domain name resolution through the local domain name resolution system provided by the client's internet service provider, thus preventing domain name hijacking or cache pollution. The solution in this application is applied to such online domain name resolution services by adding a cache space for the online domain name resolution service on the client side to store the domain name resolution results. In related technologies, clients can access mobile domain name resolution services for domain name resolution via HTTP, bypassing the domain name resolution services provided by network operators, thereby avoiding domain name hijacking. However, in such solutions, if network anomalies or server failures occur during the access process of mobile DNS services, mobile DNS will fail, returning empty resolution results. This will prevent the client from using the service normally, affecting the stability and availability of the domain name resolution service.
[0038] Based on this, the technical solution of this application proposes a domain name resolution scheme. Specifically, referring to Figure 1, the system structure of the domain name resolution method applied to a blockchain system according to this application embodiment may include a client 110, an online DNS server 120, and an authoritative DNS server 130. The client 110 may include smartphones, tablets, laptops, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The online DNS server 120 and the authoritative DNS server 130 may be servers providing various services. They may be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The client 110, the online DNS server 120, and the authoritative DNS server 130 may be connected via a network. The network may be a communication medium of various connection types that provides communication links, such as wired communication links or wireless communication links.
[0039] Depending on the implementation requirements, the system architecture in this application embodiment can have any number of clients, networks, and servers. For example, the online DNS server 120 and the authoritative DNS server 130 can be a server group composed of multiple server devices. In addition, the technical solution provided in this application embodiment can be applied to the client 110, or to other servers, or can be implemented jointly by the client 110, the online DNS server 120, and the authoritative DNS server 130. This application does not impose any special limitations on this.
[0040] As shown in Figure 1, the domain name resolution application on client 110 receives domain name resolution requests initiated by applications accessing the network on client 110 for the domain name to be resolved. Subsequently, the domain name resolution application searches its local domain name cache for the domain name resolution information of the domain name to be resolved, based on the domain name resolution request. The domain name resolution information in the local domain name cache is obtained from the online DNS server 120 based on historical domain name resolution requests. If the domain name resolution information for the domain name to be resolved is not found in the local domain name cache, the application sends the domain name to be resolved to the online DNS server 120 to obtain the domain name resolution information from the online DNS server 120. The online DNS server 120 obtains the access address corresponding to the domain name to be resolved from the authoritative DNS server 130 as the domain name resolution information. The online DNS server 120 then sends the domain name resolution information of the domain name to be resolved to the domain name resolution application on client 110. The domain name resolution application then provides the domain name resolution information to the network access application and updates the domain name resolution information of the domain name to be resolved in its local domain name cache.
[0041] The implementation details of the technical solutions of the embodiments of this application are described in detail below: Figure 2 shows a flowchart of a domain name resolution method according to an embodiment of this application. This domain name resolution method can be executed by a device with computing processing capabilities, such as a terminal device or other devices with network access capabilities. The domain name resolution method in this application will be described from the perspective of the terminal device below. Referring to Figure 2, the domain name resolution method includes at least steps S210 to S240, which are described in detail below:
[0042] Step S210: Obtain the domain name resolution request initiated by the client for the domain name to be resolved.
[0043] The scheme described in this application is typically executed by a domain name resolution application on the client side, while the domain name resolution request is generated by the client's network access application. A domain name resolution application refers to a software development component corresponding to an online domain name resolution service, running on the client side to perform domain name resolution-related operations, such as obtaining domain name resolution requests initiated by the client for the domain name to be resolved, searching for domain name resolution information in the local domain name cache, and sending the domain name to be resolved to the online or local domain name resolution service. The local domain name resolution service refers to the domain name resolution service provided by the client's internet service provider, generally using User Datagram Protocol (UDP) communication. The domain name resolution application can send the domain name to be resolved to it to obtain candidate domain name resolution information.
[0044] Step S220: Based on the domain name resolution request, search for the domain name resolution information of the domain name to be resolved in the local domain name cache. The domain name resolution information in the local domain name cache is obtained from the online domain name resolution service based on historical domain name resolution requests.
[0045] The domain name resolution application searches its local domain name cache for the domain name resolution information of the domain to be resolved based on the domain name resolution request. The domain name resolution information in the local domain name cache is obtained from the online domain name resolution service based on historical domain name resolution requests. The online domain name resolution service is typically deployed on an online domain name resolution server. Historical domain name resolution requests are usually recorded when the application on the client's terminal device makes network access. Therefore, it can be understood that the local domain name cache and the client can reside on the same terminal device.
[0046] Step S230: If the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, the domain name to be resolved is sent to the online domain name resolution service to obtain the domain name resolution information of the domain name to be resolved from the online domain name resolution service.
[0047] Specifically, if the domain name resolution information for the domain name to be resolved is not found in the local domain name cache, the domain name resolution application will send the domain name to be resolved to the online domain name resolution service. The domain name resolution application can access the server where the online domain name resolution service is located via HTTP or HTTPS communication. The online domain name resolution service is a server that provides the corresponding access address based on the domain name to be resolved. The access address can be, for example, an Internet Protocol address, i.e., an IP address. The online domain name resolution service can obtain the address from an authoritative domain name resolution server. In some embodiments, the domain name resolution application will also provide the network address of its device to the online domain name resolution service, so that the online domain name resolution service can select the address with the optimal access path for the domain name to be resolved based on that network address. The online domain name resolution service may select an access address on the same network segment as the terminal device as the address of the domain name to be resolved, or select an access address on the same physical address as the terminal device, etc.
[0048] In a specific example, the domain name resolution application also provides the network address of its device to the online domain name resolution service. Based on this network address, the online domain name resolution service calculates parameters such as network latency and bandwidth between different access addresses and the specified network address. It then selects the address with the lowest network latency and highest bandwidth as the optimal access path and uses it as the domain name resolution information for the domain to be resolved. For example, the online domain name resolution service can send probe packets to different potential access addresses, record the response time of each address as network latency, and simultaneously measure the data transmission volume over a period of time to calculate bandwidth. After comprehensive comparison, it determines the optimal address.
[0049] Step S240: Send the domain name resolution information of the domain name to be resolved to the client, and update the domain name resolution information of the domain name to be resolved in the local domain name cache.
[0050] Domain name resolution information is provided to the client for subsequent network access. Simultaneously, the domain name resolution information for the domain to be resolved is updated in the local domain name cache for use in other subsequent accesses.
[0051] In the embodiments of this application, the domain name resolution application obtains the domain name resolution request initiated by the client for the domain name to be resolved. Then, based on the domain name resolution request, it searches for the domain name resolution information of the domain name to be resolved in the local domain name cache. The domain name resolution information in the local domain name cache is obtained from the online domain name resolution service based on historical domain name resolution requests. If the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, the domain name to be resolved is sent to the online domain name resolution service to obtain the domain name resolution information of the domain name to be resolved from the online domain name resolution service. Finally, the domain name resolution information of the domain name to be resolved is sent to the client, and the domain name resolution information of the domain name to be resolved in the local domain name cache is updated. In this way, during the process of resolving a domain name, the domain name resolution application prioritizes using the domain name resolution information cached in the local domain name cache by the online domain name resolution service. Only when the relevant domain name is not found in the local cache will it obtain it from the online domain name resolution service. This allows access to the domain name even when the network conditions are poor, avoiding the inability to use the client's service due to an empty domain name resolution result. This helps prevent domain name hijacking while improving the stability and availability of the domain name resolution service.
[0052] In some embodiments of this application, based on the embodiments described herein, the domain name resolution application also sends the domain name to be resolved to the local domain name resolution service according to the domain name resolution request, so as to obtain candidate domain name resolution information of the domain name to be resolved from the local domain name resolution service, and then sends the candidate domain name resolution information of the domain name to be resolved to the client. In this embodiment, while requesting the resolution of the domain name from the online domain name resolution service, the domain name resolution application also sends the domain name to be resolved to the local domain name resolution service, and the result returned by the local domain name resolution service is also sent to the client. In this way, once the local domain name cache cannot find the domain name resolution information, the domain name resolution application will obtain the domain name resolution result of the domain name to be resolved from both the online domain name resolution service and the local domain name resolution service in parallel. Thus, when the online domain name resolution service is abnormal and cannot return a result, the result returned by the local domain name resolution service is used as a supplement, thereby ensuring that the domain name resolution result is not empty, preventing the client service from being interrupted due to an empty domain name resolution result and the user's waiting time from being extended.
[0053] Candidate domain name resolution information refers to the resolution results of the domain name to be resolved obtained by the domain name resolution application from the local domain name resolution service. While requesting domain name resolution from the online domain name resolution service, the domain name resolution application also sends the domain name to be resolved to the local domain name resolution service. The result returned by the local domain name resolution service is the candidate domain name resolution information. This information can be sent to the client as a supplement when the online domain name resolution service encounters an error and cannot return a result, ensuring that the domain name resolution result is not empty.
[0054] In some embodiments of this application, based on the embodiments of this application, the domain name resolution application also obtains the domain name resolution information of the domain name to be resolved from the local domain name cache, and then checks the cache validity of the domain name resolution information in the local domain name cache. If the cache validity indicates that the local cache has expired, the domain name resolution application determines that the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, and finally deletes the expired domain name resolution information from the local domain name cache. In this embodiment, the domain name resolution information in the local domain name cache has a cache validity period, and the domain name resolution application checks the cache validity period before using the domain name resolution information in the local domain name cache. Only when the cache validity period of the domain name resolution information is still valid will the content in the local domain name cache be used. If the domain name resolution information in the local domain name cache has expired, the domain name resolution application determines that the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, and deletes the expired domain name resolution information from the local domain name cache. In this way, the validity period of the domain name resolution information in the local domain name cache is ensured, preventing expired data from causing clients to make cross-domain access or invalid access, and improving network access response efficiency.
[0055] Specifically, each domain name resolution record in the local domain name cache is associated with a cache timestamp and a preset cache expiration period. The domain name resolution application checks the cache expiration time by comparing the current time with the sum of the cache timestamp and the cache expiration period. If the current time is greater than the sum of the cache timestamp and the cache expiration period, it indicates that the local cache has expired.
[0056] In some embodiments of this application, based on the embodiments described herein, the domain name resolution application also monitors the client's device network in real time. When the device network undergoes a network switch, the domain name resolution application clears the domain name resolution information in the local domain name cache. In this embodiment, the domain name resolution application also monitors the client's device network in real time, detecting whether a network switch has occurred by analyzing changes in the device network data.
[0057] Network switching refers to a change in the network environment of a terminal device, resulting in a change in the path the terminal device takes to access the network. Examples include a mobile device switching from 4G to 5G, or from a mobile network to a Wi-Fi network. When a network switch occurs, the domain name resolution information previously cached by the client may not be applicable to the new network environment. The domain name resolution application will clear the domain name resolution information in its local cache so that it can obtain new domain name resolution information suitable for the new network environment from the online domain name resolution service.
[0058] Specifically, the domain name resolution application periodically obtains the client's network interface information, including network type (such as 4G, 5G, WIFI, etc.), SSID of the network connection (if it is a WIFI network), IP address, etc. When it detects a change in network type, or a change in the IP address network segment, or a change in the SSID of the WIFI network, it determines that the device network has switched.
[0059] When a client moves, its network access location changes, leading to network switching. Network switching refers to a change in the terminal device's network environment, causing a change in the path the terminal device takes to access the network. Examples include switching from 4G to 5G, or from a mobile network to Wi-Fi. In such cases, the client's network path changes, but cached domain name resolution results still might be used, leading to cross-network segment access and increased latency. Therefore, once a network switch occurs, the previously cached domain name resolution information is no longer applicable to the new network environment. The domain name resolution application then clears the domain name resolution information from its local cache and retrieves the information from the online domain name resolution service for subsequent network accesses. This avoids cross-domain access caused by network switching, improving network access smoothness.
[0060] In some embodiments of this application, based on the embodiments of this application, during the process of searching for the domain name resolution information of the domain name to be resolved in the local domain name cache according to the domain name resolution request, the domain name resolution application obtains the client's network status information. If the network status information indicates that the client is in a weak network state, the domain name resolution application searches for the domain name resolution information of the domain name to be resolved in the local domain name cache. If the network status information indicates that the client is in a normal state, the domain name resolution application sends the domain name to be resolved to the online domain name resolution service. In this embodiment, the domain name resolution application checks the client's network status before using the information in the local domain name cache. If it is in a weak network state, it uses the content in the local domain name cache; if it is in a normal state, it obtains the domain name resolution result from the online domain name resolution service.
[0061] A weak network state refers to a client's poor network condition, where the network quality falls below preset requirements. This is determined by monitoring and scoring network quality indicators such as bandwidth, connectivity, and packet loss rate. If the overall score is below a preset threshold, the client is considered to be in a weak network state. In a weak network state, the domain name resolution application will prioritize using domain name resolution information from the local domain name cache to improve the timeliness of the obtained information.
[0062] A normal state refers to a client's network condition being good, with network quality meeting preset requirements. This is achieved by detecting and scoring network quality indicators such as bandwidth, connectivity, and packet loss rate. If the overall score is not lower than a preset scoring threshold, the client is determined to be in a normal state. In a normal state, the domain name resolution application sends the domain name to be resolved to the online domain name resolution service to obtain the latest domain name resolution results.
[0063] Specifically, methods for obtaining network status information can include various methods for detecting and acquiring network quality such as bandwidth, connectivity, and packet loss rate. By detecting and scoring network quality, if the network quality is lower than preset requirements, it is judged as a weak network state; if it meets the preset requirements, it is judged as a normal state. In this way, by checking the network to identify weak network states and only using information from the local domain name cache in weak network states, the timeliness of the obtained domain name resolution information can be further improved.
[0064] In a specific example, the client's network status information is obtained by detecting the client's network bandwidth, connectivity, and packet loss rate. A comprehensive score for network bandwidth, connectivity, and packet loss rate is calculated. Let the network bandwidth score be B, the connectivity score be C, and the packet loss rate score be L. The comprehensive score S is calculated using the formula S = αB + βC + γL, where α, β, and γ are preset weighting coefficients, and α + β + γ = 1. If the comprehensive score S is lower than a preset scoring threshold T, the client is determined to be in a weak network state, and the domain name resolution information for the domain name to be resolved is searched in the local domain name cache. If the comprehensive score S is not lower than the preset scoring threshold T, the client is determined to be in a normal state, and the domain name to be resolved is sent to the online domain name resolution service.
[0065] In some embodiments of this application, based on the embodiments described herein, before obtaining the domain name resolution request initiated by the client for the domain name to be resolved, the domain name resolution application intercepts the first web browsing request initiated by the client based on the domain name to be resolved, and then parses the first web browsing request to obtain the domain name to be resolved. Specifically, the domain name resolution application parses the request header and request body of the first web browsing request, and looks up the Host field therein. The value of the Host field is the domain name to be resolved.
[0066] The first web browsing request is initiated by the client based on the domain name to be resolved, usually generated based on the access method of the local domain name resolution service. The domain name resolution application will intercept this request and parse its request header and request body, looking for the Host field. The value of the Host field is the domain name to be resolved.
[0067] After sending the domain name resolution information of the domain name to be resolved to the client, the domain name resolution application replaces the domain name to be resolved in the first web browsing request with the network address in the domain name resolution information, thereby obtaining a second web browsing request, and then sends the second web browsing request to the network address. In this embodiment, the domain name resolution application intercepts the first web browsing request initiated by the client, and then resolves the domain name to be resolved from the first web browsing request. It can be understood that the first web browsing request is generated based on the access method of the local domain name resolution service. Subsequently, a domain name resolution request is initiated for the domain name to be resolved, so as to obtain the corresponding domain name resolution information through the methods in various embodiments. After obtaining the domain name resolution information, the domain name resolution application replaces the domain name to be resolved in the first web browsing request with the network address, thereby obtaining the second web browsing request. The second web browsing request can be considered to be generated through the access method based on the online domain name resolution service. The second web browsing request is a request that can directly access the server corresponding to the domain name, thereby enabling the client to access the network content corresponding to the domain name to be resolved. By intercepting requests and replacing the domain name during network access by the client in this way, the proposed solution can be implemented without modifying the original access method, which improves the compatibility of the solution and reduces implementation costs.
[0068] The second web browsing request is obtained by the domain name resolution application replacing the domain name to be resolved in the first web browsing request with the network address from the domain name resolution information. It can be considered as a request generated through an online domain name resolution service, directly accessing the server corresponding to the domain name, enabling the client to access the web content corresponding to the domain name to be resolved.
[0069] In the embodiments of this application, other embodiments that refine the technical solution of the embodiment shown in FIG2 are also proposed. Specifically, as shown in FIG3, the domain name resolution method of one embodiment of this application may include the following steps:
[0070] Step S310: Obtain the domain name resolution request initiated by the client for the domain name to be resolved.
[0071] Optionally, the implementation details of step S310 are the same as those of step S210 shown in Figure 2, and will not be repeated here.
[0072] Step S320: Based on the domain name resolution request, search the local domain name cache for the domain name resolution information of the domain name to be resolved. The domain name resolution information in the local domain name cache is obtained from the online domain name resolution service based on historical domain name resolution requests.
[0073] Optionally, the implementation details of step S320 are the same as those of step S220 shown in Figure 2, and will not be repeated here.
[0074] Step S330: If the domain name resolution information for the domain name to be resolved is not found in the local domain name cache, the current service address of the online domain name resolution service is obtained from the service address set. The service address set includes at least a first service address and a second service address. The service address set is a collection of service addresses from multiple online domain name resolution services, including at least a first service address and a second service address. These service addresses are arranged in a predetermined order, such as by processing capacity, with the first service address, as the primary service address, typically listed first in the service address set. When a domain name resolution application needs to access an online domain name resolution service, it obtains the current service address from the service address set for access. If the number of times the current service address fails to resolve a domain name exceeds a predetermined number, the current service address is switched to another service address from the service address set.
[0075] Step S340: Send the domain name to be resolved to the current service address;
[0076] Step S350: When the number of times the current service address fails to resolve the domain name to be resolved exceeds a predetermined number, the current service address is switched to another service address in the service address set, and the domain name to be resolved is sent to the other service address to obtain the domain name resolution information of the domain name to be resolved from the online domain name resolution service.
[0077] In this embodiment, the online domain name resolution service corresponds to multiple service addresses. These service addresses form a service address set. One address in the service address set is marked as the current service address. When the domain name resolution application needs to access the online domain name resolution service, it directly accesses the marked current service address. The service address set includes at least a first service address and a second service address. The first service address can be, for example, the primary service address, while the second service address can be considered a backup service address or a disaster recovery service address. The domain name resolution application sends the domain name to be resolved to the current service address. If the current service address fails to resolve the domain name, the domain name resolution application will retry requesting the domain name resolution from the current service address until the number of failed requests to resolve the domain name exceeds a predetermined number. At this point, the domain name resolution application will switch the current service address to another service address in the service address set, for example, switching from the first service address to the second service address, or switching from the second service address to another address in the service address set, or switching back to the first service address. The domain name resolution application will then request the domain name resolution from the new address after the switch. Subsequent accesses will also directly request the domain name resolution from the new address after the switch. This approach enables the domain name resolution application to promptly identify and switch service addresses when server-side anomalies occur, thereby reducing the impact of server-side anomalies on clients and improving the overall success rate of domain name resolution.
[0078] Step S360: Send the domain name resolution information of the domain name to be resolved to the client, and update the domain name resolution information of the domain name to be resolved in the local domain name cache.
[0079] Optionally, the implementation details of step S360 are the same as those of step S240 shown in Figure 2, and will not be repeated here.
[0080] In the embodiments of this application, the domain name resolution application obtains the domain name resolution request initiated by the client for the domain name to be resolved. Then, based on the domain name resolution request, it searches for the domain name resolution information of the domain name to be resolved in the local domain name cache. The domain name resolution information in the local domain name cache is obtained from the online domain name resolution service based on historical domain name resolution requests. If the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, the domain name to be resolved is sent to the online domain name resolution service to obtain the domain name resolution information of the domain name to be resolved from the online domain name resolution service. Finally, the domain name resolution information of the domain name to be resolved is sent to the client, and the domain name resolution information of the domain name to be resolved in the local domain name cache is updated. In this way, during the process of resolving a domain name, the domain name resolution application prioritizes using the domain name resolution information cached in the local domain name cache by the online domain name resolution service. Only when the relevant domain name is not found in the local cache will it obtain it from the online domain name resolution service. This allows access to the domain name even when the network conditions are poor, avoiding the inability to use the client's service due to an empty domain name resolution result. This helps prevent domain name hijacking while improving the stability and availability of the domain name resolution service.
[0081] In some embodiments of this application, based on the embodiments in this application, if the current service address is a second service address, the domain name resolution application will obtain the duration for which the second service address is used as the current service address. If the duration exceeds a predetermined duration threshold, the domain name resolution application will switch the current service address back to the first service address. In this embodiment, the domain name resolution application will check the duration for which the second service address is used as the current service address. Specifically, the first service address is the primary service address, which has stronger service capabilities, while the second service address has relatively weaker service capabilities. If the duration for which the second service address is used as the current service address exceeds the predetermined duration threshold, the domain name resolution application will switch back to the first service address as the primary service address. In some embodiments, the domain name resolution application will probe the primary service address before switching back to it to determine if the primary service address has recovered to a normal service state. After determining that the primary service address has recovered, it will switch back to the primary service address. If it is found that the primary service address has not recovered, the timing will restart. In this way, the processing capacity of the first service address can be wasted by using the second service address as the current service address for a long time, thus avoiding resource waste and improving the overall resource utilization of the solution.
[0082] In some embodiments of this application, based on the embodiments of this application, during the process of switching the current service address to another service address in the service address set, the domain name resolution application obtains the next service address of the current service address from the service address set according to the service address sequence in the service address set, and uses it as the second service address. If the next service address is obtained, the domain name resolution application switches the current service address to the second service address. If the current service address is the last address in the service address sequence, the domain name resolution application switches the current service address to the first service address. In this embodiment, the service addresses in the service address set are arranged in a predetermined order, such as according to processing capacity, and the first service address, which is the primary service address, is usually ranked first in the service address set. When switching service addresses, if the current service address is not the last address in the sequence, the domain name resolution application can obtain the next service address in the sequence, thereby completing the switch. If the current service address is the last address in the service address sequence, the domain name resolution application will switch back to the first service address, which is the primary service address. This approach ensures that the switching of the current service address can be continuously completed within the service address set, avoiding errors caused by the inability to obtain an address during address switching and improving the stability of the solution.
[0083] A service address sequence is a sequence formed by arranging service addresses in a set of service addresses in a predetermined order, such as by processing capacity. When switching service addresses, the DNS resolution application retrieves the next service address from the set of service addresses based on this sequence. If the current service address is not the last address in the sequence, the DNS resolution application can retrieve the next address in the sequence and switch; if the current service address is the last address in the service address sequence, the DNS resolution application will switch back to the first service address, which will be the primary service address.
[0084] In some embodiments of this application, based on the embodiments of this application, after sending the domain name to be resolved to the current service address, when the current service address fails to resolve the domain name, the domain name resolution application checks the request resolution duration and the number of resolution failures of the current service address. If the request resolution duration does not exceed a predetermined resolution duration threshold, and the number of resolution failures is less than the predetermined number, the domain name resolution application resends the domain name to be resolved to the current service address. If the request resolution duration does not exceed the predetermined resolution duration threshold, and the number of resolution failures exceeds the predetermined number, the domain name resolution application determines that the current service address has failed to resolve the domain name more than the predetermined number of times. If the request resolution duration exceeds the predetermined resolution duration threshold, the domain name resolution application sends a resolution failure response to the client for the domain name resolution request. In this embodiment, if the resolution fails before the domain name resolution request timeout, the domain name resolution application will repeatedly attempt to request resolution from the current service address. During the repeated attempts, if the number of failures reaches the predetermined number, the application switches to the next service address to continue trying. If the request resolution time exceeds the predetermined resolution time threshold during repeated attempts, the domain name resolution application will abandon the attempt and report an error. In some embodiments, after abandoning the online domain name resolution attempt, the domain name resolution application will not directly report an error to the client, but will instead send the local domain name resolution result to the client. This approach avoids resolution failures caused by occasional network errors or network fluctuations, thereby improving the success rate of the solution.
[0085] The request resolution duration refers to the time elapsed from when the domain name resolution application sends the domain name to be resolved to the current service address until the current moment. The domain name resolution application checks this duration. If it does not exceed the predetermined resolution duration threshold and the number of resolution failures is less than the predetermined number, it will resend the domain name to be resolved to the current service address. If it does not exceed the predetermined resolution duration threshold, but the number of resolution failures exceeds the predetermined number, it is determined that the number of times the current service address has failed to resolve the domain name exceeds the predetermined number. If it exceeds the predetermined resolution duration threshold, the domain name resolution application will send a resolution failure response to the client for the domain name resolution request.
[0086] The number of DNS resolution failures refers to the cumulative number of times a DNS resolution application fails to resolve a domain name when sending a request to the current service address. The application uses this number and the request duration to decide whether to switch service addresses or send a resolution failure response to the client. If the request duration does not exceed a predetermined threshold and the number of failures is below the predetermined limit, the application will resend the request to the current service address to resolve the domain name. If the number of failures exceeds the predetermined limit, it is determined that the current service address has failed to resolve the domain name more than the predetermined limit, and in this case, the application will switch to another service address from the service address set.
[0087] The implementation details of the technical solution of this application embodiment are described below with specific examples. Please refer to Figure 4, which is a schematic flowchart of the domain name resolution process in this application embodiment. As shown in Figure 4, the process mainly involves a network application APP, an online domain name service client tool HTTPDNSSDK, an online domain name service HTTPDNS, and a local domain name service LOCALDNS. Both the client tool HTTPDNSSDK and the network application APP can be installed on the client's terminal device. When the network application starts, it starts HTTPDNSSDK in step 401 to complete the initialization of HTTPDNSSDK. Subsequently, in step 402, when the APP accesses the network, it sends a domain name resolution request to HTTPDNSSDK, such as www.XXXX.com. In step 403, HTTPDNSSDK first checks whether the IP address corresponding to the domain name exists in its local domain name cache. If not, in step 404, HTTPDNSSDK requests service from HTTPDNS. In step 405, HTTPDNS returns the IP address of the domain name to HTTPDNSSDK, and HTTPDNSSDK saves the domain name and IP address to its local domain name cache. In step 406, the HTTPDNSSDK requests the local DNS to resolve the domain name. Steps 406 and 404 are typically executed in parallel. In step 407, the local DNS returns the IP address it queried to the HTTPDNSSDK. The app can receive two IP addresses from the HTTPDNSSDK, resolved by the HTTPDNS and local DNS respectively. In step 408, the HTTPDNSSDK monitors network changes on the terminal device. When a network change occurs, the HTTPDNSSDK clears its local domain name cache in step 409.
[0088] Please refer to Figure 5, which is a schematic diagram of the data flow of domain name caching in this embodiment of the application. As shown in Figure 5, when the requested domain name matches the data in the cache, the domain name resolution information is read from the cache. When the requested domain name does not match the cache, a request is asynchronously sent to the online domain name resolution server to obtain the domain name resolution result, which is then written into the cache. When a network change occurs, the cached data is cleared.
[0089] When the online domain name resolution service fails or malfunctions, the domain name resolution application switches to a candidate address. Specifically, the primary and backup addresses of the HTTPDNS service are pre-configured in the service retry and failover strategy of the domain name resolution application. When an HTTPDNS resolution request fails, the domain name resolution application automatically retryes. If the user-defined resolution timeout (default 1000ms) has been reached, the HTTPDNS request directly returns a failure message. When the domain name resolution application retryes more than a certain number of times (default 3 times), a service address failover is performed, and an error is reported. The next time an HTTPDNS resolution request is initiated, the domain name resolution application will send a request to the new service address. Please refer to Figure 6, which is a schematic diagram of the online domain name resolution service address switching process in this embodiment. As shown in Figure 6, in step 601, the user initiates a resolution request for the domain name. Subsequently, in step 602, the domain name resolution application obtains a service address. Specifically, it selects from an IP pool consisting of the primary IP and disaster recovery IP addresses. In step 603, the domain name resolution application checks whether the disaster recovery IP is enabled and whether the activation time of the disaster recovery IP exceeds 10 minutes. If the number of failures exceeds the limit, in step 604, the domain name resolution application will restore the primary IP, and in step 605, continue the resolution process. If the number of failures does not exceed the limit, in step 606, the domain name resolution application will check if the number of failed resolutions for the current IP is greater than 3. If it is less than 3, in step 607, it will continue to resolve using the current IP. If it is greater than 3, in step 608, the domain name resolution application will check if the current IP is the last IP in the IP pool. If it is, it will proceed to step 604 for further processing. If not, in step 609, the domain name resolution application will use the next IP in the IP pool and proceed to step 605 to continue the resolution process.
[0090] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0091] The following describes the implementation of the apparatus of this application, which can be used to execute the domain name resolution method in the above embodiments of this application. Figure 7 schematically shows a block diagram of the domain name resolution apparatus in an embodiment of this application. As shown in Figure 7, the domain name resolution apparatus 700 mainly includes:
[0092] The request acquisition module 710 is configured to acquire domain name resolution requests initiated by the client for the domain name to be resolved;
[0093] The DNS resolution query module 720 is configured to search for the DNS resolution information of the domain name to be resolved in the local DNS cache according to the DNS resolution request. The DNS resolution information in the local DNS cache is obtained from the online DNS resolution service based on historical DNS resolution requests.
[0094] The resolution request module 730 is configured to send the domain name to be resolved to the online domain name resolution service if the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, so as to obtain the domain name resolution information of the domain name to be resolved from the online domain name resolution service;
[0095] The result sending module 740 is configured to send the domain name resolution information of the domain name to be resolved to the client and update the domain name resolution information of the domain name to be resolved in the local domain name cache.
[0096] In some embodiments of this application, based on the above technical solutions, the resolution request module 730 is further configured to: send the domain name to be resolved to the local domain name resolution service according to the domain name resolution request, so as to obtain the candidate domain name resolution information of the domain name to be resolved from the local domain name resolution service; and send the candidate domain name resolution information of the domain name to be resolved to the client.
[0097] In some embodiments of this application, based on the above technical solutions, the resolution query module 720 is further configured to: obtain the domain name resolution information of the domain name to be resolved from the local domain name cache; check the cache validity of the domain name resolution information in the local domain name cache; if the cache validity indicates that the local cache has expired, determine that the domain name resolution information of the domain name to be resolved is not found in the local domain name cache; and delete the expired domain name resolution information from the local domain name cache.
[0098] In some embodiments of this application, based on the above technical solutions, the parsing query module 720 is further configured to: detect the device network of the client in real time; and clear the domain name resolution information in the local domain name cache when the device network undergoes a network switch.
[0099] In some embodiments of this application, based on the above technical solutions, the result sending module 740 is specifically configured to: obtain the current service address of the online domain name resolution service from the service address set, wherein the service address set includes at least a first service address and a second service address; send the domain name to be resolved to the current service address; when the number of times the current service address fails to resolve the domain name to be resolved exceeds a predetermined number, switch the current service address to another service address in the service address set, and send the domain name to be resolved to the other service address.
[0100] In some embodiments of this application, based on the above technical solutions, the result sending module 740 is further configured to: if the current service address is a second service address, then obtain the second service address as the duration of the current service address; if the duration exceeds a predetermined duration threshold, then switch the current service address to the first service address.
[0101] In some embodiments of this application, based on the above technical solutions, the result sending module 740 is specifically configured to: obtain the next service address of the current service address from the service address set according to the service address sequence in the service address set, and use it as the second service address; if the next service address is obtained, switch the current service address to the second service address; if the current service address is the last address in the service address sequence, switch the current service address to the first service address.
[0102] In some embodiments of this application, based on the above technical solutions, the result sending module 740 is further configured to: when the current service address fails to resolve the domain name to be resolved, check the request resolution duration and the number of resolution failures of the current service address; if the request resolution duration does not exceed a predetermined resolution duration threshold and the number of resolution failures is lower than the predetermined number, then resend the domain name to be resolved to the current service address; if the request resolution duration does not exceed the predetermined resolution duration threshold and the number of resolution failures exceeds the predetermined number, then determine that the number of times the current service address has failed to resolve the domain name to be resolved exceeds the predetermined number; if the request resolution duration exceeds the predetermined resolution duration threshold, then send a resolution failure response for the domain name resolution request to the client.
[0103] In some embodiments of this application, based on the above technical solutions, the result sending module 740 is further configured to: obtain the network status information of the client; if the network status information indicates that the client is in a weak network state, then search for the domain name resolution information of the domain name to be resolved in the local domain name cache; if the network status information indicates that the client is in a normal state, then send the domain name to be resolved to the online domain name resolution service.
[0104] In some embodiments of this application, based on the above technical solutions, the request acquisition module 710 is further configured to: intercept the first network browsing request initiated by the client based on the domain name to be resolved; parse the first network browsing request to obtain the domain name to be resolved;
[0105] The result sending module 740 is further configured to: replace the domain name to be resolved in the first network browsing request with the network address in the domain name resolution information according to the domain name resolution information to obtain a second network browsing request; and send the second network browsing request to the network address.
[0106] It should be noted that the apparatus provided in the above embodiments and the method provided in the above embodiments belong to the same concept, and the specific way in which each module performs the operation has been described in detail in the method embodiments, and will not be repeated here.
[0107] Figure 8 shows a schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application.
[0108] It should be noted that the computer system 800 of the electronic device shown in Figure 8 is only an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0109] As shown in Figure 8, the computer system 800 includes a Central Processing Unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 802 or programs loaded from Storage Unit 808 into Random Access Memory (RAM) 803. RAM 803 also stores various programs and data required for system operation. The CPU 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / Output (I / O) interface 805 is also connected to bus 804.
[0110] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.
[0111] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs various functions defined in the system of this application.
[0112] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0113] In summary, this application provides a domain name resolution method, apparatus, electronic device, computer-readable medium, and computer program product. The method involves a domain name resolution application running on a client receiving a domain name resolution request from the client for a domain name to be resolved. Then, based on this request, the application searches a local domain name cache for the domain name resolution information of the domain name to be resolved. This local domain name cache contains information obtained from an online domain name resolution service based on historical domain name resolution requests. If the relevant information is not found in the local domain name cache, the domain name resolution application sends the domain name to be resolved to the online domain name resolution service to obtain the resolution information. Finally, the resolution information is sent to the client, and the local cache is updated. This approach prioritizes the use of the local cache in the domain name resolution process. Even with poor network conditions, access can still be made via the address provided by the online domain name resolution service, avoiding client service malfunctions due to empty domain name resolution results. From a technical perspective, the use of local caching reduces frequent interactions with the online domain name resolution service, lowers network traffic, improves the response speed of domain name resolution, and avoids abnormal situations such as domain name hijacking, thereby enhancing the stability and availability of the domain name resolution service.
[0114] Furthermore, while sending the domain name to be resolved to the online domain name resolution service according to the domain name resolution request, the domain name to be resolved is also sent to the local domain name resolution service to obtain candidate domain name resolution information, and then sent to the client. This process realizes parallel acquisition of domain name resolution results. When the online domain name resolution service encounters an anomaly and cannot provide feedback, the feedback result from the local domain name resolution service can serve as a supplement. From a technical perspective, parallel processing increases the probability of obtaining valid resolution results, avoids resolution failures caused by a single service anomaly, improves the fault tolerance of domain name resolution, and ensures the continuity of client services. Moreover, parallel acquisition of results makes full use of both local and online domain name resolution resources, increasing the probability of obtaining valid domain name resolution results without increasing the investment of additional resources. This is equivalent to improving the performance and efficiency of the entire domain name resolution system under existing resource conditions.
[0115] Furthermore, the domain name resolution application retrieves the domain name resolution information of the domain to be resolved from the local domain name cache and checks its cache validity. If the cache validity indicates that the local cache has expired, the domain name resolution application determines that no domain name resolution information for the domain to be resolved is found in the local domain name cache and deletes the expired information. By checking the cache validity and cleaning up expired information, the accuracy and validity of the information in the local domain name cache are ensured. Technically, this avoids the use of expired domain name resolution information, reduces cross-domain access or invalid access caused by expired information, reduces the waste of network resources, and improves the response efficiency of network access.
[0116] Furthermore, the domain name resolution application monitors the client's device network in real time. When a network switch occurs, it clears the domain name resolution information from the local domain name cache. Network switching causes changes in the client's network environment, and previously cached domain name resolution information may no longer be applicable to the new network environment. Clearing the local cache prevents the client from using inapplicable information to access different network segments, technically reducing network latency and erroneous access, and improving the smoothness and stability of network access.
[0117] Furthermore, when sending a domain name to be resolved to the online domain name resolution service, the domain name resolution application retrieves the current service address from the service address set, which includes at least a first service address and a second service address, and then sends the domain name to be resolved to the current service address. When the number of times the current service address fails to resolve the domain name exceeds a predetermined number, the domain name resolution application switches the current service address to another service address in the service address set and sends the domain name to be resolved to that address. This service address switching mechanism enables timely switching to other available addresses when an address in the online domain name resolution service becomes abnormal, technically improving the success rate of domain name resolution, reducing resolution failures caused by server-side anomalies, and enhancing the reliability and stability of the system.
[0118] Furthermore, if the current service address is the second service address, the domain name resolution application will obtain the duration for which it serves as the current service address. If this duration exceeds a predetermined duration threshold, the domain name resolution application will switch the current service address to the first service address. Typically, the first service address is the primary service address and possesses stronger service capabilities. By monitoring the duration and switching addresses, the processing capacity of the first service address is avoided from being wasted due to the second service address serving as the current service address for an extended period. This technically optimizes resource allocation and improves the overall resource utilization and processing efficiency of the system.
[0119] Furthermore, when switching the current service address to another service address in the service address set, the domain name resolution application obtains the next service address from the service address sequence in the service address set as the second service address. If a next service address can be obtained, the switch is performed; if the current service address is the last address in the service address sequence, the switch back to the first service address. This orderly address switching method ensures that the service address switching can be continuously completed within the service address set, avoiding errors caused by the inability to obtain a valid address during address switching. Technically, this improves the stability and reliability of address switching, ensuring the normal operation of the domain name resolution service.
[0120] Furthermore, after sending the domain name to be resolved to the current service address, if the current service address fails to resolve the domain name, the domain name resolution application checks the request resolution duration and the number of resolution failures. If the request resolution duration does not exceed the predetermined resolution duration threshold, and the number of resolution failures is less than the predetermined number, the domain name resolution application will resend the domain name to be resolved to the current service address; if the request resolution duration does not exceed the threshold, but the number of resolution failures exceeds the predetermined number, it is determined that the current service address's request resolution failures exceed the predetermined number; if the request resolution duration exceeds the predetermined threshold, a resolution failure response is sent to the client. This judgment mechanism based on request resolution duration and the number of failures can effectively distinguish between resolution failures caused by occasional network errors or network fluctuations and genuine server-side anomalies. By retrying multiple times, resolution failures caused by occasional factors are reduced, improving the success rate of domain name resolution, while timely feedback when server-side anomalies are determined avoids unnecessary resource waste.
[0121] Furthermore, when searching for the domain name resolution information of the domain name to be resolved in the local domain name cache according to the domain name resolution request, the domain name resolution application obtains the client's network status information. If the network status information indicates that the client is in a weak network state, the resolution information is searched in the local domain name cache; if it is in a normal state, the domain name to be resolved is sent to the online domain name resolution service. By judging the client's network status, the method of obtaining domain name resolution information can be reasonably selected according to the network conditions. Using the local cache in a weak network state reduces network communication and improves the timeliness of obtaining resolution information; requesting from the online service in a normal state can obtain the latest resolution results. This adaptive processing method improves the efficiency and accuracy of domain name resolution and optimizes the utilization of network resources.
[0122] Furthermore, before obtaining the domain name resolution request initiated by the client for the domain name to be resolved, the domain name resolution application intercepts the first web browsing request initiated by the client based on the domain name to be resolved and parses the request to obtain the domain name to be resolved. After sending the domain name resolution information of the domain name to be resolved to the client, the domain name resolution application replaces the domain name to be resolved in the first web browsing request with a network address based on the resolution information, obtains a second web browsing request, and then sends the request to that network address. This interception and replacement mechanism allows the domain name resolution application to automatically intervene during the client's network access process without modifying the client's original access method. This improves the compatibility of the solution from a technical perspective and reduces implementation costs. At the same time, the original client access method based on the local domain name resolution service may be at risk of domain hijacking. However, through the solution of this application, the accurate network address is obtained by using the online domain name resolution service and the domain name in the request is replaced, avoiding the client's interaction with the potentially tampered local domain name resolution service, reducing the occurrence of security threats such as domain hijacking, and enhancing the security of the client's network access.
[0123] Furthermore, the domain name resolution application provides the network address of its device to the online domain name resolution service. The online domain name resolution service then selects the address with the optimal access path for the domain name to be resolved based on this network address. The online domain name resolution service determines the optimal address by calculating parameters such as network latency and bandwidth between different access addresses and the given network address. From a technical perspective, by considering the client device's network address, it can select an access address that is closer to the client, has lower network latency, and higher bandwidth. This reduces data transmission time in the network, improves data transmission efficiency, and thus enhances the speed and response performance of the client's access to the network resources corresponding to the domain name, optimizing the user's network access experience.
[0124] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0125] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0126] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.
[0127] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0128] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A domain name resolution method, executed by a domain name resolution application running on a client, comprising: Obtain the domain name resolution request initiated by the client for the domain name to be resolved; Based on the domain name resolution request, the domain name resolution information of the domain name to be resolved is searched in the local domain name cache. The domain name resolution information in the local domain name cache is obtained from the online domain name resolution service based on historical domain name resolution requests. If the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, the domain name to be resolved is sent to the online domain name resolution service to obtain the domain name resolution information of the domain name to be resolved from the online domain name resolution service; and Send the domain name resolution information of the domain name to be resolved to the client, and update the domain name resolution information of the domain name to be resolved in the local domain name cache.
2. The domain name resolution method according to claim 1, further comprising: According to the domain name resolution request, the domain name to be resolved is sent to the local domain name resolution service to obtain the candidate domain name resolution information of the domain name to be resolved from the local domain name resolution service; Send candidate domain name resolution information for the domain name to be resolved to the client.
3. The domain name resolution method according to claim 1 or 2, further comprising: Obtain the domain name resolution information of the domain name to be resolved from the local domain name cache; Check the cache validity of the domain name resolution information in the local domain name cache; If the cache expiration indicates that the local cache has expired, then it is determined that the domain name resolution information of the domain name to be resolved is not found in the local domain name cache. Delete the expired domain name resolution information from the local domain name cache.
4. The domain name resolution method according to any one of claims 1 to 3, further comprising: Real-time monitoring of the client's device network; When the device network undergoes a network switch, the domain name resolution information in the local domain name cache is cleared.
5. The domain name resolution method according to any one of claims 1 to 4, wherein sending the domain name to be resolved to the online domain name resolution service comprises: Obtain the current service address of the online domain name resolution service from the service address set, wherein the service address set includes at least a first service address and a second service address; Send the domain name to be resolved to the current service address; When the number of times the current service address fails to resolve the domain name to be resolved exceeds a predetermined number, the current service address is switched to another service address in the service address set, and the domain name to be resolved is sent to the other service address.
6. The domain name resolution method according to claim 5, further comprising: If the current service address is the second service address, then the duration of the second service address is obtained as the duration of the current service address; If the duration exceeds a predetermined duration threshold, the current service address will be switched to the first service address.
7. The domain name resolution method according to claim 5 or 6, wherein switching the current service address to another service address in the service address set includes: Based on the service address sequence in the service address set, obtain the next service address of the current service address from the service address set, and use it as the second service address; If a next service address is obtained, the current service address is switched to the second service address; If the current service address is the last address in the service address sequence, then the current service address is switched to the first service address.
8. The domain name resolution method according to any one of claims 5 to 7, wherein after sending the domain name to be resolved to the current service address, the method includes: When the current service address fails to resolve the domain name to be resolved, check the request resolution duration and the number of resolution failures of the current service address; If the request resolution time does not exceed the predetermined resolution time threshold, and the number of resolution failures is less than the predetermined number, then the domain name to be resolved is resent to the current service address. If the request resolution time does not exceed the predetermined resolution time threshold, and the number of resolution failures exceeds the predetermined number, then it is determined that the number of times the current service address has failed to resolve the domain name to be resolved exceeds the predetermined number. If the resolution time exceeds a predetermined resolution time threshold, a resolution failure response for the domain name resolution request is sent to the client.
9. The domain name resolution method according to any one of claims 1 to 8, wherein searching for the domain name resolution information of the domain name to be resolved in the local domain name cache according to the domain name resolution request includes: Obtain the network status information of the client; If the network status information indicates that the client is in a weak network state, then look up the domain name resolution information of the domain name to be resolved in the local domain name cache; If the network status information indicates that the client is in a normal state, then the domain name to be resolved is sent to the online domain name resolution service.
10. The domain name resolution method according to any one of claims 1 to 9, wherein before obtaining the domain name resolution request initiated by the client for the domain name to be resolved, the method further comprises: Intercept the first web browsing request initiated by the client based on the domain name to be resolved; Parse the first web browsing request to obtain the domain name to be resolved; After sending the domain name resolution information of the domain name to be resolved to the client, the method further includes: Based on the domain name resolution information of the domain name to be resolved, the domain name to be resolved in the first web browsing request is replaced with the network address in the domain name resolution information to obtain the second web browsing request; Send the second web browsing request to the network address.
11. A domain name resolution device, comprising: The request retrieval module is configured to retrieve domain name resolution requests initiated by clients for the domain name to be resolved. The DNS resolution query module is configured to search for the DNS resolution information of the domain name to be resolved in the local DNS cache based on the DNS resolution request. The DNS resolution information in the local DNS cache is obtained from the online DNS resolution service based on historical DNS resolution requests. The resolution request module is configured to send the domain name to be resolved to the online domain name resolution service if the domain name resolution information of the domain name to be resolved is not found in the local domain name cache, so as to obtain the domain name resolution information of the domain name to be resolved from the online domain name resolution service; and The result sending module is configured to send the domain name resolution information of the domain name to be resolved to the client and update the domain name resolution information of the domain name to be resolved in the local domain name cache.
12. An electronic device, comprising: processor; Memory for storing the executable instructions of the processor; The processor is configured to execute the domain name resolution method according to any one of claims 1 to 10 by executing the executable instructions.
13. A computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the domain name resolution method as described in any one of claims 1 to 10.
14. A computer program product comprising computer instructions stored in a computer-readable storage medium, wherein a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the domain name resolution method as described in any one of claims 1 to 10.