Domain name analysis method and device, storage medium and electronic equipment

By intercepting and customizing domain name resolution requests in a virtual machine, using a mapping table for resolution, and calling the original function when failure occurs, the complexity of domain name resolution is solved, resulting in a more efficient and stable domain name resolution process.

CN121125688APending Publication Date: 2025-12-12CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511414634.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing technologies for domain name resolution are quite complex, requiring a professional technical team for maintenance and involving complex architectural designs.

Method used

Intercept the target application's domain name resolution requests in the virtual machine, use the target mapping table to perform domain name resolution, and call the original resolution function when resolution fails, building custom domain name resolution logic to reduce complexity.

Benefits of technology

By intercepting and customizing domain name resolution at the virtual machine level, the difficulty of domain name resolution is reduced, the system stability and resolution efficiency are improved, the dependence on the operating system is reduced, and multi-IP load balancing and rapid configuration updates are supported.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121125688A_ABST
    Figure CN121125688A_ABST
Patent Text Reader

Abstract

The invention discloses a domain name analysis method and device, a storage medium and electronic equipment, the method is applied to a virtual machine, the virtual machine is deployed in a target application program, and the method comprises the following steps: intercepting a target operation under the condition that a target request sent by the target application program is received, the target request is used for requesting to analyze a target domain name, the target operation is that a target application program calls an original analysis function, the original analysis function is a function provided by a target system kernel, and the original analysis function is used for analyzing the target domain name; analyzing the target domain name based on a target mapping table to obtain an analysis result, the target mapping table being used for storing a mapping relationship between the domain name and a plurality of Internet protocol addresses; and under the condition that the analysis result indicates that the analysis fails, calling the original analysis function to analyze the target domain name. According to the method and the device, the problem that domain name resolution is relatively complex is solved, and the effect of reducing the difficulty degree of domain name resolution is further achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a domain name resolution method, apparatus, storage medium, and electronic device. Background Technology

[0002] In related technologies, it is usually necessary to build a private DNS (Domain Name System) domain name resolver to realize domain name resolution, which not only involves complex architecture design, but also requires a professional technical team for maintenance.

[0003] This indicates that there are complex technical issues related to domain name resolution in the relevant technologies.

[0004] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention

[0005] This application provides a domain name resolution method, apparatus, storage medium, and electronic device to at least solve the technical problem of complex domain name resolution in related technologies.

[0006] According to one aspect of the embodiments of this application, a domain name resolution method is provided, applied to a virtual machine, the virtual machine being deployed in a target application, comprising: upon receiving a target request sent by the target application, intercepting a target operation, wherein the target request is for requesting resolution of a target domain name, the target operation being the target application calling a raw resolution function, the raw resolution function being a function provided by the target system kernel, the raw resolution function being used to resolve the target domain name; resolving the target domain name based on a target mapping table to obtain a resolution result, the target mapping table being used to store mapping relationships between domain names and multiple Internet Protocol addresses; and, if the resolution result indicates resolution failure, calling the raw resolution function to resolve the target domain name.

[0007] In one exemplary embodiment, before intercepting the target operation upon receiving a target request sent by the target application, the method further includes: generating a target configuration file for the target application; and determining the target mapping table based on the target configuration file.

[0008] In one exemplary embodiment, generating a target configuration file for the target application includes: determining a domain name and a plurality of first protocol addresses corresponding to the domain name; determining a target communication protocol corresponding to the domain name; performing a target operation for each target protocol address included in each of the first protocol addresses to determine a first sub-configuration file corresponding to the target protocol address, thereby obtaining a plurality of first sub-configuration files; and determining the plurality of first sub-configuration files as files included in the target configuration file; wherein the target operation includes: determining a first port of the target protocol address, and determining the domain name, the target protocol address, the first port, and the target communication protocol as the first sub-configuration file.

[0009] In an exemplary embodiment, determining the target mapping table based on the target configuration file includes: reading the target configuration file at preset time intervals; detecting first configuration information included in the target configuration file to obtain a detection result, wherein the first configuration information includes at least one of the following: a first protocol address and a first port; determining second configuration information included in the first configuration information, wherein the detection result of the second configuration information is a successful detection; and determining the target mapping table based on the second sub-configuration file corresponding to the second configuration information.

[0010] In an exemplary embodiment, determining the target mapping table based on the second sub-configuration file corresponding to the second configuration information includes: determining the domain name included in each second sub-configuration file to obtain multiple first domain names; in the case that the multiple first domain names include the same second domain name, determining multiple second protocol addresses corresponding to the second domain name; determining the multiple second protocol addresses as a circular array; determining the second domain name and the circular array as a binary array; and determining the mapping table containing the binary array as the target mapping table.

