Domain name request method and apparatus, storage medium, and electronic device
By acquiring network environment information and querying the locally stored list of domain name IPs or HttpDNS/LocalDNS to resolve domain names, the problem of slow or unresolved domain name resolution under different network environments is solved, achieving fast, stable and secure domain name requests.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN DOUYU NETWORK TECHNOLOGY CO LTD
- Filing Date
- 2021-08-13
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies fail to consider the impact of network environment when performing domain name resolution in different network environments, resulting in slow resolution speeds or inability to resolve domain names, affecting the stability and response speed of domain name requests.
By acquiring network environment information, including Internet communication protocol version information, and querying the locally stored list of domain names and IP addresses to obtain IP addresses, if the query fails, the domain name is resolved through HttpDNS or LocalDNS, ensuring accurate and fast acquisition of IP addresses under different network environments.
It saves server resources, ensures the availability of IP addresses for domain name requests, improves the response speed and stability of domain name requests, avoids domain name hijacking and DoS attacks, and ensures the security of domain name requests.
Smart Images

Figure CN115706722B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network communication technology, and in particular to a domain name request method, apparatus, storage medium, and electronic device. Background Technology
[0002] Although nodes on the Internet can all be uniquely identified by IP addresses and accessed through IP addresses, 32-bit IP addresses are too long and difficult to remember. Therefore, domain names were invented. A domain name can associate an IP address with a set of meaningful characters. DNS (Domain Name System), as a distributed database that maps domain names to IP addresses, can map domain names to real IP addresses that computers can recognize, so that computers can further communicate and transmit URLs and content.
[0003] Currently, there are generally two DNS resolution methods: one is resolution via LocalDNS, which refers to resolution through the domain name resolution service provided by the ISP (Internet Service Provider), interacting with the DNS server based on the UDP protocol; the other is resolution via HttpDNS, which refers to resolution through interaction with the DNS server based on the HTTP protocol. Existing technologies do not consider the impact of different network environments on domain name resolution. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and leading to problems such as unresponsive or slow-responding domain name requests. Summary of the Invention
[0004] In view of the above problems, the present invention provides a domain name request method and related equipment. The main purpose is to solve the problem that the existing technology does not take into account the impact of different network environments on domain name resolution when making domain name requests. As a result, when making domain name requests in certain network environments, there will be situations where the domain name cannot be resolved or the resolution speed is slow, which affects the stability of domain name resolution and leads to the problem that the domain name request cannot be responded to or the response is slow.
[0005] To address the aforementioned technical problems, in a first aspect, the present invention provides a domain name request method, the method comprising:
[0006] Obtain network environment information, including Internet communication protocol version information;
[0007] When sending a domain name request, the local storage of the domain name IP list is queried to obtain the first IP address. The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name. The domain name is the domain name information in the domain name request.
[0008] If the query fails, the domain name is resolved through the HttpDNS domain name resolution server to obtain the first IP address.
[0009] Optional, also includes:
[0010] If the domain name cannot be resolved through the HttpDNS domain name resolution server, then the domain name is resolved through LocalDNS to obtain the IP address corresponding to the domain name.
[0011] Optionally, the step of querying the locally stored list of domain name IPs to obtain the first IP address when sending a domain name request includes:
[0012] When sending the first domain name request, query the locally stored list of first domain name IPs to obtain the first IP address. The first IP address in the list of first domain name IPs is the first IP address obtained when the first domain name request was sent last time.
[0013] When sending a second domain name request, the local storage of the second domain name IP list is queried to obtain the first IP address. The first IP address in the second domain name IP list is the first IP address obtained before sending the second domain name request.
[0014] Optional, also includes:
[0015] Access the HttpDNS gateway server through the second IP address to obtain the third and fourth IP addresses. The second IP address is the IP address of the pre-embedded HttpDNS gateway server, the third IP address is the IP address corresponding to the network environment information and the HttpDNS gateway server, and the fourth IP address is the IP address corresponding to the network environment information and the HttpDNS domain name resolution server.
[0016] Store the third IP address issued by the HttpDNS gateway server into the gateway IP list, where the gateway IP list is used to store the third IP address;
[0017] The fourth IP address issued by the HttpDNS gateway server is stored in the IP resolution list, which is used to store the fourth IP address.
[0018] Optionally, the steps of resolving domain names through an HttpDNS domain name resolution server include:
[0019] Access the HttpDNS domain name resolution server via a fourth IP address;
[0020] Domain names are resolved using an HttpDNS domain name resolution server.
[0021] Optional, also includes:
[0022] The IP addresses are sorted based on the connection status of the IP addresses in the domain name IP list, gateway IP list, and resolved IP list.
[0023] Optional, also includes:
[0024] When accessing the HttpDNS gateway server, send key information and access information for access verification;
[0025] If the verification passes, the third and fourth IP addresses can be obtained;
[0026] If the verification fails, the third and fourth IP addresses cannot be obtained.
[0027] To achieve the above objectives, according to a second aspect of the present invention, a domain name request apparatus is provided, comprising:
[0028] The acquisition unit is used to acquire network environment information, including Internet communication protocol version information.
[0029] The query unit is used to query the locally stored domain name IP list when sending a domain name request in order to obtain the first IP address. The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name. The domain name is the domain name information in the domain name request.
[0030] The resolution unit is used to resolve the domain name through the HttpDNS domain name resolution server to obtain the first IP address if the query fails.
[0031] To achieve the above objectives, according to a third aspect of the present invention, a storage medium is provided, the storage medium including a stored program, wherein, when the program is running, the device where the storage medium is located is controlled to perform the steps of the domain name request method of any of the first aspects described above.
[0032] To achieve the above objectives, according to a fourth aspect of the present invention, an electronic device is provided, the electronic device including at least one processor and at least one memory connected to the processor; wherein the processor is configured to invoke program instructions in the memory to execute the steps of the domain name request method as described in any of the first aspects.
[0033] By employing the above technical solutions, this invention provides a domain name request method, apparatus, storage medium, and electronic device. Its main objective is to address the problem that current technologies for domain name requests do not consider the impact of different network environments on domain name resolution. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and leading to unresponsive or slow responses. This invention obtains network environment information, including Internet Protocol version information; when sending a domain name request, it queries a locally stored list of domain name IPs to obtain a first IP address. This list stores the first IP address, which corresponds to the network environment information and the domain name in the domain name request; if the query fails, it resolves the domain name through an HttpDNS domain name resolution server to obtain the first IP address, thus completing the domain name request. In this solution, the operation of obtaining network environment information saves server resources and ensures the availability of the IP address for the domain name request; the operations of querying the locally stored list of domain name IPs when sending a domain name request and resolving the domain name through an HttpDNS domain name resolution server if the query fails result in a faster response time for the domain name request. The above solution enables accurate and rapid access using available IP addresses based on network environment information. This solves the problem that current technologies do not consider the impact of different network environments on domain name resolution when making domain name requests. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and causing domain name requests to fail to respond or respond slowly. Attached Figure Description
[0034] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of exemplary embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0035] Figure 1 A schematic flowchart illustrating a domain name request method provided in Embodiment 1 of this application;
[0036] Figure 2 This is a schematic flowchart illustrating a domain name request method provided in Embodiment 2 of this application;
[0037] Figure 3 This is a schematic flowchart illustrating a domain name request method provided in Embodiment 3 of this application;
[0038] Figure 4 This is a schematic flowchart illustrating a domain name request method provided in Embodiment 4 of this application;
[0039] Figure 5 This is a schematic structural block diagram of a domain name request device provided in Embodiment 5 of this application;
[0040] Figure 6 This is a schematic structural block diagram of an electronic device provided in Embodiment 7 of this application. Detailed Implementation
[0041] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0042] Example 1
[0043] To address the issue that current technologies for domain name requests do not consider the impact of different network environments on domain name resolution, leading to resolution failures or slow resolution speeds in certain network environments and affecting the stability of domain name resolution, resulting in unresponsive or slow domain name requests, this application provides a domain name request method in embodiment one, such as... Figure 1 As shown, the method may include:
[0044] Step 101: Obtain network environment information;
[0045] The network environment information includes Internet communication protocol version information.
[0046] Specifically, network environment information may also include the ISP information of the HttpDNS client connection and the current network type (2G, 3G, 4G, 5G, Wi-Fi, etc.). If the current network type is Wi-Fi, the network environment information may also include the SSID (Service Set Identifier) information of the current Wi-Fi network. The SSID information includes the BSSID (Base Service Set Identifier), which represents the MAC address of the data link layer of the wireless access point, and the ESSID (Extended Service Set Identifier), which represents the name of the wireless network, in order to identify which Wi-Fi network is currently connected. At the same time, it is also necessary to monitor changes in the current network. Once the connected network changes, the network environment information is re-acquired and stored. Internet communication protocol version information includes IPv4 (Internet Protocol version 4) and IPv6 (Internet Protocol version 6). It also detects whether the current network supports both IPv4 and IPv6 or only IPv4.
[0047] It should be noted that the Internet Protocol version information will be carried over to all subsequent steps requesting IP addresses, and the server will issue the corresponding IP address to the HttpDNS client based on this Internet Protocol version information. Existing technologies typically perform domain name resolution directly when making domain name requests, without considering the impact of the current network environment on domain name resolution. However, step 101 provides the current network environment information, allowing for more accurate resolution and storage of IP addresses based on this information. This avoids the problem of the server resolving an IPv6 address when the HttpDNS client does not currently support IPv6, wasting server resources, and causing the HttpDNS client to be unable to connect and the domain name request to not respond.
[0048] Step 102: When sending a domain name request, query the locally stored list of domain name IPs to obtain the first IP address;
[0049] The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name, and the domain name is the domain name information in the domain name request.
[0050] Specifically, obtain the first IP address and access the domain name corresponding to this domain name request through the first IP address; if the current network environment only supports IPv4, then the first IP address will always be the IPv4 IP address corresponding to the domain name.
[0051] It should be noted that in existing technologies, when making a domain name request, the domain name request is usually sent directly to the server for domain name resolution and the IP address is returned. However, by using step 102, when making a domain name request, the IP address corresponding to the domain name can be found locally without the need for the server to perform domain name resolution, thus making the response time of the domain name request faster.
[0052] Step 103: If the query fails, resolve the domain name through the HttpDNS domain name resolution server to obtain the first IP address;
[0053] Specifically, the system obtains the first IP address, accesses the domain name corresponding to this domain name request through the first IP address, and stores the first IP address in the domain name IP list so that when making the same domain name request again, it can skip the step of server resolving the domain name, directly look up and access it locally, without the need for server domain name resolution, and find the IP address corresponding to the domain name locally, making the response time of the domain name request faster.
[0054] By employing the above technical solution, this embodiment provides a domain name request method. Its main purpose is to address the problem that current technologies do not consider the impact of different network environments on domain name resolution, leading to situations where domain name requests fail to resolve or resolve slowly under certain network conditions, affecting the stability of domain name resolution and resulting in unresponsive or slow domain name requests. This embodiment obtains network environment information, including Internet Protocol version information; when sending a domain name request, it queries a locally stored list of domain name IPs to obtain a first IP address. The list stores the first IP address, which corresponds to the network environment information and the domain name; the domain name is the domain name information in the domain name request. If the query fails, the domain name is resolved through an HttpDNS domain name resolution server to obtain the first IP address, thus completing the domain name request. In this solution, the operation of obtaining network environment information saves server resources and ensures the availability of the IP address for the domain name request; the operations of querying the locally stored list of domain name IPs when sending a domain name request and resolving the domain name through an HttpDNS domain name resolution server if the query fails result in a faster response time for the domain name request. The above solution enables accurate and rapid access using available IP addresses based on network environment information. This solves the problem that current technologies do not consider the impact of different network environments on domain name resolution when making domain name requests. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and causing domain name requests to fail to respond or respond slowly.
[0055] Example 2
[0056] To enable those skilled in the art to more thoroughly understand the present invention and to fully convey the scope of the invention to them, Embodiment 2 of this application further describes a domain name request method defined by the present invention, based on Embodiment 1 described above. Figure 2 As shown, the method includes:
[0057] Step 201: Obtain network environment information;
[0058] The network environment information includes Internet communication protocol version information.
[0059] Step 202: When sending a domain name request, query the locally stored list of domain name IPs to obtain the first IP address;
[0060] The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name, and the domain name is the domain name information in the domain name request.
[0061] Step 203: If the query fails, resolve the domain name through the HttpDNS domain name resolution server to obtain the first IP address.
[0062] Step 204: If the domain name cannot be resolved through the HttpDNS domain name resolution server, then resolve the domain name through LocalDNS to obtain the IP address corresponding to the domain name;
[0063] Specifically, when making a domain name request, there may be situations where the local stored list of domain name IPs cannot find a usable first IP address, or the HttpDNS domain name resolution server cannot resolve the domain name. In such cases, the domain name is resolved through LocalDNS to obtain the IP address corresponding to the domain name.
[0064] It should be noted that step 203 can avoid the problem of not being able to obtain the IP address corresponding to the domain name and not being able to make a domain name request in the above situation, and achieve the technical effect of being able to make a domain name request under any circumstances.
[0065] By employing the above technical solution, this second embodiment provides a domain name request method, the main purpose of which is to solve the problem that, under certain circumstances, the IP address corresponding to the domain name may not be obtained in this first embodiment. This second embodiment adds the following step to this first embodiment: if the domain name cannot be resolved through the HttpDNS domain name resolution server, then the domain name is resolved through LocalDNS to achieve the domain name request. In the above solution, by resolving the domain name through LocalDNS if the HttpDNS domain name resolution server fails, the disaster recovery capability of the domain name request method implemented in this first embodiment is improved, achieving the technical effect of being able to achieve domain name requests under any circumstances.
[0066] Example 3
[0067] To enable those skilled in the art to more thoroughly understand the present invention and to fully convey the scope of the invention to them, Embodiment 3 of this application further describes a domain name request method defined by the present invention, based on Embodiment 1 of this application. Figure 3 As shown, the method includes:
[0068] Step 301: Obtain network environment information;
[0069] The network environment information includes Internet communication protocol version information.
[0070] Step 302: When sending the first domain name request, query the locally stored list of first domain name IPs to obtain the first IP address;
[0071] Among them, the first IP address in the first domain name IP list is the first IP address obtained when the first domain name request was sent last time. The first IP address is the IP address corresponding to the network environment information and the domain name. The domain name is the domain name information in the domain name request.
[0072] Specifically, the first domain name request is a regular domain name request (not frequently accessed or a non-core domain name, etc.); if it is the first time making a first domain name request corresponding to a certain domain name, the first IP address cannot be found in the first domain name IP list; if it is not the first time making a first domain name request corresponding to this domain name, the first IP address can be found in the first domain name IP list.
[0073] It should be noted that step 302 can avoid unnecessary domain name resolution and first IP address storage, thus saving server resources and local memory when making domain name requests.
[0074] Step 303: When sending a second domain name request, query the locally stored list of second domain name IPs to obtain the first IP address;
[0075] Among them, the first IP address in the second domain name IP list is the first IP address obtained before sending the second domain name request. The first IP address is the IP address corresponding to the network environment information and the domain name, and the domain name is the domain name information in the domain name request.
[0076] Specifically, the second domain name request is a core domain name request, which is an access request for a key domain name. For example, the domain name of the search engine homepage can be set as a key domain name, or the homepage of a website can be set as a key domain name. Of course, the specific content of the second domain name request is not limited in this application embodiment. Before sending the second domain name request, the first IP address corresponding to the aforementioned second domain name request will be parsed and stored so that when sending the second domain name request, the corresponding domain name can be accessed directly through the first IP address.
[0077] It should be noted that step 303 is to perform pre-resolution for the second domain name request so that the corresponding first IP address can be obtained directly when the second domain name request is made. Through step 303, the domain name corresponding to the second domain name request can be accessed directly through the first IP address without performing domain name resolution when making the second domain name request, thereby saving the response time when making the second domain name request.
[0078] For example, when the HttpDNS client starts, some core domain names that need to be accessed are set into the pre-resolved domain name list. The domain name information in the obtained pre-resolved domain name list is used to form a request parameter list and sent to the domain name resolution request to obtain the IP address list corresponding to each domain name information and the validity time information of the IP address list for this domain name resolution. The above IP address list and validity time information are stored separately according to the domain name.
[0079] The steps of storing the above IP address list and validity time information separately according to domain names can be implemented using the following code:
[0080]
[0081] Map<string,Item> ;
[0082] Here, "Struct Item" refers to a Struct structure named Item used to store a list of IP addresses corresponding to a domain name, and "vector" refers to a vector structure named Item. <string>"ips;" indicates the list of IP addresses mentioned above, "Time out;" indicates the valid time information, and "Map" indicates the valid time information.<string,Item> The semicolon ";" indicates a key-value pair that stores a list of IP addresses corresponding to each domain name.
[0083] It should be noted that the above code is used to implement some steps of storing the above IP address list and validity time information separately according to domain names.
[0084] Optionally, step 303 may also include: sorting the first IP address in the second domain name IP list.
[0085] Specifically, a Connect connection is established for each first IP address in the second domain name IP list to detect whether the current first IP address is available. The connection time of each first IP address is compared, and the first IP address with the shortest connection time is sorted based on the connection time. The first IP address with the shortest connection time is placed at the beginning of the second domain name list, and the first IP address with the longest connection time is placed at the end of the second domain name list.
[0086] It should be noted that the optional steps described above can ensure and improve the speed of processing and responding to requests for the second domain name.
[0087] Step 304: If the query fails, resolve the domain name through the HttpDNS domain name resolution server to obtain the first IP address.
[0088] By employing the above technical solutions, this third embodiment provides a domain name request method, primarily aimed at solving the problem of unresponsive or slow domain name requests. Furthermore, it addresses the issue in existing technologies where domain name resolution is typically performed before any request for a core domain name, leading to slow response times for secondary domain name requests. Building upon the first embodiment, this third embodiment specifically clarifies the step of querying a locally stored list of domain name IPs when sending a domain name request, further improving the response speed.
[0089] Example 4
[0090] To enable those skilled in the art to more thoroughly understand the present invention and to fully convey the scope of the invention to them, Embodiment 4 of this application further describes a domain name request method defined by the present invention, based on Embodiment 1 of this application. Figure 4 As shown, the method includes:
[0091] Step 401: Obtain network environment information;
[0092] The network environment information includes Internet communication protocol version information.
[0093] Step 402: Access the HttpDNS gateway server through the second IP address to obtain the third and fourth IP addresses; store the third IP address issued by the HttpDNS gateway server in the gateway IP list; store the fourth IP address issued by the HttpDNS gateway server in the resolved IP list;
[0094] The second IP address is the IP address of the pre-installed HttpDNS gateway server, the third IP address is the IP address corresponding to the network environment information and the HttpDNS gateway server, and the fourth IP address is the IP address corresponding to the network environment information and the HttpDNS domain name resolution server. The gateway IP list is used to store the third IP address, and the resolution IP list is used to store the fourth IP address.
[0095] Specifically, both the HttpDNS gateway server and the HttpDNS domain name resolution server are parts of the HttpDNS server. The HttpDNS gateway server handles gateway access, and the HttpDNS domain name resolution server handles domain name resolution. After the HttpDNS client starts, it sequentially connects to the HttpDNS gateway server using at least one pre-installed secondary IP address. If it fails to connect, it continues connecting sequentially until it connects to the HttpDNS gateway server. Based on the aforementioned network environment information and following the principle of proximity and speed, the HttpDNS gateway server distributes a batch of IP addresses (including secondary and tertiary IP addresses). The HttpDNS client stores the secondary and tertiary IP addresses in its local gateway IP list and resolution IP list. The third IP address is used to connect to the HttpDNS gateway server via the third IP address in the gateway IP list the next time the HttpDNS client starts or the timer reaches the predetermined time. This allows the client to obtain the latest available third and fourth IP addresses and update the locally stored gateway IP list and resolution IP list. If a third IP address fails to connect multiple times, it is removed from the gateway IP address list. When storing the gateway IP list and resolution IP list, network environment information is used as the key, and the third and fourth IP lists are used as the values. This ensures that multiple IP lists are stored simultaneously based on network environment information. When retrieving information later, the corresponding IP list information can be retrieved based on the network environment information. Subsequent domain name resolution will use the fourth IP address in the resolution IP list to connect to the HttpDNS domain name resolution server.
[0096] It should be noted that accessing the HttpDNS gateway server and HttpDNS domain name resolution server via IP addresses avoids directly accessing the HttpDNS server using domain names, preventing domain name hijacking. The third IP address prevents situations where the second IP address is unavailable due to HttpDNS server failure or a Denial-of-Service (DoS) attack, thus preventing access to the HttpDNS gateway server. The HttpDNS gateway server, based on the aforementioned network environment information, distributes IP addresses according to the principle of proximity and speed, ensuring and improving the connection speed of HttpDNS clients to the HttpDNS server. The timer ensures that the fourth IP address in the resolution IP list is up-to-date and available, guaranteeing smooth connection when the HttpDNS client makes domain name requests. For example, the timer can be set to thirty minutes, so every thirty minutes, the latest and most available third and fourth IP addresses will be requested. Of course, those skilled in the art can set the timer duration according to their needs; this embodiment does not limit this.
[0097] Optionally, step 402 may also include: when accessing the HttpDNS gateway server, sending key information and access information for access verification; if the verification passes, the third IP address and the fourth IP address can be obtained; if the verification fails, the third IP address and the fourth IP address cannot be obtained.
[0098] Specifically, the access information may include one or more of the following: the interface of the currently accessed server, parameter information, the version number of the HttpDNS client, and network environment information. Both the key information and the access information are used for access verification. Only when the verification is successful can the correct return information be obtained; otherwise, the return information will be rejected.
[0099] It should be noted that since this embodiment uses the IP address to directly access the HttpDNS server, hackers may be able to capture the access information, allowing unauthorized HttpDNS clients to access and use the HttpDNS server's functions. However, the optional steps described above can prevent hackers from accessing and using the HttpDNS server's functions, thus ensuring the security of accessing the HttpDNS server.
[0100] Step 403: When sending a domain name request, query the locally stored list of domain name IPs to obtain the first IP address;
[0101] The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name, and the domain name is the domain name information in the domain name request.
[0102] Step 404: If the query fails, access the HttpDNS domain name resolution server through the fourth IP address, resolve the domain name through the HttpDNS domain name resolution server, and obtain the first IP address.
[0103] Optionally, embodiment 4 of this application may further include: sorting the IP addresses by the connection status of the IP addresses in the domain name IP list, gateway IP list, and resolved IP list.
[0104] Specifically, for each IP address in the IP list (including the domain IP list, gateway IP list, and resolution IP list), a Connect connection is established, and the connection status is recorded. The connection status of each IP address includes whether the connection was successful or not and the connection time. The IP addresses are sorted from first to last according to the connection time from shortest to longest. A scheduled task can be set to report the aforementioned connection status to the HttpDNS server. For example, the scheduled task can be set to execute every ten minutes. Of course, those skilled in the art can set the execution interval of the scheduled task according to their needs, and this embodiment does not impose any limitations.
[0105] It should be noted that existing HttpDNS servers do not have a feedback mechanism to obtain the connection status of HttpDNS clients. Through the optional steps mentioned above, HttpDNS clients can be able to count the connection status of all HttpDNS clients, monitor and adjust the availability of IP addresses, and promptly identify and handle problematic IP addresses.
[0106] Optionally, embodiment 4 of this application may further include: the IP list is persisted to the device in real time; when the HttpDNS client starts, the IP list persisted to the device is read into the memory cache of the HttpDNS client.
[0107] Among them, "device" refers to the device containing the HttpDNS client, and "IP list" includes the domain name IP list, gateway IP list, and resolution IP list.
[0108] Specifically, the IP list can be stored in a database within the device. For example, the database can be SQLite, but it can also be MySQL, SQL Server, Oracle, NoSQL, etc. Those skilled in the art can choose according to their needs, and this embodiment does not impose any specific limitations on it.
[0109] It should be noted that persisting the IP list information requested by the HttpDNS client to the device's database through the optional steps mentioned above can ensure the validity of the IP list information, improve the efficiency of the HttpDNS client, and reduce the pressure on the HttpDNS server. Since database access is relatively slow, the optional steps mentioned above can improve the access speed of the IP list through the HttpDNS client's memory caching, thereby improving the response speed of domain name requests.
[0110] For example, some of the domain name resolution interface functions provided by the HttpDNS client can be implemented using the following code:
[0111]
[0112] Here, "Class HttpDNS" represents a class named "HttpDNS", "string SyncgetIp(string host)" represents an interface named "SyncgetIp" used to retrieve an IP address corresponding to a domain name, and "vector <string>The `getIps(string host)` method represents an interface named "getIps" used to retrieve a list of IP addresses corresponding to a domain name. "host" represents the passed-in domain name, "string" represents the returned string of IP addresses, and "vector" represents the returned string of IP addresses. <string>"" indicates that a vector container containing string-type IP addresses is returned, and "***" indicates the code that performs the operations described in steps 403 and 404 above.
[0113] It should be noted that the "***" in the above code can also include the following steps: First, the validity of the passed domain name is checked to determine if it is a valid domain name, preventing the caller from potentially passing an IP address to the interface. Specifically, it first checks if the host is in IP address format. If it is, the IP address is returned directly. If it is not, it further checks if it is a valid domain name. If it is not a valid domain name, empty data is returned. If it is a valid domain name, subsequent functions are executed. For a single IP address request of the SyncgetIp interface, the memory cache is queried. If a list of IP addresses for the corresponding domain name exists, the first IP address is retrieved and returned. For multiple IP address requests of the getIps interface, the memory cache is queried. If a list of IP addresses for the corresponding domain name exists, the list of IP addresses is returned directly.
[0114] By employing the above technical solution, this fourth embodiment provides a domain name request method, primarily aimed at solving the problem of domain name requests failing to respond or responding slowly, and further addressing the issue of domain name hijacking that may occur during domain name requests in the prior art. This fourth embodiment, building upon the first embodiment, specifically clarifies the preparatory work before resolving a domain name through an HttpDNS domain name resolution server, thus preventing domain name hijacking and ensuring security during domain name requests.
[0115] Example 5
[0116] Furthermore, as an implementation of the aforementioned method embodiments, Embodiment 5 of this application also provides a domain name request device for implementing the aforementioned method embodiments. This device embodiment corresponds to the aforementioned method embodiments. For ease of reading, Embodiment 5 of this application will not repeat the details of the aforementioned method embodiments one by one, but it should be understood that the device in Embodiment 5 of this application can correspondingly implement all the contents of the aforementioned method embodiments. For example... Figure 5 As shown, the device 50 includes: an acquisition unit 501, a query unit 502, and a parsing unit 503, wherein,
[0117] The acquisition unit 501 is used to acquire network environment information, including Internet communication protocol version information.
[0118] The query unit 502 is used to query the locally stored domain name IP list when sending a domain name request in order to obtain the first IP address. The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name. The domain name is the domain name information in the domain name request.
[0119] Resolution unit 503 is used to resolve the domain name through the HttpDNS domain name resolution server to obtain the first IP address if the query fails.
[0120] By employing the above technical solution, this fifth embodiment provides a domain name request device, the main purpose of which is to solve the problem that current technologies do not consider the impact of different network environments on domain name resolution when making domain name requests. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and leading to unresponsive or slow domain name requests. This fifth embodiment obtains network environment information, wherein the obtaining unit 501 is used to obtain network environment information including Internet communication protocol version information; the querying unit 502 is used to query a locally stored domain name IP list when sending a domain name request to obtain a first IP address, wherein the domain name IP list stores the first IP address, which is the IP address corresponding to the network environment information and the domain name, and the domain name is the domain name information in the domain name request; the resolving unit 503 is used to resolve the domain name through an HttpDNS domain name resolution server if the query fails to obtain the first IP address, thus realizing the domain name request. In the above solution, obtaining network environment information saves server resources and ensures the availability of IP addresses for domain name requests. By querying the locally stored list of domain name IPs when sending a domain name request, and resolving the domain name through an HttpDNS domain name resolution server if the query fails, the response time for domain name requests is faster. This solution enables accurate and rapid access using available IP addresses based on network environment information, thus solving the problem that current technologies do not consider the impact of different network environments on domain name resolution. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and leading to unresponsive or slow domain name requests.
[0121] Example 6
[0122] This application provides a storage medium storing a program that, when executed by a processor, implements the following domain name request method:
[0123] Obtain network environment information, including Internet communication protocol version information;
[0124] When sending a domain name request, the local storage of the domain name IP list is queried to obtain the first IP address. The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name. The domain name is the domain name information in the domain name request.
[0125] If the query fails, the domain name is resolved through the HttpDNS domain name resolution server to obtain the first IP address.
[0126] Optional, also includes:
[0127] If the domain name cannot be resolved through the HttpDNS domain name resolution server, then the domain name is resolved through LocalDNS to obtain the IP address corresponding to the domain name.
[0128] Optionally, the step of querying the locally stored list of domain name IPs to obtain the first IP address when sending a domain name request includes:
[0129] When sending the first domain name request, query the locally stored list of first domain name IPs to obtain the first IP address. The first IP address in the list of first domain name IPs is the first IP address obtained when the first domain name request was sent last time.
[0130] When sending a second domain name request, the local storage of the second domain name IP list is queried to obtain the first IP address. The first IP address in the second domain name IP list is the first IP address obtained before sending the second domain name request.
[0131] Optional, also includes:
[0132] Access the HttpDNS gateway server through the second IP address to obtain the third and fourth IP addresses. The second IP address is the IP address of the pre-embedded HttpDNS gateway server, the third IP address is the IP address corresponding to the network environment information and the HttpDNS gateway server, and the fourth IP address is the IP address corresponding to the network environment information and the HttpDNS domain name resolution server.
[0133] Store the third IP address issued by the HttpDNS gateway server into the gateway IP list, where the gateway IP list is used to store the third IP address;
[0134] The fourth IP address issued by the HttpDNS gateway server is stored in the IP resolution list, which is used to store the fourth IP address.
[0135] Optionally, the steps of resolving domain names through an HttpDNS domain name resolution server include:
[0136] Access the HttpDNS domain name resolution server via a fourth IP address;
[0137] Domain names are resolved using an HttpDNS domain name resolution server.
[0138] Optional, also includes:
[0139] The IP addresses are sorted based on the connection status of the IP addresses in the domain name IP list, gateway IP list, and resolved IP list.
[0140] Optional, also includes:
[0141] When accessing the HttpDNS gateway server, send key information and access information for access verification;
[0142] If the verification passes, the third and fourth IP addresses can be obtained;
[0143] If the verification fails, the third and fourth IP addresses cannot be obtained.
[0144] Example 7
[0145] Embodiment 7 of this application provides an electronic device 60, such as... Figure 6 As shown, the device includes at least one processor 601 and at least one memory 602 connected to the processor; wherein the processor 601 is used to call program instructions in the memory 602 to execute the above-described domain name request method.
[0146] By employing the above technical solutions, this application provides a domain name request method and related apparatus. The main objective is to address the problem that existing technologies do not consider the impact of different network environments on domain name resolution during domain name requests. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and leading to unresponsive or slow responses. Embodiment 1 of this application obtains network environment information, including Internet Protocol version information. When sending a domain name request, it queries a locally stored list of domain name IPs to obtain a first IP address. This list stores the first IP address, which corresponds to the network environment information and the domain name. The domain name is the domain name information in the domain name request. If the query fails, the domain name is resolved through an HttpDNS domain name resolution server to obtain the first IP address, thus completing the domain name request. In this solution, the operation of obtaining network environment information saves server resources and ensures the availability of the IP address for the domain name request. The operations of querying the locally stored list of domain name IPs when sending a domain name request and resolving the domain name through an HttpDNS domain name resolution server if the query fails result in a faster response time for the domain name request. The above solution enables accurate and rapid access using available IP addresses based on network environment information. This solves the problem that current technologies do not consider the impact of different network environments on domain name resolution when making domain name requests. Consequently, in certain network environments, domain name requests may fail to resolve or resolve slowly, affecting the stability of domain name resolution and causing domain name requests to fail to respond or respond slowly.
[0147] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application; it should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions; these computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable process management device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable process management device, generate instructions for implementing the process Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0148] In a typical configuration, an electronic device includes one or more processors (CPUs), memory, and a bus; the electronic device may also include input / output interfaces, network interfaces, etc.
[0149] The memory may include non-permanent memory in a computer-readable medium, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip; the memory is an example of a storage medium.
[0150] Storage media, including permanent and non-permanent, removable and non-removable media, can be used to store information by any method or technology; the information can be computer-readable instructions, data structures, program modules, or other data; examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information that can be accessed by a computing device; as defined herein, storage media does not include transient media, such as modulated data signals and carrier waves.
[0151] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein.
[0152] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus; and, without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0153] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products; therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects; moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0154] Computer program code for performing the operations of the embodiments of this application can be written in one or more programming languages or a combination thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0155] The above are merely embodiments of this application and are not intended to limit this application; various modifications and variations can be made to this application by those skilled in the art; any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.< / string> < / string> < / string>
Claims
1. A domain name request method, characterized in that, include: Obtain network environment information, wherein the network environment information includes Internet communication protocol version information; When sending a domain name request, the local stored domain name IP list is queried to obtain the first IP address. The domain name IP list is used to store the first IP address, which is the IP address corresponding to the network environment information and the domain name. The domain name is the domain name information in the domain name request. If the query fails, the domain name is resolved through the HttpDNS domain name resolution server to obtain the first IP address; Before sending the domain name request, the method further includes: Access the HttpDNS gateway server through the second IP address to obtain the third IP address and the fourth IP address. The second IP address is the pre-embedded IP address of the HttpDNS gateway server, the third IP address is the IP address corresponding to the network environment information and the HttpDNS gateway server, and the fourth IP address is the IP address corresponding to the network environment information and the HttpDNS domain name resolution server. The third IP address issued by the HttpDNS gateway server is stored in the gateway IP list, wherein the gateway IP list is used to store the third IP address; The fourth IP address issued by the HttpDNS gateway server is stored in the IP resolution list, wherein the IP resolution list is used to store the fourth IP address; The third IP address is used to connect to the HttpDNS gateway server through the third IP address in the gateway IP list the next time the HttpDNS client starts or the timer reaches the predetermined time, so as to obtain the latest available third IP address and fourth IP address and update the locally stored gateway IP list and resolution IP list.
2. The method according to claim 1, characterized in that, Also includes: If the domain name cannot be resolved by the HttpDNS domain name resolution server, then the domain name is resolved by LocalDNS to obtain the IP address corresponding to the domain name.
3. The method according to claim 1, characterized in that, The step of querying the locally stored list of domain names and IP addresses to obtain the first IP address when sending a domain name request includes: When sending the first domain name request, the local storage of the first domain name IP list is queried to obtain the first IP address, wherein the first IP address in the first domain name IP list is the first IP address obtained when the first domain name request was sent last time; When sending a second domain name request, the local storage of the second domain name IP list is queried to obtain the first IP address, wherein the first IP address in the second domain name IP list is the first IP address obtained before sending the second domain name request.
4. The method according to claim 1, characterized in that, The step of resolving the domain name through an HttpDNS domain name resolution server includes: Access the HttpDNS domain name resolution server through the fourth IP address; The domain name is resolved by the HttpDNS domain name resolution server.
5. The method according to claim 1, characterized in that, Also includes: The IP addresses are sorted based on the connection status of the IP addresses in the domain name IP list, the gateway IP list, and the resolved IP list.
6. The method according to claim 1, characterized in that, Also includes: When accessing the HttpDNS gateway server, send key information and access information for access verification; If the verification passes, the third IP address and the fourth IP address can be obtained; If the verification fails, the third IP address and the fourth IP address cannot be obtained.
7. A storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, it controls the device where the storage medium is located to perform the steps of the domain name request method as described in any one of claims 1 to 6.
8. An electronic device, characterized in that, The device includes at least one processor and at least one memory connected to the processor; wherein the processor is configured to invoke program instructions in the memory to execute the steps of the domain name request method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Fast domain name resolution method and system, and terminal and server thereof
CN106161669A
Method and device for improving network access success rate, equipment and storage medium
CN110519401A