Response method and device of DNS server, equipment and medium
By receiving user requests in the DNS server, determining the target device and obtaining the request results, the existing DNS response speed is solved and the problem of low fault tolerance is achieved, and a DNS proxy service with fast response and high fault tolerance is realized.
Patent Information
- Application Number
- CN202510515963.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-04-23
AI Technical Summary
现有的DNS响应方法存在响应速度慢、容错率较低的问题。
By receiving a user request, the corresponding identification of the user request is determined, and the corresponding target device and its target identification are determined based on the identification and multiple preset devices. Get the request result of the user request and determine whether the target device has obtained the request result within the preset time limit. If the request result is obtained, the data type of the request result is judged and the device to be obtained is determined; if the request result is not obtained, the device to be requested and its device identification is determined, and the device to be obtained is determined based on the target identification and device identification. According to the device to be obtained, the target request result is obtained, and the target request result is sent to the user requesting the corresponding terminal.
By selecting the DNS server, the response speed to user requests is improved, and the dual-stack compatibility of IPv4/IPv6 and the automatic switching of IP types are achieved, which improves the fault tolerance of DNS proxy.
Smart Images

Figure CN120034581A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of DNS proxy technology, and in particular to a response method, device, equipment and medium of a DNS server. Background Art
[0002] DNS proxy is a network proxy service that acts as an intermediary between the client and the DNS server, and is mainly used to forward DNS query requests and responses.
[0003] If the DNS response is abnormal, the existing method generally involves checking the device settings or clearing the DNS cache.
[0004] However, existing processing methods have the problems of slow response speed and low fault tolerance. Summary of the invention
[0005] The present application provides a DNS server response method, device, equipment and medium to solve the problems of slow response speed and low fault tolerance in existing processing methods.
[0006] In a first aspect, the present application provides a DNS server response method, the method comprising: Receive a user request and determine an identifier corresponding to the user request; Determine the corresponding target device and its target identifier according to the identifier and the plurality of preset devices, and obtain the request result of the user request according to the target device; Determine whether the target device obtains the request result within a preset time limit; If the request result is obtained, the data type of the request result is determined, and based on the data type and the target identifier, the device to be obtained in the preset devices is determined; If the request result is not obtained, the device to be requested and its device identifier in the preset devices are determined, and the device to be obtained is determined according to the target identifier and the device identifier; According to the device to be acquired, the target request result is obtained, and the target request result is sent to the terminal corresponding to the user request.
[0007] In some embodiments of the present application, according to the identifier and multiple preset devices, determining the corresponding target device and its target identifier, and obtaining the request result of the user request according to the target device, includes: Determine the device identification of the preset device, and determine the target device identification that is the same as the identification in the device identification; Determine the preset priority corresponding to the target device identification, and compare the preset priority to obtain a comparison result; According to the comparison result, determine the target device identifier with the highest preset priority, and determine the preset device corresponding to the target device identifier as the target device; The device identifier of the target device is determined as the target identifier, and a request result of the user request is obtained according to the target device.
[0008] In some embodiments of the present application, if a request result is obtained, the data type of the request result is determined, and based on the data type and the target identifier, the device to be obtained in the preset device is determined, including: If the request result is obtained, determine the data type of the request result; If the data type does not include the target data type, determining the device identification of the preset device, and determining the device identification to be obtained that is different from the target identification among the device identifications; Determine the preset priority corresponding to the device identification to be acquired, and determine the device identification to be acquired with the highest preset priority as the target device identification to be acquired; Determine that the preset device corresponding to the target to-be-acquired device identifier is the to-be-acquired device; If the data type includes a target data type, the request result is determined to be a target request result, and the target request result is sent to a terminal corresponding to the user request.
[0009] In some embodiments of the present application, if the request result is not obtained, the device to be requested and its device identifier in the preset device are determined, and the device to be obtained is determined according to the target identifier and the device identifier, including: Determine a device among preset devices that has not sent a user request as a device to be requested; Determine the device ID of the device to be requested, and compare the device ID with the target ID to obtain a comparison result; According to the comparison results, the device to be acquired is determined.
[0010] In some embodiments of the present application, determining the device to be acquired according to the comparison result includes: Determine the comparison result; If the comparison result is that there is an identifier in the device identifier that is the same as the target identifier, then the requested device corresponding to the same identifier is determined to be the target requested device; If the comparison result is that there is no device identifier that is identical to the target identifier, then all the devices to be requested are determined to be the target devices to be requested; The preset priorities corresponding to the target devices to be requested are determined, and the target device to be requested with the highest preset priority is determined as the device to be obtained.
[0011] In some embodiments of the present application, the method further includes: Determine a deadline corresponding to the user request, where the deadline is longer than a preset deadline; If the target request result is not sent to the terminal corresponding to the user request within the deadline, determine the device to which the user request has been sent in the preset devices, and determine the target device in the device that has not obtained the request result of the user request; The target device is determined to be an unreachable device, which is a device that cannot receive the user request.
[0012] In some embodiments of the present application, after determining that the target device is an unreachable device, the method further includes: Determine the preset detection time; According to the detection time, send a detection request to the unreachable device, and determine the preset time limit and deadline corresponding to the detection request; Determine the acquisition result of the unreachable device in response to the detection request according to the preset time limit and the deadline; If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, the unreachable device is adjusted to a reachable device, and the priority of the reachable device is determined to be higher than other preset devices. The reachable device is a device that can receive the user request; If the acquisition result is that the unreachable device obtains the detection result outside the preset time limit but within the deadline, the unreachable device is adjusted to a reachable device, and the priority of the reachable device is determined to be lower than other preset devices; If the device is unreachable and the detection result is not obtained within the deadline, it will still be determined as an unreachable device.
[0013] In a second aspect, the present application provides a response device of a DNS server, the device comprising: A receiving module, used to receive a user request and determine an identifier corresponding to the user request; The identification determination and result acquisition module is used to determine the corresponding target device and its target identification according to the identification and multiple preset devices, and obtain the request result of the user's request according to the target device; An acquisition judgment module is used to judge whether the target device obtains the request result within a preset time limit; A data type determination module is used to determine the data type of the request result if a request result is obtained, and determine the device to be obtained in the preset devices based on the data type and the target identifier; The device acquisition module to be requested is used to determine the device to be requested and its device identification in the preset devices if the request result is not obtained, and determine the device to be obtained according to the target identification and the device identification; The sending module is used to obtain the target request result according to the device to be obtained, and send the target request result to the terminal corresponding to the user request.
[0014] In a third aspect, the present application provides a computer device, comprising: a processor, and a memory communicatively connected to the processor; Memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method of the present application.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium, in which program code is stored, and when the program code is executed by a processor, it is used to implement the method of the present application.
[0016] The DNS server response method, apparatus, device and medium provided in the present application receive a user request and determine an identifier corresponding to the user request; determine a corresponding target device and its target identifier according to the identifier and multiple preset devices, and obtain a request result of the user request according to the target device; determine whether the target device obtains the request result within a preset time limit; if the request result is obtained, determine the data type of the request result, and determine the device to be obtained in the preset device based on the data type and the target identifier; if the request result is not obtained, determine the device to be requested and its device identifier in the preset device, and determine the device to be obtained according to the target identifier and the device identifier; obtain the target request result according to the device to be obtained, and send the target request result to the terminal corresponding to the user request.
[0017] In this way, by determining the preset time limit corresponding to the DNS server, the acquisition of the request result within the preset time limit can be determined, and according to the identifier of the DNS server, the new server corresponding to the different acquisition situations can be determined, so that the request result corresponding to the user request can be obtained again according to the new server, thereby realizing the optimal selection of the DNS server and improving the response speed to the user request; at the same time, it realizes IPv4 / IPv6 dual stack compatibility, automatically switches the IP type, and improves the fault tolerance rate of the DNS proxy. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0019] Figure 1 A schematic diagram of a flow chart of a DNS server response method provided in an embodiment of the present application; Figure 2 A method diagram of a DNS server response method provided in an embodiment of the present application; Figure 3 A flowchart of another DNS server response method provided in an embodiment of the present application; Figure 4A schematic diagram of the structure of a response device of a DNS server provided in an embodiment of the present application; Figure 5 This is a structural block diagram of a device for executing a response method of a DNS server according to an embodiment of the present application.
[0020] The above-mentioned drawings have shown clear embodiments of the present application, which will be described in more detail below; these drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0021] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0022] DNS proxy is a service or technology that forwards DNS requests to other DNS servers. The DNS proxy server acts as an intermediary between the client and the target DNS server. When the client sends a DNS request, it does not send it directly to the locally configured DNS server, but sends the request to the DNS proxy server. After receiving the request, the proxy server queries the real DNS server on behalf of the client and returns the obtained result to the client.
[0023] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0024] Figure 1 A schematic diagram of a DNS server response method provided in an embodiment of the present application. Figure 1 As shown, the response method of the DNS server may include the following steps: S110: Receive a user request and determine an identifier corresponding to the user request.
[0025] Among them, the user request is a request sent by the user end. The user end sends the user request to the DNS server, thereby obtaining the information corresponding to the user request through the DNS server. The user's DNS request can be added to the linked list so that the corresponding request result can be obtained later according to the request in the linked list.
[0026] The identifier can be understood as a specific number used for distinction and identification, and can be the IP Internet Protocol (IP) of the user end corresponding to the user request, such as IPv4 or IPv6.
[0027] Based on this, by receiving the user request and determining the identifier of the user terminal corresponding to the user request, the corresponding DNS server is determined to forward the user request according to the identifier of the user request, thereby obtaining the corresponding request result and sending it to the user terminal to meet the user's usage needs.
[0028] S120: Determine a corresponding target device and its target identifier according to the identifier and multiple preset devices, and obtain a request result of the user's request according to the target device.
[0029] The preset device is a pre-set device used to receive and forward user requests, and may be a DNS server.
[0030] The target device is a device corresponding to the identifier of the user request in the preset devices, and is used to forward the user request. For example, the identifier of the user request may be IPv4, and the target device may be an IPv4 DNS server.
[0031] The request result is the corresponding response or feedback information obtained after sending the user request. It is the final presentation of the request operation and may include the information required by the user request.
[0032] Based on this, by determining the identifier corresponding to the user request, the server corresponding to the identifier in the preset DNS server, that is, the target device, is determined, and the user request is forwarded according to the target device to obtain the request result, so that the new DNS server can be determined according to the target identifier of the target device according to the different acquisition situations of the request result, so as to forward the user request again and improve the response speed.
[0033] S130: Determine whether the target device obtains the request result within a preset time limit.
[0034] The preset time limit is a preset time limit, which can be understood as a preset processing time of the DNS server for the user request. For example, the preset time limit may be 5 seconds.
[0035] Based on this, by determining whether the DNS server obtains the request result within the preset time limit, it is determined whether the DNS server completes the response to the user request within the specified time, so that the corresponding new DNS server can be determined according to the different response situations based on the DNS server's response to the user request within the specified time, so that the user request can be forwarded again according to the new DNS server, thereby speeding up the processing of user requests, improving the resource utilization of the DNS server, enhancing the fluency of use, and better meeting user needs.
[0036] S140: If a request result is obtained, determine the data type of the request result, and determine the device to be obtained in the preset devices based on the data type and the target identifier.
[0037] The data type is a type corresponding to the data included in the request result, for example, it may include a type type or a cname type.
[0038] The device to be obtained is a DNS server that can be used to forward the user request again.
[0039] Based on this, by judging whether the DNS server obtains the request result within the preset time limit, the data type included in the request result is determined when the request result is obtained, so as to determine the DNS server that can forward the user request again based on the data type of the request result and the identifier of the DNS server. For example, the preset time limit can be 5 seconds. If the DNS server obtains the request result corresponding to the user request within 5 seconds, it is further judged whether the request result includes data of type type, so as to determine the server that can forward the user request again from the preset DNS server based on the judgment result of the data type and the target identifier corresponding to the DNS server.
[0040] S150: If the request result is not obtained, determine the device to be requested and its device identifier in the preset device, and determine the device to be obtained according to the target identifier and the device identifier.
[0041] The device to be requested is a server in the preset DNS server that has not forwarded the user request, and the device identifier is the IP identifier corresponding to the server.
[0042] Based on this, if the target DNS server does not obtain the corresponding request result within the preset time limit, it determines the server in the preset DNS server that has not forwarded the user request, and then determines the DNS server that can forward the user request again based on the identifier of the target DNS server and the identifier of the server that has not forwarded the request, so that the user request can be forwarded again according to this DNS server later.
[0043] S160: Obtain a target request result according to the device to be acquired, and send the target request result to a terminal corresponding to the user request.
[0044] The target request result is the response result of the DNS server to the user request.
[0045] Based on this, the user request is forwarded again through the device to be obtained, so as to obtain the corresponding request result and send it to the user end to complete this DNS response.
[0046] Based on the feasible implementation of S120 above, the present application further provides a process of determining a corresponding target device and its target identifier according to an identifier and multiple preset devices, and obtaining a request result of a user request according to the target device: Determine the device identification of the preset device, and determine the target device identification that is the same as the identification in the device identification; Determine the preset priority corresponding to the target device identification, and compare the preset priority to obtain a comparison result; According to the comparison result, determine the target device identifier with the highest preset priority, and determine the preset device corresponding to the target device identifier as the target device; The device identifier of the target device is determined as the target identifier, and a request result of the user request is obtained according to the target device.
[0047] The same identifier means that the IP of the DNS server is the same. For example, the device identifier of the preset device may include IPv4 and IPv6. If the IP corresponding to the user request is IPv4, then IPv4 in the preset device is determined as the target device identifier.
[0048] The preset priority is a pre-set forwarding priority of the device. It can be understood that a DNS server with a high priority obtains requests faster. Therefore, when determining the DNS server to forward user requests, a DNS server with a high priority will be selected for forwarding according to the preset priority order, thereby increasing the speed of obtaining request results. Furthermore, the servers can also be set to have the same priority in the initial state, and the primary server can be selected first when forwarding user requests.
[0049] Based on this, by determining the IP identifier corresponding to the user request, the server with the same IP as the user request is determined in the preset DNS server, and the preset priorities of these servers are further determined, so as to determine the server with the highest priority as the target device, and determine the corresponding target identifier, so as to obtain the request result according to the target device, thereby speeding up the acquisition of the request result.
[0050] Based on the feasible implementation of S140 above, the present application further provides a process of determining the data type of the request result if the request result is obtained, and determining the device to be obtained in the preset device based on the data type and the target identifier: If the request result is obtained, determine the data type of the request result; If the data type does not include the target data type, determining the device identification of the preset device, and determining the device identification to be obtained that is different from the target identification among the device identifications; Determine the preset priority corresponding to the device identification to be acquired, and determine the device identification to be acquired with the highest preset priority as the target device identification to be acquired; Determine that the preset device corresponding to the target to-be-acquired device identifier is the to-be-acquired device; If the data type includes a target data type, the request result is determined to be a target request result, and the target request result is sent to a terminal corresponding to the user request.
[0051] Among them, determining the data type of the request result can be understood as determining whether the request result includes the target data type. The target data type is used to determine whether the obtained request result meets the user request and can be a response of type type.
[0052] Based on this, if the DNS server obtains the request result within the preset time limit, it can further determine whether the request result contains a response of type type. If it does, it indicates that the request result meets the user's needs, so that the request result can be sent to the terminal corresponding to the user's request, and the DNS server responds to the user's request; if it does not contain it, it indicates that the request result does not meet the needs. For example, there is no corresponding type response in the response, only cname. This situation is more common when using an IPv6 server. In this case, a server of another IP type is determined (for example, if the previous server is an IPv6 C server, a server with a higher priority is selected from A and B), and the user request is forwarded to the locally configured DNS server again through the server, and the request result obtained from the locally configured DNS server is returned to the user end, thereby improving the response speed of the user request.
[0053] Based on the feasible implementation of S150 above, the present application further provides a process of determining the device to be requested and its device identifier in the preset device if the request result is not obtained, and determining the device to be obtained according to the target identifier and the device identifier: Determine a device among preset devices that has not sent a user request as a device to be requested; Determine the device ID of the device to be requested, and compare the device ID with the target ID to obtain a comparison result; According to the comparison results, the device to be acquired is determined.
[0054] Based on this, if the DNS server does not obtain the request result within the preset time limit, it can determine the DNS server that has not forwarded the user request from the preset servers according to the device identifier, and thus obtain the comparison result by comparing the identifier of the target DNS server and the server that has not forwarded the user request, so that the DNS server that can be used to forward the user request again can be determined from the DNS servers that have never forwarded the user request according to the comparison result.
[0055] Based on the feasible implementation of S150 above, the present application further provides a process for determining the device to be acquired according to the comparison result: Determine the comparison result; If the comparison result is that there is an identifier in the device identifier that is the same as the target identifier, then the requested device corresponding to the same identifier is determined to be the target requested device; If the comparison result is that there is no device identifier that is identical to the target identifier, then all the devices to be requested are determined to be the target devices to be requested; The preset priorities corresponding to the target devices to be requested are determined, and the target device to be requested with the highest preset priority is determined as the device to be obtained.
[0056] Based on this, by determining the DNS server that has not forwarded the user request, further comparing the IP identifier of the target DNS server and the IP identifier of the non-forwarded DNS server, it is determined whether the non-forwarded DNS server includes a server with the same identifier as the target. If so, the server with the same identifier is prioritized as the requested device, and further based on the preset priority, the server with the same identifier with the highest priority is determined to forward the user request again. If there is no server with the same identifier, it can also be forwarded through the server with the highest priority.
[0057] Please refer to Figure 2 , Figure 2 A method diagram of a DNS server response method provided in an embodiment of the present application. Figure 2 As shown, the user's DNS request is added to the linked list and the received time is marked. When the server response is received, a long timer is started, and the long timer can be marked with the transaction id. If the user uses IPv4 to access, a reachable and higher priority server is selected from servers A and B. Servers A and B are both IPv4 servers. If IPv6 is used, a server is selected from C and D. Servers C and D are both IPv6 servers. After selecting a server, the user's DNS request is forwarded, and the selected server number is recorded in the linked list. After forwarding, a short timer is started, and a sequence number can be used to mark the short timer.
[0058] If a server response is received, the short timer of the request has not timed out, and the response also contains the required type of response, the timer is canceled, the response is forwarded to the user according to the user information in the linked list, and the server that received the response is set as having received the response. If the server used by the linked list record is the only server that responded, delete the record and the long timer. If there are other servers in the record that have not received information, keep the record.
[0059] If a server response is received and the server short timer has not timed out, but there is no corresponding type response in the response, such as only a cname type response, this situation is more common when using an IPv6 server. Reselect a server of another IP type (for example, if the previous server is an IPv6 C server, select a server with a higher priority from A and B), forward the request again, record the server number in the linked list, and reset the timer.
[0060] If a response is received from the server but the short timer has expired, the server information in the record is set to "received". If there is already a response from another server in the request record, the response is not forwarded. If not, the response is forwarded.
[0061] If the short timer has timed out and no response has been received from the server, another server with the same IP address type is selected to forward the request again and a new short timer is started. The priority of the server with timed out response is reduced by one level.
[0062] If the same type of servers have forwarded the DNS request, for example, IPv6 servers C and D have already forwarded it, then select a server with a higher priority from the other types of servers A and B to forward it, and the server number is also recorded in the linked list, and the short timer is reset. If all servers have forwarded it, if the record contains only a response whose type does not match the request, then forward the response to the user.
[0063] If the long timer has timed out, check whether the request record contains any forwarding that has not received a response, and mark the corresponding server as unreachable.
[0064] In an independent thread, unreachable servers are checked periodically. If the server can respond within a short period of time, the server status is changed to reachable, and the priority is set to the highest priority currently among servers of this type; if it responds within a long period of time, the server status is changed to reachable, and the priority is set to the lowest priority currently among servers of this type.
[0065] In some embodiments of the present application, in order to implement the acquisition of user requests by the DNS server within a preset time limit, and thus perform corresponding DNS responses according to different acquisition situations, the IP identifier corresponding to the user request can be used to determine the DNS server with the same IP identifier for forwarding, and determine whether the DNS server obtains the request result within the preset time. If obtained, it is further determined whether the request result contains target type data. If included, it indicates that the request result meets the user's needs, and the request result can be sent to the user end through the DNS server to achieve a response. If not included, a server with a different IP identifier is determined from other DNS servers to forward the user request again; if not obtained, a server with a different IP identifier among other DNS servers is preferentially determined to forward it again. If servers with different IP identifiers have sent the request, it can also be sent through a server with the same IP identifier. At the same time, when determining the DNS server to send, the priority corresponding to the server is determined, so as to determine a server with a higher priority to send, so as to improve the response speed to the user request.
[0066] In this way, when an exception occurs in the DNS server's acquisition of request results within the preset time limit, a new DNS server can be quickly determined based on the IP identifier and priority to forward the user request again, thereby speeding up the processing of user requests, improving the resource utilization of the DNS server, and realizing automatic switching between two types of IP servers. By selecting the best server, the response speed is improved.
[0067] Figure 3 A flowchart of another DNS server response method provided in an embodiment of the present application. Figure 3 As shown, the response method of the DNS server may include the following steps: S310: Receive a user request and determine an identifier corresponding to the user request.
[0068] S320: Determine a corresponding target device and its target identifier according to the identifier and multiple preset devices, and obtain a request result of the user's request according to the target device.
[0069] S330: Determine whether the target device obtains the request result within a preset time limit.
[0070] S340: If a request result is obtained, determine the data type of the request result, and determine the device to be obtained in the preset devices based on the data type and the target identifier.
[0071] S350: If the request result is not obtained, determine the device to be requested and its device identifier in the preset device, and determine the device to be obtained according to the target identifier and the device identifier.
[0072] S360: Obtain the target request result according to the device to be acquired, and send the target request result to the terminal corresponding to the user request.
[0073] In some embodiments of the present application, the specific implementation of steps S310 to S360 can refer to the contents of the aforementioned embodiments and will not be repeated here.
[0074] S370: Determine a deadline corresponding to the user request, where the deadline is longer than a preset deadline.
[0075] Among them, the deadline is used to determine whether the DNS server can continue to receive user requests. For example, the preset time limit of the DNS server is 5 seconds, and the deadline is 30 seconds. If the user terminal does not receive the target request result sent by the DNS server within 30 seconds, it can be determined that the server that forwarded the user request but did not obtain the request result has an abnormality.
[0076] Based on this, by determining the deadline corresponding to the user request, it is possible to determine whether the DNS server has an abnormality based on the deadline, so as to perform further processing.
[0077] S380: If the target request result is not sent to the terminal corresponding to the user request within the deadline, determine the device to which the user request has been sent in the preset devices, and determine the target device in the device that has not obtained the request result of the user request.
[0078] Based on this, if the user terminal has not received the target request result within the deadline, the DNS server that has forwarded the user request but has not obtained the request result can be determined according to the linked list for subsequent processing.
[0079] S390: Determine that the target device is an unreachable device, where the unreachable device is a device that cannot receive a user request.
[0080] Based on this, if the DNS server that forwarded the user request has not obtained the request result within the deadline, it indicates that the DNS server has an abnormality, so the server is determined to be an unreachable server to prevent the server from receiving user requests, thereby improving the efficiency of other reachable devices in receiving and processing user requests.
[0081] Based on the feasible implementation of S390 above, the present application further provides that after determining that the target device is an unreachable device, the method further includes the following process: Determine the preset detection time; According to the detection time, send a detection request to the unreachable device, and determine the preset time limit and deadline corresponding to the detection request; Determine the acquisition result of the unreachable device in response to the detection request according to the preset time limit and the deadline; If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, the unreachable device is adjusted to a reachable device, and the priority of the reachable device is determined to be higher than other preset devices. The reachable device is a device that can receive the user request; If the acquisition result is that the unreachable device obtains the detection result outside the preset time limit but within the deadline, the unreachable device is adjusted to a reachable device, and the priority of the reachable device is determined to be lower than other preset devices; If the device is unreachable and the detection result is not obtained within the deadline, it will still be determined as an unreachable device.
[0082] The detection time is the time for regularly detecting the unreachable DNS server. For example, the unreachable server may be detected every 2 minutes.
[0083] The detection request is a request used to detect whether the unreachable server has restored normal response.
[0084] Based on this, after the abnormal DNS server is determined as an unreachable device, the unreachable device is detected regularly, so that the server that has returned to normal is adjusted to a server that can receive user requests, and the corresponding priority of the server is adjusted. By periodically detecting the server status, the DNS server can be adjusted in time to better respond to user requests.
[0085] In some embodiments of the present application, by determining the deadline for user requests, a server that has not obtained a request result within the deadline is determined as an abnormal server, and stops receiving user requests, so that user requests can be better responded to through other normal servers and the response speed can be improved. At the same time, by regularly detecting the server status, the server that has returned to normal can be promptly readjusted to a server that normally receives requests, thereby improving the utilization of server resources.
[0086] Figure 4 Schematic diagram of the structure of a response device 400 of a DNS server provided in an embodiment of the present application. Figure 4 As shown, the DNS server response device 400 includes: a receiving module 410, an identification determination and result acquisition module 420, an acquisition judgment module 430, a data type judgment module 440, a requested device acquisition module 450, and a sending module 460.
[0087] The receiving module 410 is used to receive a user request and determine an identifier corresponding to the user request; The identification determination and result acquisition module 420 is used to determine the corresponding target device and its target identification according to the identification and multiple preset devices, and obtain the request result of the user request according to the target device; The acquisition determination module 430 is used to determine whether the target device obtains the request result within a preset time limit; The data type determination module 440 is used to determine the data type of the request result if the request result is obtained, and determine the device to be obtained in the preset devices based on the data type and the target identifier; The device to be requested acquisition module 450 is used to determine the device to be requested and its device identifier in the preset devices if the request result is not obtained, and determine the device to be acquired according to the target identifier and the device identifier; The sending module 460 is used to obtain the target request result according to the device to be obtained, and send the target request result to the terminal corresponding to the user request.
[0088] In the embodiment of the present application, the identification determination and result acquisition module 420 may also be specifically used for: Determine the device identification of the preset device, and determine the target device identification that is the same as the identification in the device identification; Determine the preset priority corresponding to the target device identification, and compare the preset priority to obtain a comparison result; According to the comparison result, determine the target device identifier with the highest preset priority, and determine the preset device corresponding to the target device identifier as the target device; The device identifier of the target device is determined as the target identifier, and a request result of the user request is obtained according to the target device.
[0089] In the embodiment of the present application, the data type determination module 440 may also be specifically used for: If the request result is obtained, determine the data type of the request result; If the data type does not include the target data type, determining the device identification of the preset device, and determining the device identification to be obtained that is different from the target identification among the device identifications; Determine the preset priority corresponding to the device identification to be acquired, and determine the device identification to be acquired with the highest preset priority as the target device identification to be acquired; Determine that the preset device corresponding to the target to-be-acquired device identifier is the to-be-acquired device; If the data type includes a target data type, the request result is determined to be a target request result, and the target request result is sent to a terminal corresponding to the user request.
[0090] In the embodiment of the present application, the device to be requested acquisition module 450 may also be specifically used for: Determine a device among preset devices that has not sent a user request as a device to be requested; Determine the device ID of the device to be requested, and compare the device ID with the target ID to obtain a comparison result; According to the comparison results, the device to be acquired is determined.
[0091] In the embodiment of the present application, the device to be requested acquisition module 450 may also be specifically used for: Determine the comparison result; If the comparison result is that there is an identifier in the device identifier that is the same as the target identifier, then the requested device corresponding to the same identifier is determined to be the target requested device; If the comparison result is that there is no device identifier that is identical to the target identifier, then all the devices to be requested are determined to be the target devices to be requested; The preset priorities corresponding to the target devices to be requested are determined, and the target device to be requested with the highest preset priority is determined as the device to be obtained.
[0092] In the embodiment of the present application, the response device 400 of the DNS server may also be specifically used for: Determine a deadline corresponding to the user request, where the deadline is longer than a preset deadline; If the target request result is not sent to the terminal corresponding to the user request within the deadline, determine the device to which the user request has been sent in the preset devices, and determine the target device in the device that has not obtained the request result of the user request; The target device is determined to be an unreachable device, which is a device that cannot receive the user request.
[0093] In the embodiment of the present application, the response device 400 of the DNS server may also be specifically used for: Determine the preset detection time; Send a detection request to the unreachable device according to the detection time, and determine the preset time limit and deadline corresponding to the detection request; Determine the acquisition result of the unreachable device in response to the detection request according to the preset time limit and the deadline; If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, the unreachable device is adjusted to a reachable device, and the priority of the reachable device is determined to be higher than other preset devices. The reachable device is a device that can receive the user request; If the acquisition result is that the unreachable device obtains the detection result outside the preset time limit but within the deadline, the unreachable device is adjusted to a reachable device, and the priority of the reachable device is determined to be lower than other preset devices; If the device is unreachable and the detection result is not obtained within the deadline, it will still be determined as an unreachable device.
[0094] Figure 5This is a schematic diagram of the structure of the device provided in the embodiment of the present application. Figure 5 As shown, the device 500 includes: The device 500 may include a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a communication component 503 and other components. The processor 501 , the memory 502 and the communication component 503 are connected via a bus 504 .
[0095] In a specific implementation process, at least one processor 501 executes the computer execution instructions stored in the memory 502, so that the at least one processor 501 executes the above-mentioned DNS server response method.
[0096] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0097] Furthermore, the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present application may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
[0098] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0099] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0100] In some embodiments, a computer program product is also proposed, including a computer program or instructions, which implement the steps in any of the above-mentioned DNS server response methods when executed by a processor.
[0101] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0102] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0103] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple program codes are stored. The program codes can be loaded by a processor to execute the steps in any one of the DNS server response methods provided in the embodiments of the present application.
[0104] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0105] According to one aspect of the present application, a computer program product or a computer program is provided. The computer program product or the computer program comprises computer instructions stored in a computer-readable storage medium.
[0106] Since the instructions stored in the storage medium can execute the steps in any one of the DNS server response methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the DNS server response methods provided in the embodiments of the present application can be achieved. For details, please refer to the previous embodiments and will not be repeated here.
[0107] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the above-mentioned claims.
[0108] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A response method of a DNS server, characterized in that: The method comprises: Receive a user request and determine an identifier corresponding to the user request; Determine a corresponding target device and its target identifier according to the identifier and a plurality of preset devices, and obtain a request result of the user request according to the target device; Determine whether the target device obtains the request result within a preset time limit; If the request result is obtained, determining the data type of the request result, and determining the device to be obtained in the preset devices based on the data type and the target identifier; If the request result is not obtained, determining the device to be requested and its device identifier in the preset device, and determining the device to be obtained according to the target identifier and the device identifier; According to the device to be acquired, a target request result is acquired, and the target request result is sent to a terminal corresponding to the user request.
2. The method according to claim 1, characterized in that: The determining, according to the identifier and the plurality of preset devices, a corresponding target device and its target identifier, and obtaining, according to the target device, a request result of the user request, includes: Determine the device identification of the preset device, and determine the target device identification that is the same as the identification in the device identification; Determine a preset priority corresponding to the target device identifier, and compare the preset priority to obtain a comparison result; Determine the target device identifier with the highest preset priority according to the comparison result, and determine that the preset device corresponding to the target device identifier is the target device; The device identifier of the target device is determined to be the target identifier, and a request result of the user request is obtained according to the target device.
3. The method according to claim 1, characterized in that If the request result is obtained, the data type of the request result is determined, and based on the data type and the target identifier, the device to be obtained in the preset device is determined, including: If the request result is obtained, determine the data type of the request result; If the data type does not include the target data type, determining the device identification of the preset device, and determining the device identification to be acquired that is different from the target identification among the device identifications; Determine the preset priority corresponding to the device identification to be acquired, and determine the device identification to be acquired with the highest preset priority as the target device identification to be acquired; Determine that the preset device corresponding to the target to-be-acquired device identifier is the to-be-acquired device; If the data type includes a target data type, the request result is determined to be the target request result, and the target request result is sent to a terminal corresponding to the user request.
4. The method according to claim 1, characterized in that If the request result is not obtained, determining the device to be requested and its device identifier in the preset device, and determining the device to be obtained according to the target identifier and the device identifier, including: Determine that a device among the preset devices that has not sent the user request is the device to be requested; Determine the device identification of the device to be requested, and compare the device identification with the target identification to obtain a comparison result; The device to be acquired is determined according to the comparison result.
5. The method according to claim 4, characterized in that The step of determining the device to be acquired according to the comparison result includes: Determining the comparison result; If the comparison result is that there is an identifier in the device identifiers that is identical to the target identifier, determining that the device to be requested corresponding to the identical identifier is the target device to be requested; If the comparison result is that there is no identifier identical to the target identifier in the device identifiers, then all the devices to be requested are determined to be the target devices to be requested; The preset priority corresponding to the target device to be requested is determined, and the target device to be requested with the highest preset priority is determined as the device to be obtained.
6. The method according to claim 1, characterized in that The method further comprises: Determine a deadline corresponding to the user request, where the deadline is longer than the preset deadline; If the target request result is not sent to the terminal corresponding to the user request within the deadline, determining the device to which the user request has been sent among the preset devices, and determining the target device to which the request result of the user request has not been obtained among the devices; The target device is determined to be an unreachable device, where the unreachable device is a device that cannot receive a user request.
7. The method according to claim 6, characterized in that After determining that the target device is an unreachable device, the method further includes: Determine the preset detection time; Sending a detection request to the unreachable device according to the detection time, and determining the preset time limit and the deadline corresponding to the detection request; Determining, according to the preset time limit and the deadline, an acquisition result of the unreachable device in response to the detection request; If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, the unreachable device is adjusted to a reachable device, and the priority of the reachable device is determined to be higher than that of other preset devices, and the reachable device is a device that can receive user requests; If the acquisition result is that the unreachable device obtains the detection result outside the preset time limit and within the deadline, adjusting the unreachable device to a reachable device, and determining that the priority of the reachable device is lower than that of other preset devices; If the acquisition result is that the unreachable device has not obtained the detection result within the deadline, it is still determined as an unreachable device.
8. A response device of a DNS server, characterized in that: The device comprises: A receiving module, used to receive a user request and determine an identifier corresponding to the user request; An identification determination and result acquisition module, used to determine the corresponding target device and its target identification according to the identification and multiple preset devices, and obtain the request result of the user request according to the target device; An acquisition judgment module is used to judge whether the target device obtains the request result within a preset time limit; A data type determination module, configured to determine the data type of the request result if the request result is obtained, and determine the device to be obtained in the preset devices based on the data type and the target identifier; A device acquisition module to be requested, used for determining the device to be requested and its device identifier in the preset device if the request result is not obtained, and determining the device to be obtained according to the target identifier and the device identifier; The sending module is used to obtain the target request result according to the device to be obtained, and send the target request result to the terminal corresponding to the user request.
9. A device, characterized in that: include: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in a memory and configured to be executed by one or more processors, the one or more programs being configured to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Domain name resolution method and device, computer readable storage medium and computer device
CN111193815A
DNS server selection method and proxy server
CN111262938A
DNS rapid analysis method and device, terminal and medium
CN112153166A
Domain name resolution abnormity detection method and electronic equipment
CN116319113A
Service processing method and device, equipment and storage medium
CN116744279A