[0011] In an exemplary embodiment, resolving the target domain name based on a target mapping table to obtain a resolution result includes: if the target domain name is included in the target mapping table, determining the target circular array corresponding to the target domain name from the circular array included in the target mapping table; determining the protocol address pointed to by the target circular array pointer as the third protocol address of the target domain name; and if the third protocol address is determined, determining that the resolution result is successful.

[0012] In one exemplary embodiment, after determining the protocol address pointed to by the target circular array pointer as the third protocol address of the target domain name, the method further includes at least one of the following: sending the third protocol address to the target application; setting the target circular array pointer to point to a fourth protocol address included in the target circular array, wherein, if the third protocol address is the last address in the target circular array, the fourth protocol address is the first address in the target circular array, and if the third protocol address is not the last address in the target circular array, the fourth protocol address is the address following the third protocol address.

[0013] According to another aspect of the embodiments of this application, a domain name resolution apparatus is also provided, comprising: an interception module, configured to intercept a target operation upon receiving a target request sent by a target application, wherein the target request is for requesting resolution of a target domain name, and the target operation is the target application calling an original resolution function, the original resolution function being a function provided by the target system kernel, the original resolution function being used to resolve the target domain name; a resolution module, configured to resolve the target domain name based on a target mapping table to obtain a resolution result, the target mapping table being used to store mapping relationships between domain names and multiple Internet Protocol addresses; and a calling module, configured to call the original resolution function to resolve the target domain name if the resolution result indicates that the resolution has failed.

[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed by a processor.

[0015] According to another aspect of the embodiments of this application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the steps in any of the method embodiments described above.

[0016] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to perform the steps of any of the above method embodiments through the computer program.

[0017] This application allows for the interception of a target operation—the direct invocation of a raw DNS resolution function by a virtual machine deployed within a target application—when it receives a target request from the target application. This target request can be used to request the resolution of a target domain name. Because the target operation can be intercepted, specifically the raw DNS resolution function provided by the target system kernel, the virtual machine can utilize its own target mapping table, which stores the mapping relationship between domain names and multiple Internet Protocol addresses, to resolve the target domain name. Even if the resolution fails, the virtual machine can still invoke the raw DNS resolution function to resolve the target domain name. Since the virtual machine can intercept the target operation, it performs a domain name resolution within the target application (i.e., using the target mapping table) before invoking the raw DNS resolution function. Even if the resolution fails, the original domain name resolution can still be achieved. This allows the original resolution scheme to remain effective without disrupting the logic of the existing general domain name resolution framework. In other words, even if the virtual machine in the target application crashes, the original resolution scheme can still be activated. Therefore, this solves the problem of complex domain name resolution in existing technologies, effectively reducing the difficulty of domain name resolution. Attached Figure Description

[0018] Figure 1 This is a schematic diagram illustrating an application scenario of a domain name resolution method according to an embodiment of this application;

[0019] Figure 2 This is a flowchart illustrating an optional domain name resolution method according to an embodiment of this application;

[0020] Figure 3 This is a schematic diagram of the domain name resolution framework according to an embodiment of this application;

[0021] Figure 4 This is a schematic diagram of the domain name resolution framework of the operating system according to an embodiment of this application;

[0022] Figure 5 This is a structural block diagram of an optional domain name resolution device according to an embodiment of this application;

[0023] Figure 6 This is a computer system architecture block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying 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 of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] According to one aspect of the embodiments of this application, a domain name resolution method is provided. Optionally, in this embodiment, the above-described domain name resolution method may be applied to, but is not limited to, methods such as... Figure 1 The hardware environment shown includes terminal device 102 and server 104. Server 104 can be connected to terminal device 102 via a network and can be used to provide services (e.g., application services, etc.) to terminal device 102 or clients installed on terminal device 102. A database can be set up on server 104 or independently of server 104 to provide data storage services for server 104.

[0027] The aforementioned network may include, but is not limited to, at least one of the following: wired network and wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), and local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wireless Fidelity (WIFI) and Bluetooth. Terminal device 102 may be, but is not limited to, a personal computer (PC), mobile phone, tablet computer, etc. Server 104 may be, but is not limited to, a cloud server, server cluster, or other server types.

[0028] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0029] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.

[0030] The domain name resolution method of this application embodiment can be executed by server 104, by terminal device 102, or by both server 104 and terminal device 102. Alternatively, the domain name resolution method of this application embodiment can be executed by a client installed on terminal device 102.

