Domain name resolution method and device, computer equipment, readable storage medium and program product
By intercepting network requests and utilizing a locally stored DNS configuration table with prioritized server forwarding, the method addresses cache failures and network instability, improving DNS resolution speed and stability.
Patent Information
- Application Number
- CN202411588336.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional DNS resolution technologies rely on cache files that can be lost or deleted, leading to slow resolution speeds and instability in weak network environments, particularly due to timeouts and failures of default DNS servers.
A method that intercepts network requests, queries a locally stored DNS resolution configuration table for matching IP addresses, and if none are found, forwards the request to DNS servers in a prioritized sequence until a result is obtained, updating the table with the result for future use.
This approach enhances resolution speed and stability by reducing reliance on external servers, minimizing timeouts, and ensuring fast and reliable DNS resolution even in unstable networks.
Smart Images

Figure CN119155280A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a domain name resolution method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the rapid development of Internet technology, mobile devices have become an indispensable part of daily life. People can use mobile devices for office work, entertainment, and website access. When a mobile device accesses a website on a browser, there is generally a DNS (Domain Name System) resolution process, which is to send a DNS request to the backend DNS server to query the IP address of the application.
[0003] Traditional mobile DNS resolution technology generally performs DNS resolution based on the file cache of its application (such as browser). When performing the first DNS resolution, the DNS request will be forwarded to the default DNS server. The default DNS server of each mobile system may be different. These default DNS servers are located in different locations in the network. The DNS request generally reaches the default DNS server after being transmitted through the network for multiple times, and then the default DNS server returns the query result, or the default DNS server queries the next-level DNS server. If the resolution is successful, the successfully resolved DNS resolution result will be cached to a file. When the DNS resolution is performed again, if there is a corresponding DNS resolution record in the cache file, the recorded DNS resolution result will be directly returned instead of forwarding the network request to the DNS server.
[0004] However, the cached DNS files in traditional technologies may be lost or deleted, resulting in cache failure. In this case, DNS resolution needs to be performed again through the default DNS server. This technology relies on the performance of the default DNS server in the network and the network conditions. It is prone to timeout in a weak network environment, resulting in slow resolution speed, low efficiency, and unstable resolution link. Summary of the invention
[0005] Based on this, it is necessary to provide a domain name resolution method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the resolution speed and resolution stability in response to the above technical problems.
[0006] In a first aspect, the present application provides a domain name resolution method, comprising:
[0007] Intercept the network request of the application and extract the domain name to be resolved in the network request;
[0008] Querying the locally stored DNS resolution configuration table to determine whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, wherein the DNS resolution configuration table is pre-set with a mapping relationship between the domain name and the corresponding IP address;
[0009] If there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, returning the first IP address to the application;
[0010] If there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, the network request is forwarded to the DNS server for resolution until the DNS resolution result corresponding to the network request is obtained, and the DNS resolution result is returned to the application.
[0011] In one embodiment, the step of forwarding the network request to a DNS server for resolution until a DNS resolution result corresponding to the network request is obtained, and returning the DNS resolution result to the application program includes:
[0012] The above network request is forwarded to different DNS servers for resolution in sequence according to the preset service priority until the DNS resolution result corresponding to the above network request is obtained, and the DNS resolution result is returned to the application.
[0013] In one embodiment, a DNS service list is also stored locally, and the DNS service list includes second IP addresses corresponding to multiple DNS servers with different service priorities; the network request is forwarded to different DNS servers for resolution in sequence according to the preset service priorities until the DNS resolution result corresponding to the network request is obtained, and the step of returning the DNS resolution result to the application includes:
[0014] Forwarding the network request to the DNS server corresponding to the second IP address in order of preset service priorities from high to low for resolution, until a single DNS server successfully resolves and obtains a DNS resolution result;
[0015] Receive the fed-back DNS resolution result, and extract a third IP address matching the domain name to be resolved from the DNS resolution result;
[0016] The extracted third IP address is returned to the application.
[0017] In one embodiment, after receiving the feedback DNS resolution result, the method further includes:
[0018] Add the DNS resolution result to the DNS resolution configuration table.
[0019] In one embodiment, before the step of intercepting the network request of the application and extracting the domain name to be resolved in the network request, the following step is further included:
[0020] Create and start a virtual network card for DNS resolution service;
[0021] The steps to intercept an application's network requests include:
[0022] The network request is intercepted by a virtual network card.
[0023] In one embodiment, the steps of creating and starting a virtual network card for a DNS resolution service include:
[0024] Receive a creation instruction for creating a virtual network card;
[0025] Based on the creation instructions, obtain the virtual DNS service address and network routing table;
[0026] Create a virtual network card according to the virtual DNS service address and the network routing table, and allocate corresponding memory to the virtual network card;
[0027] Obtain a DNS resolution configuration table and a DNS service list, and cache the DNS resolution configuration table and the DNS service list in the memory of the virtual network card.
[0028] In a second aspect, the present application also provides a domain name resolution device, including:
[0029] The interception module is used to intercept the network request of the application and extract the domain name to be resolved in the network request;
[0030] A query module is used to query the locally stored DNS resolution configuration table to determine whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, where a mapping relationship between the domain name and the corresponding IP address is preset in the DNS resolution configuration table;
[0031] A return module, configured to return the first IP address to the application program if there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table;
[0032] The forwarding module is used to forward the above network request to the DNS server for resolution if there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, until the DNS resolution result corresponding to the network request is obtained, and return the DNS resolution result to the application.
[0033] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the domain name resolution method in any of the above embodiments are implemented.
[0034] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the domain name resolution method in any of the above embodiments.
[0035] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the domain name resolution method in any of the above embodiments.
[0036] The above-mentioned domain name resolution method, device, computer equipment, computer-readable storage medium and computer program product intercept the network request of the application and extract the domain name to be resolved in the network request; query the locally stored DNS resolution configuration table to determine whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, and the DNS resolution configuration table is preset with a mapping relationship between the domain name and the corresponding IP address; if there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, the first IP address is returned to the application; if not, the network request is forwarded to the DNS server for resolution until the DNS resolution result corresponding to the network request is obtained, and then the DNS resolution result is returned to the application. After intercepting the network request, the local pre-stored DNS resolution configuration table is queried to obtain the IP address that matches the domain name to be resolved. Therefore, the DNS resolution process is completed locally first. Only when the IP address that matches the domain name to be resolved does not exist in the DNS resolution configuration table, the DNS server is needed to complete the resolution. There is no need to forward the network request to an external DNS server every time, which reduces the file reading and writing operations. Therefore, the IP address corresponding to the domain name can be quickly returned, which greatly improves the domain name resolution speed and reduces the dependence on external DNS servers, thereby reducing the occurrence of DNS resolution failures and timeouts caused by DNS server failures, and improving the stability of resolution. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0038] FIG1 is a diagram of an application environment of a domain name resolution method according to an embodiment;
[0039] Figure 2 A schematic diagram of a flow chart of a domain name resolution method in one embodiment;
[0040] Figure 3 A flowchart of the steps of forwarding a network request to different DNS servers for resolution in one embodiment;
[0041] Figure 4 A flowchart of steps for creating and starting a virtual network card for a DNS resolution service in one embodiment;
[0042] Figure 5 A schematic diagram of a process of performing domain name resolution for a network request sent by a browser in one embodiment;
[0043] Figure 6 is a structural block diagram of a domain name resolution device in one embodiment;
[0044] FIG. 7 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The domain name resolution method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. At least one server 104 is a DNS server. An application that can issue a network request is set on the terminal 102, and a DNS resolution configuration table is pre-stored, in which a mapping relationship between a domain name and a corresponding IP address is preset. The terminal 102 can intercept the network request of the application, extract the domain name to be resolved, and then query the locally stored DNS resolution configuration table to determine whether there is a first IP address that matches the domain name to be resolved. In the case where the terminal 102 has a first IP address that matches the domain name to be resolved in the DNS resolution configuration table, the first IP address is directly returned to the above-mentioned application. When there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, terminal 102 forwards the network request to the DNS server until the DNS resolution result corresponding to the network request is obtained, and then terminal 102 returns the obtained DNS resolution result to the application.
[0047] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0048] In an exemplary embodiment, Figure 2 As shown, a domain name resolution method is provided, which is described by taking the method applied to the terminal in FIG. 1 as an example, and includes the following steps:
[0049] S202, intercepting the network request of the application program, and extracting the domain name to be resolved in the network request.
[0050] The application may be various applications pre-set in the terminal 102, such as social media applications, instant messaging applications, image processing applications, reading applications, e-shopping applications, entertainment applications, financial management applications, etc. These applications are installed in the terminal 102, and the user can send various network requests with the help of the application, and the network request may carry the domain name to be resolved. Taking the application as a browser as an example, the user enters a domain name such as www.aa.com in the browser, and the browser initiates a DNS query request for www.aa.com, and the query request carries the domain name www.aa.com to be resolved.
[0051] Optionally, the terminal 102 may intercept the network request of the application program through a preset virtual device, and the virtual device may be configured by a user on the terminal 102. For example, the virtual device may be a virtual network card capable of providing a DNS resolution service.
[0052] S204, querying the locally stored DNS resolution configuration table to determine whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, wherein a mapping relationship between the domain name and the corresponding IP address is preset in the DNS resolution configuration table.
[0053] Specifically, the terminal 102 pre-stores a DNS resolution configuration table, in which a mapping relationship between a domain name and a corresponding IP address is preset. Of course, the DNS resolution configuration table can also store historical access records, such as the domain name and its corresponding IP address when a user successfully accesses a network using an application. Optionally, the DNS resolution configuration table can use a data structure similar to a keymap (keyboard mapping or key map), such as an array, for example, {"www.baidu.com": "192.178.0.3", "sina.cn": "87.10.29.1", "www.aa.com": "1.2.3.4"}.
[0054] It is understandable that the specific form of the DNS resolution configuration table is not limited thereto, and may also be other data structures commonly used in the art, which are not listed here one by one.
[0055] S206: If there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, the first IP address is returned to the application.
[0056] Still taking the domain name www.aa.com to be resolved as an example, if the domain name www.aa.com and its corresponding IP address 1.2.3.4 are found in the DNS resolution configuration table, 1.2.3.4 is returned to the browser. The browser further uses the IP address 1.2.3.4 to send a network access request, thereby interacting with the server associated with the IP address.
[0057] S208, if there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, the network request is forwarded to the DNS server for resolution until the DNS resolution result corresponding to the network request is obtained, and the DNS resolution result is returned to the application.
[0058] Specifically, when there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, the terminal 102 further forwards the network request to an external DNS server to request the DNS server to resolve the domain name to be resolved of the network request, and when the DNS server obtains the resolution result, it feeds back to the terminal 102, and the terminal 102 further feeds back the received DNS resolution result to the application. Of course, if the DNS server still cannot successfully resolve, it can feed back a prompt message of resolution failure to the terminal 102, and the terminal 102 can feed back to the application that the resolution result cannot be obtained, and the application also sends a prompt message such as inaccessible or access failed.
[0059] The above-mentioned domain name resolution method intercepts the network request of the application, extracts the domain name to be resolved in the network request, queries the locally stored DNS resolution configuration table, determines whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, and returns the first IP address to the application if there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table. If not, the network request is forwarded to the DNS server for resolution until the DNS resolution result corresponding to the network request is obtained, and then the DNS resolution result is returned to the application. Since the IP address matching the domain name to be resolved is first obtained by querying the locally pre-stored DNS resolution configuration table after intercepting the network request, the DNS resolution process is first completed locally. Only when there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, the resolution needs to be completed with the help of the DNS server. It is not necessary to forward the network request to the external DNS server every time, which reduces the file reading and writing operations, and thus can quickly return the IP address corresponding to the domain name, greatly improving the domain name resolution speed and reducing the dependence on the external DNS server, thereby also reducing the occurrence of DNS resolution failures and timeouts caused by DNS server failures, and improving the stability of resolution.
[0060] In actual applications, if there is only one default DNS server to resolve the forwarded network request, in a weak network environment, that is, an environment with unstable network quality, it is still easy for the default DNS server to fail, resulting in DNS resolution failure and timeout. Therefore, in order to further improve the stability and query efficiency of the query link, in an exemplary embodiment, S208 includes:
[0061] S302, forwarding the network request to different DNS servers for resolution in sequence according to preset service priorities until a DNS resolution result corresponding to the network request is obtained, and returning the DNS resolution result to the application.
[0062] Among them, the terminal 102 can interact with multiple different DNS servers, and these DNS servers are respectively configured with different service priorities. When the terminal 102 needs to forward the network request to the DNS server, it can forward the network request to the DNS server according to the pre-configured server priority. As long as any DNS server successfully resolves and obtains the corresponding DNS resolution result, the forwarding is terminated, and the DNS server that successfully resolves and obtains the DNS resolution result feeds back the resolution result to the terminal 102, and the terminal 102 feeds back the received DNS resolution result to the above-mentioned application. In this way, the problem of DNS resolution failure and timeout caused by the failure of the default DNS server can be avoided, and the stability and query efficiency of the query link are improved.
[0063] In one embodiment, a DNS service list is also stored locally, and the DNS service list includes second IP addresses corresponding to multiple DNS servers with different service priorities. Figure 3 As shown, S302 also includes:
[0064] S312, forwarding the above network request in order from high to low preset service priorities to the DNS server corresponding to the second IP address for resolution, until a single DNS server successfully resolves and obtains a DNS resolution result.
[0065] Exemplarily, the terminal 102 stores a DNS service list, which includes second IP addresses corresponding to multiple DNS servers with different service priorities. The DNS service list can be in the form of an array, and the order of the second IP addresses in the array represents the service priority of the corresponding server, for example, ["10.3.2.4", "8.8.8.8", "10.10.10.10"], where the three second IP addresses correspond to three DNS servers A, B, and C respectively, and the service priorities of these three servers are in the order of A>B>C in the DNS service list. Not limited to this, the DNS service list can also be a data structure in other forms, and priority identifiers can be added to the second IP addresses therein to represent different service priorities.
[0066] To give a further example, the terminal 102 first forwards the network request to the DNS server A corresponding to the second IP address 10.3.2.4 with the highest priority for resolution. If server A can successfully obtain the resolution result, it will end the forwarding and feedback the resolution result to the terminal 102. If the resolution fails, it needs to be further forwarded to the DNS server B corresponding to the second priority 8.8.8.8 for resolution. Similarly, if server B successfully resolves, it will feedback the resolution result to the terminal 102. If the resolution fails, it will continue to forward to the DNS server C corresponding to the third priority 10.10.10.10. The above process is repeated until the resolution result is obtained or the resolution fails in the end.
[0067] S314, receiving the fed-back DNS resolution result, and extracting a third IP address matching the domain name to be resolved from the DNS resolution result.
[0068] After a single DNS server successfully resolves and obtains a DNS resolution result, it feeds back the resolution result to the terminal 102. The terminal 102 receives the DNS resolution result and extracts a third IP address matching the domain name to be resolved.
[0069] S316: Return the extracted third IP address to the application.
[0070] Exemplarily, the terminal 102 can process the extracted third IP address accordingly, for example, reconstruct the IP message, write it back to the virtual device, send it to the system network layer, and finally return it to the corresponding application. In addition, the above step S206 can also have a similar processing process before returning the first IP address to the application.
[0071] In this embodiment, by storing the DNS service list locally, when there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, the terminal can also forward the network request to the DNS server corresponding to the second IP address according to the second IP address corresponding to multiple DNS servers with different service priorities in the DNS service list for resolution. This not only can manually control the forwarding priority of the network request, ensure the fastest DNS resolution link, and maximize the stability of the query link, but also avoid the problems of DNS resolution failure and timeout caused by failure of the default DNS server, greatly improving the stability of the query link and query efficiency, and will not change the existing domain name public network resolution record configuration.
[0072] In one embodiment, Figure 3 As shown, after the step of receiving the DNS resolution result of the feedback, the following step is also included:
[0073] S318, adding the DNS resolution result to the DNS resolution configuration table.
[0074] Among them, after the terminal 102 receives the DNS resolution result fed back by the successfully resolved DNS server, it also adds the DNS resolution result to the DNS resolution configuration table, so that the DNS resolution configuration table can be continuously updated, thereby improving the accuracy of the information therein, and also facilitating the next visit to the domain name to directly obtain the corresponding resolution result from the DNS resolution configuration table, thereby reducing dependence on external DNS servers.
[0075] In one embodiment, the following step is also included before S202: creating and starting a virtual network card for DNS resolution service.
[0076] S202 also includes: intercepting the network request through a virtual network card.
[0077] In a preferred embodiment, Figure 4 As shown, the steps of creating and starting a virtual network card for DNS resolution service include:
[0078] S402, receiving a creation instruction for creating a virtual network card.
[0079] Optionally, the terminal 102 may receive a creation instruction for instructing to create a virtual network card, for example, the terminal has an interface element for receiving the creation instruction, or the terminal may receive a voice control instruction or a gesture control instruction for creating a virtual network card. For example, an App may be pre-installed in the terminal 102, and the App may display some operable interface elements, such as buttons, and the buttons may carry prompt information such as "start creating", and the creation instruction of the virtual network card may be received through the relevant buttons on the App.
[0080] S404, based on the creation instruction, obtain a virtual DNS service address and a network routing table.
[0081] Exemplarily, the virtual DNS service address can be a pre-configured IP address or an IP address set by the user. Similarly, the network routing table can be a pre-configured electronic table or a database-like table or a database-like table set by the user. The pre-configured virtual DNS service address and network routing table can be stored in other servers, and the terminal 102 obtains the virtual DNS service address and network routing table by interacting with the corresponding server. If the user sets the DNS service address and the network routing table by himself, an interface for the user to set can be displayed in the terminal 102.
[0082] S406, creating a virtual network card according to the virtual DNS service address and the network routing table, and allocating corresponding memory to the virtual network card.
[0083] After the terminal 102 creates a virtual network card according to the virtual DNS service address and the network routing table, it is necessary to allocate the required memory space for the virtual network card. For example, a part of its physical memory can be used as the memory of the virtual network card.
[0084] S408, obtaining a DNS resolution configuration table and a DNS service list, and caching the DNS resolution configuration table and the DNS service list into the memory of the virtual network card.
[0085] Optionally, the DNS resolution configuration table and the DNS service list may be pre-stored in a data center, which is located in an external server, and the terminal 102 obtains the DNS resolution configuration table and the DNS service list by interacting with the external server. The DNS resolution configuration table and the DNS service list may support an editing function, and the terminal 102 may receive edits and changes to the obtained DNS resolution configuration table and the DNS service list. The terminal 102 caches the DNS resolution configuration table and the DNS service list to the memory of the virtual network card, thereby completing the creation and startup of the virtual network card.
[0086] In this embodiment, by receiving a creation instruction, a virtual DNS service address and a network route are obtained based on the creation instruction, and then a virtual network card is created and memory is allocated for it according to the virtual DNS service address and the network routing table, and then the obtained DNS resolution configuration table and DNS service list are cached in the memory of the virtual network card to complete the creation and startup of the virtual network card. The virtual network card has functions similar to those of an external DNS resolution server, so that the terminal 102 intercepts network requests locally through the virtual network card, so that the DNS resolution process occurs locally first, reducing file read and write operations and improving the DNS resolution speed.
[0087] In order to more clearly understand the solution of this application, here we take the application scenario of domain name resolution for network requests issued by browsers as an example. Figure 5 The details are as follows:
[0088] like Figure 5 As shown, step 1, create a virtual network card; step 2, start the DNS resolution service provided by the virtual network card; step 3, set the virtual DNS service address and routing table, and allocate memory for the virtual network card; step 4, obtain the DNS resolution configuration table and DNS service list from the data center, and cache them in the aforementioned memory. At this point, the DNS resolution service of the virtual network card has been prepared.
[0089] In step 5, the browser initiates a network request carrying the domain name www.aa.com; in step 6, the virtual network card intercepts the network request; in step 7, query the DNS resolution configuration table in the above memory to determine whether there is an IP address record of www.aa.com; if so, go to step 8, if not, go to step 11; in step 8, directly return the IP address corresponding to www.aa.com; in step 9, reconstruct the IP message; in step 10, write it back to the virtual network card, and then feed it back upward through the system network layer, and finally return the DNS resolution result to the browser; in step 11, forward it to the corresponding DNS server for resolution in sequence according to the priority in the DNS service list until step 12, obtain the DNS resolution result, and then go to step 9 to reconstruct the IP message and repeat the subsequent steps to return the DNS resolution result to the browser; at the same time, after obtaining the DNS resolution result in step 12, step 13 is also executed to add the DNS resolution result to the DNS resolution configuration table.
[0090] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0091] Based on the same inventive concept, the embodiment of the present application also provides a domain name resolution device for implementing the domain name resolution method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more domain name resolution device embodiments provided below can refer to the limitations on the domain name resolution method above, and will not be repeated here.
[0092] In an exemplary embodiment, Figure 6 As shown, a domain name resolution device is provided, including: an interception module 10, a query module 20, a return module 30 and a forwarding module 40, wherein:
[0093] The interception module 10 is used to intercept the network request of the application program and extract the domain name to be resolved in the network request.
[0094] The query module 20 is used to query the locally stored DNS resolution configuration table to determine whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table. The DNS resolution configuration table is pre-set with a mapping relationship between the domain name and the corresponding IP address.
[0095] The return module 30 is used to return the first IP address to the application if there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table.
[0096] The forwarding module 40 is used to forward the above network request to the DNS server for resolution if there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, until the DNS resolution result corresponding to the network request is obtained, and return the DNS resolution result to the application.
[0097] In one embodiment, the forwarding module 40 is also used to forward the above network request to different DNS servers for resolution in sequence according to preset service priorities until the DNS resolution result corresponding to the above network request is obtained, and the DNS resolution result is returned to the application.
[0098] In one embodiment, the forwarding module 40 is also used to forward the above-mentioned network request in sequence according to the preset service priority from high to low to the DNS server corresponding to the second IP address for resolution until a single DNS server successfully resolves and obtains the DNS resolution result; receives the feedback DNS resolution result, and extracts the third IP address matching the domain name to be resolved from the DNS resolution result; and returns the extracted third IP address to the application.
[0099] In one embodiment, the domain name resolution device further includes:
[0100] Add module to add DNS resolution results to the DNS resolution configuration table.
[0101] In one embodiment, the domain name resolution device further includes:
[0102] Create a module to create and start a virtual network card for DNS resolution service.
[0103] The interception module 10 is also used to intercept the network request through a virtual network card.
[0104] In one embodiment, the above-mentioned creation module is also used to receive a creation instruction for creating a virtual network card; based on the creation instruction, obtain a virtual DNS service address and a network routing table; create a virtual network card according to the virtual DNS service address and the network routing table, and allocate corresponding memory to the virtual network card; obtain a DNS resolution configuration table and a DNS service list, and cache the DNS resolution configuration table and the DNS service list to the memory of the virtual network card.
[0105] Each module in the above-mentioned domain name resolution device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0106] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a domain name resolution method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0107] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0108] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0109] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0110] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0111] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0112] It can be understood by a person skilled in the art that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0113] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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 application.
[0114] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A domain name resolution method, characterized in that: The method comprises: Intercept the network request of the application and extract the domain name to be resolved in the network request; Querying a locally stored DNS resolution configuration table to determine whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, wherein the DNS resolution configuration table is pre-set with a mapping relationship between the domain name and the corresponding IP address; If there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, returning the first IP address to the application; If there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, the network request is forwarded to the DNS server for resolution until the DNS resolution result corresponding to the network request is obtained, and the DNS resolution result is returned to the application.
2. The method according to claim 1, characterized in that The step of forwarding the network request to the DNS server for resolution until a DNS resolution result corresponding to the network request is obtained, and returning the DNS resolution result to the application program includes: The network request is forwarded to different DNS servers for resolution in sequence according to the preset service priority until the DNS resolution result corresponding to the network request is obtained, and the DNS resolution result is returned to the application.
3. The method according to claim 2, characterized in that A DNS service list is also stored locally, and the DNS service list includes second IP addresses corresponding to multiple DNS servers with different service priorities; The step of forwarding the network request to different DNS servers for resolution in sequence according to preset service priorities until a DNS resolution result corresponding to the network request is obtained, and returning the DNS resolution result to the application comprises: Forwarding the network request to the DNS server corresponding to the second IP address in order of preset service priorities from high to low for resolution, until a single DNS server successfully resolves and obtains a DNS resolution result; Receive the fed-back DNS resolution result, and extract a third IP address matching the domain name to be resolved from the DNS resolution result; The extracted third IP address is returned to the application.
4. The method according to claim 3, characterized in that After receiving the DNS resolution result fed back, the method further includes: The DNS resolution result is added to the DNS resolution configuration table.
5. The method according to any one of claims 1 to 4, characterized in that: Before the step of intercepting the network request of the application and extracting the domain name to be resolved in the network request, the method further includes: Create and start a virtual network card for DNS resolution service; The steps of intercepting the network request of the application program include: The network request is intercepted by the virtual network card.
6. The method according to claim 5, characterized in that The steps of creating and starting a virtual network card for a DNS resolution service include: Receiving a creation instruction for creating the virtual network card; Based on the creation instruction, obtain a virtual DNS service address and a network routing table; According to the virtual DNS service address and the network routing table, create the virtual network card and allocate corresponding memory to the virtual network card; Obtain a DNS resolution configuration table and a DNS service list, and cache the DNS resolution configuration table and the DNS service list in the memory of the virtual network card.
7. A domain name resolution device, characterized in that: The device comprises: An interception module, used to intercept the network request of the application and extract the domain name to be resolved in the network request; A query module, used to query a locally stored DNS resolution configuration table to determine whether there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table, wherein a mapping relationship between a domain name and a corresponding IP address is preset in the DNS resolution configuration table; A return module, configured to return the first IP address to the application if there is a first IP address matching the domain name to be resolved in the DNS resolution configuration table; The forwarding module is used to forward the network request to the DNS server for resolution if there is no IP address matching the domain name to be resolved in the DNS resolution configuration table, until the DNS resolution result corresponding to the network request is obtained, and return the DNS resolution result to the application.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Domain name resolution method and device
CN106506715A
Network access method and device of application program, computer equipment and storage medium
CN110224996A
Domain name resolution method and device, computer equipment and storage medium
CN110602270A
Data processing method and system, proxy device and terminal device
CN114710560A
Fallback procedures for domain name server update in a mobile IP registration
US20110295940A1