[0031] Figure 2 This is a flowchart illustrating an optional domain name resolution method according to an embodiment of this application, as shown below. Figure 2 As shown, the process of this method may include the following steps:

[0032] Step S202: Upon receiving a target request sent by the target application, the target operation is intercepted. The target request is used to request the resolution of a target domain name, and the target operation is the target application calling a raw resolution function. The raw resolution function is a function provided by the target system kernel and is used to resolve the target domain name.

[0033] The domain name resolution method in this embodiment can be applied to the Internet field. Figure 3 This is a schematic diagram of the domain name resolution framework according to an embodiment of this application, such as... Figure 3 As shown, the JVM (Java Virtual Machine) can act as a bridge between Java applications (i.e., the target application mentioned above) and the operating system (i.e., the target system mentioned above), connecting the JVM and application logic code from the perspective of operating system processes. Figure 3Together with the Java business logic, the target application process is formed. When the application logic code in the target application issues an outbound request with a domain name (i.e., the target request mentioned above), it can send a domain name resolution call to the JVM virtual machine. The JVM virtual machine can intercept the application logic code's call to the JVM's delegate function (i.e., the original resolution function mentioned above). In other words, during the runtime of the Java target application, any domain name resolution request based on a string is actually done indirectly through the JVM, rather than the application code directly calling the target system's kernel resolution function. That is, in the execution of a Java application running on the JVM, the domain name resolution in the application code is delegated to the JVM virtual machine to call the operating system kernel function for resolution, rather than the application code directly calling the operating system kernel's resolution function.

[0034] In the above embodiments, operating system kernel calls occur at the operating system level, serving as a bridge between computer hardware and software. When an application attempts to access hardware resources or perform system-level operations, it can request services from the kernel through system call interfaces, such as file reading and writing, network communication, and process management. Due to stability and security considerations, the operating system kernel is designed to prevent arbitrary interception or customization of kernel function behavior unless significant modifications are made to the operating system source code. Therefore, calls to operating system kernel interfaces cannot be intercepted. However, JVM function calls, being calls to Java language functions, occur within the Java Virtual Machine and are also function calls within the application process. Therefore, effective interception is possible, enabling the implementation of operating system-level domain name resolution logic. Since JVM function calls are calls within the Java application process and are executed based on bytecode, interception and customization at the JVM level are possible. Bytecode injection, dynamic proxies, or AOP (Aspect-Oriented Programming) techniques can be used to intercept and modify JVM functions without modifying the operating system kernel or application source code, thereby achieving custom domain name resolution.

[0035] Step S204: Resolve the target domain name based on the target mapping table to obtain the resolution result. The target mapping table is used to store the mapping relationship between domain names and multiple Internet Protocol addresses.

[0036] In the above embodiments, after the target operation is intercepted, a custom domain name resolution processing function can be added. When processing the custom domain name resolution function, the target domain name in the target request can be searched from the memory hash mapping table (i.e. the target mapping table) that stores the mapping relationship between domain names and multiple Internet Protocol addresses. It can be determined whether the domain name included in the target mapping table exists, and the resolution result can be obtained.

[0037] Step S206: If the resolution result indicates that the resolution has failed, the original resolution function is invoked to resolve the target domain name.

[0038] In the above embodiments, if the resolution result indicates resolution failure, i.e., the target domain name in the target request does not exist in the target mapping table, the custom function can continue to delegate the domain name resolution to the JVM function, following the general logic of the operating system's domain name resolution framework. That is, the JVM virtual machine can call the original resolution function to resolve the target domain name. Figure 4 This is a schematic diagram of the domain name resolution framework of the operating system according to an embodiment of this application, such as... Figure 4 As shown, typically, before an application sends a network request with a domain name, the request follows the standard operating system or network process. First, the operating system calls the domain name resolution function of the local operating system kernel network module to resolve the domain name. The kernel looks up the domain name in the domain name cache. If the local resolution is successful, it returns the IP (Internet Protocol) address. If the local resolution fails, the kernel further looks up the domain name in the hosts file. If found, it returns the IP address. If not found, the kernel sends a domain name resolution request to the remote host. If the domain name server returns an IP address, the kernel returns the IP address to the application and caches it. If the domain name server returns null, since all possibilities have been traversed, the unknown domain name is returned to the application.

[0039] In the above embodiments, by encapsulating the low-level details of domain name resolution in the JVM, Java applications do not need to be concerned with the specific implementation of domain name resolution, reducing the application's dependence on the underlying operating system and improving application portability. Secondly, as an intermediate layer, the JVM can monitor and control domain name resolution requests. For example, it can filter resolution requests to prevent malicious resolution requests from posing security threats to the system. In addition, the JVM runtime environment can set permissions and security policies to further enhance control over network resource access.

[0040] This application allows for the interception of a target operation—the direct invocation of a raw DNS resolution function by a virtual machine deployed within a target application—when it receives a target request from the target application. This target request can be used to request the resolution of a target domain name. Because the target operation can be intercepted, specifically the raw DNS resolution function provided by the target system kernel, the virtual machine can utilize its own target mapping table, which stores the mapping relationship between domain names and multiple Internet Protocol addresses, to resolve the target domain name. Even if the resolution fails, the virtual machine can still invoke the raw DNS resolution function to resolve the target domain name. Since the virtual machine can intercept the target operation, it performs a domain name resolution within the target application (i.e., using the target mapping table) before invoking the raw DNS resolution function. Even if the resolution fails, the original domain name resolution can still be achieved. This allows the original resolution scheme to remain effective without disrupting the logic of the existing general domain name resolution framework. In other words, even if the virtual machine in the target application crashes, the original resolution scheme can still be activated. Therefore, this solves the problem of complex domain name resolution in existing technologies, effectively reducing the difficulty of domain name resolution.

[0041] In one exemplary embodiment, before intercepting the target operation upon receiving a target request sent by the target application, the method further includes: generating a target configuration file for the target application; and determining the target mapping table based on the target configuration file.

[0042] In the above embodiments, before intercepting the target operation, a domain name resolution configuration file can be designed for the target application. That is, a target configuration file for storing custom resolution rules can be generated first. The target configuration file typically contains a mapping relationship between domain names and IP addresses. After generating the target configuration file, the domain name resolution rules can be read from the target configuration file and converted into a mapping structure in memory, such as a hash mapping table (i.e., the target mapping table mentioned above).

[0043] This embodiment allows the target configuration file to be read and its domain name and IP mapping rules to be parsed when the application starts or during configuration updates. Based on the read configuration rules, a hash mapping table is constructed and loaded into the application's memory for fast access when needed, avoiding the overhead of rereading the configuration file from disk for each request.

[0044] In one exemplary embodiment, generating a target configuration file for the target application includes: determining a domain name and a plurality of first protocol addresses corresponding to the domain name; determining a target communication protocol corresponding to the domain name; performing a target operation for each target protocol address included in each of the first protocol addresses to determine a first sub-configuration file corresponding to the target protocol address, thereby obtaining a plurality of first sub-configuration files; and determining the plurality of first sub-configuration files as files included in the target configuration file; wherein the target operation includes: determining a first port of the target protocol address, and determining the domain name, the target protocol address, the first port, and the target communication protocol as the first sub-configuration file.

[0045] In the above embodiments, during the process of designing the target configuration file for the application, the IP address, port and protocol for the domain name can be configured in a line-by-line format. Multiple domain names can be appended sequentially. That is, the target configuration file can be used to define multiple IP addresses and related ports and protocols corresponding to each domain name.

[0046] In the above embodiments, for each domain name, multiple IP addresses corresponding to the domain name, the target communication protocol used by the domain name, and the first port information corresponding to the IP address can be determined separately. That is, in the target configuration file, a domain name, an IP address corresponding to this domain name (i.e., the aforementioned first protocol address), the target communication protocol of this domain name, and the first port on this IP address constitute a first sub-configuration file. Multiple first sub-configuration files of all domain names can constitute the target configuration file. The first sub-configuration file can be as follows (including domain name, IP address, port, and protocol): Since a domain name can correspond to multiple first protocol addresses, a domain name can form multiple first sub-configuration files. For example, example1.test.com (domain name) 127.0.0.11 (IP address) 8080 (port) http (protocol) is a first sub-configuration file of the domain name example1.test.com; example1.test.com (domain name) 127.0.0.12 (IP address) 8080 (port) http (HyperText Transfer Protocol) is another first sub-configuration file of the domain name example1.test.com.

[0047] example1.test.com 127.0.0.11 8080 http

[0048] example1.test.com 127.0.0.12 8080 http

[0049]

[0050] example2.test.com 128.0.0.11 9999 tcp

[0051] example2.test.com 128.0.0.12 9999 tcp

[0052] In this embodiment, since the configuration includes multiple protocol addresses, when a service instance fails, the application can quickly switch to other available instances according to the configuration, thereby improving the overall stability of the system and the user's service experience.

[0053] In an exemplary embodiment, determining the target mapping table based on the target configuration file includes: reading the target configuration file at preset time intervals; detecting first configuration information included in the target configuration file to obtain a detection result, wherein the first configuration information includes at least one of the following: a first protocol address and a first port; determining second configuration information included in the first configuration information, wherein the detection result of the second configuration information is a successful detection; and determining the target mapping table based on the second sub-configuration file corresponding to the second configuration information.

[0054] In the above embodiment, a timer can be started in the Java target application. The timer can read the target configuration file at preset time intervals, for example, every few seconds. During the reading of the target configuration file, the timer can also perform IP liveness detection and port liveness detection. The user can choose whether to perform IP liveness detection or application liveness detection. When the target machine is offline, the IP can be removed from the corresponding domain name resolution. When the IP and port are online, they are automatically resolved to take over the load. That is to say, when the timer reads the target configuration file, it can perform IP or protocol port liveness detection according to the protocol, i.e., check the first configuration information. Only live IPs and ports (i.e., the second configuration information mentioned above) will be read into memory (i.e., the detection passes), and offline IPs and ports will be removed. Among them, IP liveness detection can be understood as performing a health check on a specified IP address. This can be done by sending specific types of network packets (such as ICMP Echo Request, i.e., ping request) or establishing a short TCP / UDP connection to verify whether the IP address can respond, thereby determining whether the target machine is online. Through a timer or event triggering mechanism, liveness checks can be performed on multiple IP addresses specified in the configuration file periodically. If an IP address is detected as unresponsive or its response time exceeds a preset threshold, it can be automatically removed from the current domain name resolution list, ensuring that business requests are not sent to offline servers. Once an offline IP becomes online again, it can be automatically restored to a resolvable IP address, thus guaranteeing dynamic adjustment of load balancing and business continuity. Port probing can be understood as performing a health check on a specific port on a specific IP address to verify whether the port can receive and process requests. Building on IP probing, it is possible to further check whether the ports on each IP address are active, usually by establishing a short-lived connection (such as a TCP three-way handshake). If a port cannot establish a connection, the IP address will be considered inactive and temporarily removed from the domain name resolution list. Application-level probing can also be performed, which involves performing health checks on application services on the target machine to ensure that the application services can correctly respond to business requests.

[0055] This embodiment allows users to choose the appropriate activation mechanism based on their actual needs. They can perform IP-based or port-based activation, or they can choose application-level activation. For example, in situations with unstable network environments or frequent server hardware failures, IP-based activation might be a priority; while in scenarios with frequent application service updates or where ensuring complete service functionality is crucial, application-level activation is more important. Combining IP-based, port-based, and application-based activation allows for intelligent scheduling and dynamic adjustment of the load on active and healthy servers, avoiding requests to faulty servers and improving service availability and response speed.

[0056] In an exemplary embodiment, determining the target mapping table based on the second sub-configuration file corresponding to the second configuration information includes: determining the domain name included in each second sub-configuration file to obtain multiple first domain names; in the case that the multiple first domain names include the same second domain name, determining multiple second protocol addresses corresponding to the second domain name; determining the multiple second protocol addresses as a circular array; determining the second domain name and the circular array as a binary array; and determining the mapping table containing the binary array as the target mapping table.

[0057] In the above embodiments, a target mapping table can be constructed based on the second sub-configuration file corresponding to the second configuration information detected by liveness detection. All first domain names can be determined from the second sub-configuration file. If the first domain names contain the same second domain name, the multiple second protocol addresses corresponding to the second domain name can be determined in the form of a circular array, that is, the circular array includes all IP addresses of a certain second domain name. The second domain name and the circular array are stored in a hash map (domain name, circular array) in the structure of a tuple (domain name, circular array), which is the target mapping table. If the first domain name has a separate third domain name, the IP address corresponding to the third domain name can be stored in the target mapping table in the form of a tuple with the third domain name.

[0058] By reading the configuration file, the mapping relationship between domain names and multiple IPs can be stored in the memory of the JVM process, constructing a hash map. In this way, each resolution request can be directly searched in memory without needing to cross processes or network requests, thus improving resolution speed.

[0059] In an exemplary embodiment, resolving the target domain name based on a target mapping table to obtain a resolution result includes: if the target domain name is included in the target mapping table, determining the target circular array corresponding to the target domain name from the circular array included in the target mapping table; determining the protocol address pointed to by the target circular array pointer as the third protocol address of the target domain name; and if the third protocol address is determined, determining that the resolution result is successful.

[0060] In the above embodiments, after constructing the target mapping table, upon receiving a target request, it can be first determined whether the target mapping table contains the target domain name in the target request. If the target mapping table does not contain the target domain name, the general logic of the operating system's domain name resolution framework can be followed, i.e., the target domain name can be resolved using the original resolution function. If the target mapping table contains the target domain name, a target circular array containing multiple IP addresses corresponding to the target domain name can be retrieved from the circular array. The IP address currently pointed to by the circular array pointer is determined as the third-party protocol address of the target domain name, i.e., the resolution result is successful. Afterwards, the found third-party protocol address can be returned to the target application without delegating to the JVM virtual machine.

[0061] In this embodiment, each domain name in the target configuration file corresponds to a circular array, which stores multiple IP addresses. When the JVM application requests a request, it first looks up the corresponding circular array in memory, retrieves the IP address currently pointed to by the pointer, and supports load balancing across multiple IPs. Requests for each domain name are distributed to different IP addresses in the array in turn, ensuring balanced request load.

[0062] In one exemplary embodiment, after determining the protocol address pointed to by the target circular array pointer as the third protocol address of the target domain name, the method further includes at least one of the following: sending the third protocol address to the target application; setting the target circular array pointer to point to a fourth protocol address included in the target circular array, wherein, if the third protocol address is the last address in the target circular array, the fourth protocol address is the first address in the target circular array, and if the third protocol address is not the last address in the target circular array, the fourth protocol address is the address following the third protocol address.

[0063] In the above embodiment, after determining the third protocol address of the target domain name, the pointer of the circular array can be moved down one element (i.e., the fourth protocol address mentioned above). If the third protocol address is the last address in the target circular array, then the fourth protocol address is the first address in the target circular array. If the third protocol address is not the last address, then the fourth protocol address is the address after the third protocol address.

[0064] In this embodiment, a circular array structure is used to store multiple IP addresses. Each resolution request can be routed to the next IP address in the array, thereby evenly distributing network requests and preventing some IPs from becoming slow or unresponsive due to excessive load.

[0065] In the foregoing embodiments, this application addresses domain name resolution for JVM-based application (AP) implementations. By intercepting the JVM's domain name resolution entry point, it performs a JVM-level domain name resolution before the operating system's and network's domain name resolution occur. That is, when an application requests domain name resolution through the JVM, it is first processed by custom resolution logic. In other words, if a JVM application attempts to resolve a domain name, it will first be caught by custom logic, rather than being directly handled by the operating system or network DNS service. By implementing resolution at the JVM level, the resolution result can be controlled more flexibly, avoiding direct dependence on the operating system or network DNS server, reducing the complexity and maintenance cost of the configuration process, and improving resolution efficiency and multi-IP load balancing capabilities. Secondly, from the perspective of one JVM instance process corresponding to one AP application, this application falls under the category of application-level memory domain name resolution. Related domain name resolution schemes, especially those relying on DNS servers, have the risk of single point of failure. Once the DNS server fails, it will lead to a global domain name resolution failure. Application-level memory resolution, on the other hand, distributes the resolution logic to each JVM instance. Even if one instance fails, other instances can still resolve domain names normally. It offers flexible and convenient configuration and avoids the single point of failure risk associated with high availability from domain name servers.

[0066] In the above embodiments, the resolution of one domain name to multiple IPs inherently provides load balancing capabilities, avoiding unfavorable constraints such as network request and root privilege restrictions. Furthermore, it adheres to domain name resolution standards, allowing applications to use custom domain names transparently and seamlessly. This application-level in-memory resolution allows developers to directly configure the mapping relationship between domain names and multiple IP addresses within the JVM, without modifying the operating system-level hosts file or relying on external DNS servers. Moreover, business migrations in related technologies often involve a series of complex configuration changes, especially those involving adjustments to network infrastructure, such as updating DNS records and modifying hosts files. This is not only time-consuming but may also lead to service interruptions due to configuration errors. In contrast, this application only requires copying the current application's domain name configuration file to the new environment. Business migration simply requires copying the domain name configuration file to the new environment and reconfiguring the IPs for immediate effect. This is because the domain name configuration file contains the mapping relationship between all domain names and IP addresses. In the new environment, developers or operations personnel can immediately update the IP addresses in the configuration file, pointing them to servers in the new environment, without waiting for DNS cache refresh or modifying the operating system-level hosts file; the configuration changes take effect immediately. The migrated environment can immediately leverage built-in load balancing logic to evenly distribute requests across multiple servers without requiring additional load balancer configuration. Furthermore, in large enterprises or organizations, different applications may need to access the same network resources, such as database servers and API gateways. Configuration methods in related technologies often require each application to maintain an independent network configuration, increasing maintenance costs and potentially introducing inconsistencies. This application allows the application-level in-memory domain name resolution logic to be encapsulated as a shared library. This library contains all necessary resolution and load balancing functions, inherently possessing intra-application sharing and reuse capabilities. Cross-application sharing simply requires importing it as a shared library. In other words, any application that needs to use these functions can easily import this shared library into its corresponding project. Multiple applications can ensure consistent access configurations for the same network resources by sharing the same configuration file. When configuration updates are needed, only the shared configuration file needs to be modified once, and all applications referencing the library will automatically obtain the latest configuration information. The shared library supports dynamic configuration file updates, enabling the loading of the latest IP address configuration without restarting the application, greatly improving configuration update efficiency and system availability.

[0067] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0068] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / random access memory (RAM), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0069] According to another aspect of the embodiments of this application, a domain name resolution apparatus is also provided. This domain name resolution apparatus can be used to implement the domain name resolution method provided in the above embodiments, and details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0070] Figure 5 This is a structural block diagram of an optional domain name resolution device according to an embodiment of this application, such as... Figure 5 As shown, the domain name resolution device includes:

[0071] The interception module 52 is used to intercept the target operation when a target request is received from the target application. The target request is used to request the resolution of the target domain name. The target operation is the target application calling the original resolution function, which is a function provided by the target system kernel, and the original resolution function is used to resolve the target domain name.

[0072] The parsing module 54 is used to parse the target domain name based on the target mapping table to obtain the parsing result. The target mapping table is used to store the mapping relationship between the domain name and multiple Internet Protocol addresses.

[0073] Module 56 is used to invoke the original resolution function to resolve the target domain name if the resolution result indicates that the resolution has failed.

[0074] In one exemplary embodiment, the apparatus is configured to, before intercepting a target operation upon receiving a target request sent by the target application,: generate a target configuration file for the target application; and determine the target mapping table based on the target configuration file.

[0075] In an exemplary embodiment, the apparatus can generate a target configuration file for the target application by: determining a domain name and a plurality of first protocol addresses corresponding to the domain name; determining a target communication protocol corresponding to the domain name; performing a target operation for each target protocol address included in each of the first protocol addresses to determine a first sub-configuration file corresponding to the target protocol address, thereby obtaining a plurality of first sub-configuration files; and determining the plurality of first sub-configuration files as files included in the target configuration file; wherein the target operation includes: determining a first port of the target protocol address, and determining the domain name, the target protocol address, the first port, and the target communication protocol as the first sub-configuration file.

[0076] In an exemplary embodiment, the apparatus may determine the target mapping table based on the target configuration file by the following method: reading the target configuration file at preset time intervals; detecting the first configuration information included in the target configuration file to obtain a detection result, wherein the first configuration information includes at least one of the following: a first protocol address and a first port; determining the second configuration information included in the first configuration information, wherein the detection result of the second configuration information is a successful detection; and determining the target mapping table based on the second sub-configuration file corresponding to the second configuration information.

[0077] In an exemplary embodiment, the apparatus may determine the target mapping table based on the second sub-configuration file corresponding to the second configuration information by the following method: determining the domain name included in each second sub-configuration file to obtain multiple first domain names; in the case that the multiple first domain names include the same second domain name, determining multiple second protocol addresses corresponding to the second domain name; determining the multiple second protocol addresses as a circular array; determining the second domain name and the circular array as a binary array; and determining the mapping table containing the binary array as the target mapping table.

[0078] In an exemplary embodiment, the parsing module 54 can resolve the target domain name based on the target mapping table and obtain the parsing result in the following manner: if the target domain name is included in the target mapping table, determine the target circular array corresponding to the target domain name from the circular array included in the target mapping table; determine the protocol address pointed to by the target circular array pointer as the third protocol address of the target domain name; if the third protocol address is determined, determine that the parsing result is successful.

[0079] In one exemplary embodiment, the apparatus is further configured to, after determining the protocol address indicated by the target circular array pointer as a third protocol address of the target domain name, include at least one of the following: sending the third protocol address to the target application; setting the target circular array pointer to point to a fourth protocol address included in the target circular array, wherein, if the third protocol address is the last address in the target circular array, the fourth protocol address is the first address in the target circular array, and if the third protocol address is not the last address in the target circular array, the fourth protocol address is the address following the third protocol address.

[0080] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0081] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein the program executes the steps in any of the above method embodiments when it is run.

[0082] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.

[0083] According to another aspect of the embodiments of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor is configured to perform the steps of any of the method embodiments described above via the computer program. In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0084] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0085] According to another aspect of the embodiments of this application, a computer program product is also provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit 601, it performs various functions provided in the embodiments of this application. The sequence numbers of the embodiments of this application above are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0086] Figure 6 A schematic block diagram of a computer system architecture for implementing embodiments of the present application is shown. Figure 6 As shown, the computer system 600 includes a Central Processing Unit (CPU) 601, which performs various appropriate actions and processes based on programs stored in ROM 602 or loaded into RAM 603 from storage section 608. Random access memory 603 also stores various programs and data required for system operation. The CPU 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0087] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card, such as a local area network card or modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0088] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit 601, it performs various functions defined in the system of this application.

[0089] It should be noted that, Figure 6 The computer system 600 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0090] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0091] The above are merely preferred 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 principles of this application should be included within the protection scope of this application.

Claims

1. A method for resolving a domain name, characterized by, Applied to a virtual machine, which is deployed in the target application, including: Upon receiving a target request sent by the target application, the target operation is intercepted. The target request is for resolving a target domain name, and the target operation is for the target application to call a raw resolution function. The raw resolution function is a function provided by the target system kernel and is used to resolve the target domain name. The target domain name is resolved based on the target mapping table to obtain the resolution result. The target mapping table is used to store the mapping relationship between the domain name and multiple Internet Protocol addresses. If the resolution result indicates that the resolution has failed, the original resolution function is invoked to resolve the target domain name.

2. The method of claim 1, wherein, Before intercepting the target operation upon receiving a target request from the target application, the method further includes: Generate the target configuration file for the target application; The target mapping table is determined based on the target configuration file.

3. The method of claim 2, wherein, Generate the target configuration file for the target application, including: Determine the domain name and the multiple first protocol addresses corresponding to the domain name; Determine the target communication protocol corresponding to the domain name; For each target protocol address included in each of the first protocol addresses, a target operation is performed to determine the first sub-configuration file corresponding to the target protocol address, thereby obtaining multiple first sub-configuration files; The first sub-configuration files are identified as files included in the target configuration file; The target operation includes: determining the first port of the target protocol address, and determining the domain name, the target protocol address, the first port, and the target communication protocol as the first sub-configuration file.

4. The method of claim 2, wherein, Determining the target mapping table based on the target configuration file includes: Read the target configuration file at preset time intervals; The first configuration information included in the target configuration file is detected to obtain a detection result, wherein the first configuration information includes at least one of the following: a first protocol address and a first port; The second configuration information included in the first configuration information is determined, and the detection result of the second configuration information is that the detection is passed. The target mapping table is determined based on the second sub-configuration file corresponding to the second configuration information.

5. The method of claim 4, wherein, Determining the target mapping table based on the second sub-configuration file corresponding to the second configuration information includes: The domain names included in each of the second sub-configuration files are determined, resulting in multiple first domain names; In the case where multiple first domains include the same second domain, multiple second protocol addresses corresponding to the second domain are determined; The multiple addresses of the second protocol are determined as a circular array; The second domain name and the circular array are defined as a binary array; The mapping table containing the binary array is determined as the target mapping table.

6. The method of claim 1, wherein, The target domain name is resolved based on the target mapping table to obtain the resolution result, including: If the target domain name is included in the target mapping table, the target loop array corresponding to the target domain name is determined from the loop array included in the target mapping table; The protocol address pointed to by the target circular array pointer is determined as the third protocol address of the target domain name; If the third protocol address is determined, the resolution result is determined to be successful.

7. The method of claim 6, wherein, After determining the protocol address pointed to by the target circular array pointer as the third protocol address of the target domain name, the method further includes at least one of the following: Send the third protocol address to the target application; The target circular array pointer is set to point to the fourth protocol address included in the target circular array, wherein, if the third protocol address is the last address in the target circular array, the fourth protocol address is the first address in the target circular array, and if the third protocol address is not the last address in the target circular array, the fourth protocol address is the address following the third protocol address.

8. A domain name resolution apparatus characterized by comprising: include: An interception module is used to intercept a target operation when a target request is received from a target application. The target request is for resolving a target domain name, and the target operation is for the target application to call a raw resolution function, which is a function provided by the target system kernel, and the raw resolution function is used to resolve the target domain name. The resolution module is used to resolve the target domain name based on the target mapping table to obtain the resolution result. The target mapping table is used to store the mapping relationship between the domain name and multiple Internet Protocol addresses. The calling module is used to invoke the original parsing function to resolve the target domain name if the parsing result indicates that the parsing has failed.

9. A computer program product comprising computer programs / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of 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 a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 7.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.