CN111935329B - Domain name resolution method and device - Google Patents

Domain name resolution method and device Download PDF

Info

Publication number
CN111935329B
CN111935329B CN202010686061.3A CN202010686061A CN111935329B CN 111935329 B CN111935329 B CN 111935329B CN 202010686061 A CN202010686061 A CN 202010686061A CN 111935329 B CN111935329 B CN 111935329B
Authority
CN
China
Prior art keywords
domain name
resolution
address
target
reading function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010686061.3A
Other languages
Chinese (zh)
Other versions
CN111935329A (en
Inventor
周坤朋
赵恒平
王路
孟伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Xizhi Information Technology Co ltd
Original Assignee
Zhengzhou Xizhi Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Xizhi Information Technology Co ltd filed Critical Zhengzhou Xizhi Information Technology Co ltd
Priority to CN202010686061.3A priority Critical patent/CN111935329B/en
Publication of CN111935329A publication Critical patent/CN111935329A/en
Application granted granted Critical
Publication of CN111935329B publication Critical patent/CN111935329B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a domain name resolution method and a domain name resolution device, wherein the method comprises the following steps: obtaining a domain name resolution packet transmitted by a client; analyzing a target domain name to be analyzed in the domain name analysis packet; calling a file reading function and transmitting the target domain name to the file reading function; inquiring at least one IP address corresponding to the target domain name from an analysis configuration file through the file reading function, wherein the analysis configuration file is configured by a user and comprises at least one pair of domain name IP corresponding relations, and the domain name IP corresponding relations comprise domain names and one or more IP addresses corresponding to the domain names; determining a target IP address serving as a domain name resolution result from the at least one inquired IP address through the file reading function; and returning the target IP address to the client. The scheme of the application can realize the flexibility of domain name configuration and resolution.

Description

Domain name resolution method and device
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a domain name resolution method and apparatus.
Background
Domain name resolution refers to resolving a domain name to an IP address.
At present, in domain name resolution, a domain name generally corresponds to an IP address uniquely, and therefore, each domain name can only resolve to a fixed IP address. In many scenarios, it may be desirable that the correspondence between the domain name and the IP address is more flexible, so that one domain name may correspond to a plurality of IP addresses or one domain name may correspond to an IP address desired by a user. If the website to be tested includes website a, website B and website C during the stress test, but it is desirable to test website C without changing the test logic, the domain name during the test needs to be resolved to the IP address of website C. For another example, in a big data public opinion monitoring scenario, a web portal may need to crawl data, and the web portal may be provided with a plurality of access nodes, and in order to reduce the pressure of a single access node, domain names may need to correspond to the IPs of the plurality of access nodes to distribute the access pressure. Therefore, under the requirement that the domain name can flexibly correspond to the IP address, how to implement more flexible domain name resolution is a technical problem that needs to be solved urgently by those skilled in the art.
Disclosure of Invention
In view of this, the present application provides a domain name resolution method and apparatus, so as to implement flexibility of domain name configuration and resolution.
In order to achieve the above purpose, the present application provides the following technical solutions:
in one aspect, the present application provides a domain name resolution method, including:
obtaining a domain name resolution packet transmitted by a client;
analyzing a target domain name to be analyzed in the domain name analysis packet;
calling a file reading function, and transmitting the target domain name to the file reading function;
inquiring at least one IP address corresponding to the target domain name from an analysis configuration file through the file reading function, wherein the analysis configuration file is configured by a user and comprises at least one pair of domain name IP corresponding relations, and the domain name IP corresponding relations comprise domain names and one or more IP addresses corresponding to the domain names;
determining a target IP address serving as a domain name resolution result from the at least one inquired IP address through the file reading function;
and returning the target IP address to the client.
Preferably, the determining, by the file reading function, a target IP address as a result of domain name resolution from the at least one IP address obtained by the query includes:
inquiring an IP address corresponding to the target domain name from the analysis configuration file, and determining the inquired IP address as a target IP address serving as a domain name analysis result through the file reading function;
and querying a plurality of IP addresses corresponding to the target domain name from the analysis configuration file, and selecting one IP address from the plurality of IP addresses as a target IP address of a domain name analysis result according to a set selection strategy through the file reading function.
Preferably, the selecting, by the file reading function according to a set selection policy, one IP address from the multiple IP addresses as a target IP address of a domain name resolution result includes:
and randomly selecting one IP address from the plurality of IP addresses through the file reading function as a target IP address of a domain name resolution result.
Preferably, the obtaining of the domain name resolution packet transmitted by the client includes:
obtaining a plurality of domain name resolution packages transmitted by a client;
or obtaining domain name resolution packages transmitted by a plurality of clients to obtain a plurality of domain name resolution packages to be resolved;
before the target domain name to be resolved in the domain name resolution package is resolved, the method further includes:
starting a plurality of resolution threads according to the number of the obtained domain name resolution packages;
respectively allocating the obtained domain name resolution packages to the resolution threads, so that each resolution thread is allocated with one domain name resolution package;
the analyzing the target domain name to be analyzed in the domain name analysis packet comprises the following steps:
for each domain name resolution packet, resolving a target domain name to be resolved in the domain name resolution packet by using a resolution thread corresponding to the domain name resolution packet;
the calling a file reading function and transferring the target domain name to the file reading function includes:
and calling a file reading function by using the analysis thread, and transmitting the target domain name analyzed by the analysis thread to the file reading function.
Preferably, the starting a plurality of resolution threads according to the number of the obtained domain name resolution packages includes:
and calling an asynchronous concurrent program, and starting a plurality of resolution threads through the asynchronous concurrent program based on the number of the domain name resolution packages to be processed.
In another aspect, the present application further provides a domain name resolution apparatus, including:
the packet obtaining unit is used for obtaining a domain name resolution packet transmitted by a client;
the packet analysis unit is used for analyzing a target domain name to be analyzed in the domain name analysis packet;
the function calling unit is used for calling a file reading function and transmitting the target domain name to the file reading function;
a file query unit, configured to query at least one IP address corresponding to the target domain name from an analysis configuration file through the file reading function, where the analysis configuration file is configured by a user and includes at least one pair of domain name IP correspondence relationships, and the domain name IP correspondence relationships include a domain name and one or more IP addresses corresponding to the domain name;
the IP determining unit is used for determining a target IP address serving as a domain name resolution result from the at least one inquired IP address through the file reading function;
and the IP return unit is used for returning the target IP address to the client.
Preferably, the IP determination unit includes:
a first IP determining unit, configured to determine, by using the file reading function, an IP address corresponding to the target domain name as a target IP address serving as a domain name resolution result when the target domain name is queried from the resolution configuration file;
and the second IP determining unit is used for querying a plurality of IP addresses corresponding to the target domain name from the analysis configuration file, and selecting one IP address from the plurality of IP addresses as a target IP address of a domain name analysis result according to a set selection strategy through the file reading function.
Preferably, the second IP determining unit is specifically configured to randomly select one IP address from the multiple IP addresses through the file reading function as a target IP address of a domain name resolution result.
Preferably, the packet obtaining unit is specifically configured to obtain a plurality of domain name resolution packets transmitted by a client; or obtaining domain name resolution packages transmitted by a plurality of clients to obtain a plurality of domain name resolution packages to be resolved;
the device, still include:
a thread starting unit, configured to start a plurality of resolution threads according to the number of obtained domain name resolution packets before the packet resolution unit resolves the domain name resolution packet;
the packet distribution unit is used for distributing the obtained domain name resolution packets to the resolution threads respectively so that each resolution thread is distributed with one domain name resolution packet;
the packet analyzing unit is specifically configured to, for each domain name analyzing packet, analyze a target domain name to be analyzed in the domain name analyzing packet by using an analyzing thread corresponding to the domain name analyzing packet;
the function call unit is specifically configured to call a file reading function by using the analysis thread, and transfer the target domain name analyzed by the analysis thread to the file reading function.
Preferably, the thread starting unit is specifically configured to invoke an asynchronous concurrent program, and start a plurality of resolution threads based on the number of domain name resolution packages to be processed through the asynchronous concurrent program.
As can be seen from the foregoing technical solutions, in the embodiment of the present application, a user can configure one or more IP addresses corresponding to a domain name in an analysis configuration file more flexibly according to actual needs. On this basis, after the device determines the target domain name to be analyzed, at least one IP address configured for the target domain name by the user can be inquired from the analysis configuration file only by calling a file reading function, and the target IP address serving as an analysis result is determined from the at least one IP address configured for the target domain name by the user, so that the domain name can be analyzed into the IP address expected by the user without complex configuration, and the flexibility of domain name analysis is realized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on the provided drawings without creative efforts.
FIG. 1 is a flow chart illustrating a domain name resolution method according to an embodiment of the present application;
FIG. 2 is a flow chart illustrating a domain name resolution method according to another embodiment of the present application;
fig. 3 is a schematic diagram illustrating a structure of a domain name resolution apparatus according to an embodiment of the present disclosure.
Detailed Description
The domain name resolution method and the domain name resolution device can be applied to any computer equipment, such as a server, a personal computer or computer equipment for testing or data analysis.
According to the domain name resolution method and device, the user can be supported to configure one or more IP addresses for one domain name in the domain name resolution process under the condition that complex configuration is not needed, the domain name can be resolved into one IP address in the IP addresses configured by the user based on the one or more IP addresses configured by the user for the domain name, the complexity of domain name resolution supporting multiple IP addresses can be reduced, and the flexibility of domain name resolution can be improved.
The following describes a domain name resolution method according to the present application with reference to a flowchart.
As shown in fig. 1, which shows a schematic flow diagram of an embodiment of a domain name resolution method according to the present application, the method of the present embodiment may be applied to a computer device, for example, a domain name resolution program may be run on the computer device, and the domain name resolution method according to the present application may be implemented by the domain name resolution program.
The method of the embodiment may include:
s101, obtaining a domain name resolution package transmitted by a client.
And S102, resolving the target domain name to be resolved in the domain name resolution packet.
The domain name resolution packet may be a data packet to be subjected to domain name resolution, and the data packet may contain a domain name to be resolved, so that the domain name to be resolved can be obtained by resolving the domain name data packet.
For example, a domain name resolution request transmitted by a client may be obtained, and the domain name resolution request may exist in the form of a data packet. The domain name resolution request can carry the domain name to be resolved, so the domain name to be resolved can be obtained by resolving the domain name resolution request.
For the convenience of distinguishing, the domain name to be resolved is called a target domain name in the application.
It should be noted that, in the present application, the electronic device where the client sending the domain name resolution package is located may be the computer device, or may be another electronic device other than the computer device. If the client is a client of a browser, the client may run in the same computer device as the domain name resolution program; for another example, the electronic device to which the client belongs is different from the computer device, and a proxy server is run on the computer device, so that the client transmits the domain name resolution packet to the domain name resolution program through the proxy server.
S103, calling a file reading function and transmitting the target domain name to the file reading function.
S104, at least one IP address corresponding to the target domain name is inquired from the analysis configuration file through the file reading function.
The analysis configuration file is configured by a user and comprises at least one pair of domain name IP corresponding relations. Each pair of domain name IP correspondence includes a domain name and one or more IP addresses corresponding to the domain name.
Different from the existing method that different IP addresses are preset for each domain name in a domain name resolution server, in the application, a resolution configuration file is independently configured to store the corresponding relation between the domain name and the IP address, and one or more IP addresses to which the domain name can be mapped can be flexibly set by modifying the resolution configuration file.
Moreover, in a test or data acquisition scenario, if it is desired to change a test device or an object for acquiring data, the resolution configuration file may be directly modified to change an IP address to which a domain name may be mapped without adjusting the domain name resolution logic of the domain name resolution server.
The file reading function may be regarded as a method for packaging, and the file reading function is configured to read the parsing configuration file and query the IP address corresponding to the domain name from the parsing configuration file.
For example, a domain name resolution program run by the computer device includes the file reading function, and after the domain name resolution program obtains a domain name to be resolved, the file reading function may be called, and the domain name to be resolved is transferred to the file reading function, so as to query a resolution configuration file through the file reading function, and determine an IP address to which the domain name can be mapped.
And S105, determining a target IP address serving as a domain name resolution result from the at least one inquired IP address through the file reading function.
And the target IP address is the IP address for finally determining the domain name resolution result corresponding to the target domain name.
It is understood that there are many cases in determining the IP address as the result of domain name resolution from the queried at least one IP address.
If only one IP address corresponding to the target domain name is inquired from the resolution configuration file, the inquired IP address is determined as the target IP address serving as the domain name resolution result through the file reading function, namely, the IP address finally resolved.
For another example, when a plurality of IP addresses corresponding to the target domain name are searched from the resolution configuration file, one IP address is selected from the plurality of IP addresses as the target IP address of the domain name resolution result according to the set selection policy through the file reading function.
Wherein, the set selection strategy can be set according to the requirement. For example, in one possible approach, the selection policy is set to a random selection policy. Correspondingly, one IP address can be randomly selected from the plurality of IP addresses through the file reading function to serve as a target IP address of a domain name resolution result.
For example, suppose that in a big data public opinion monitoring scene, a large amount of data support needs to be obtained, and the data needs to go to various big public websites to crawl. Most portal websites are provided with access nodes in a plurality of cities throughout the country, so that users in different cities can access the access nodes in corresponding cities through clients, the access speed is improved, and the access pressure of the access nodes can be reduced. However, in the data crawling process, if the domain name of the website is configured as a fixed IP address, only a fixed access node in the website can be accessed each time, which results in a large pressure on the access node. The domain name of the website is configured into the IP addresses of a plurality of access nodes corresponding to the website in the resolution configuration file, and one IP address is randomly selected from the IP addresses each time in the domain name resolution process to serve as a target IP address corresponding to the domain name of the website, so that the method and the device are beneficial to crawling data from the access nodes of the website dispersedly, and the pressure of a single access node is reduced.
For another example, in another possible manner, the setting of the selection policy may be according to a sequence of a plurality of IP addresses corresponding to the domain name, as the sequence of the IP addresses determined as the IP addresses corresponding to the domain name. On this basis, after receiving the resolution request of the domain name each time, a target IP address can be determined according to the sequence, and after receiving the resolution request of the domain name again next time, the next sequential IP address can be determined as the target IP address.
Of course, there are other possibilities for setting the selection policy, which is not limited in this respect.
And S106, returning the target IP address to the client.
If so, the domain name resolution program obtains the determined target IP address from the file reading function and returns the target IP address to the client side sending the domain name resolution packet.
The specific manner of returning the target IP address obtained by the analysis to the client is not limited, and for example, the target IP address may be encapsulated into a data packet, and then the data packet encapsulated with the target IP address is sent to the corresponding client.
As can be seen, in the embodiment of the present application, a user may configure one or more IP addresses corresponding to a domain name in an analysis configuration file according to actual needs. On this basis, after the device determines the target domain name to be analyzed, at least one IP address configured for the target domain name by the user can be inquired from the analysis configuration file only by calling a file reading function, and the target IP address serving as an analysis result is determined from the at least one IP address configured for the target domain name by the user, so that the domain name can be analyzed into the IP address expected by the user without complex configuration, and the flexibility of domain name analysis is realized.
Meanwhile, the inventor of the present application found through research that: although a plurality of IP addresses can be configured for one domain name through one cloud platform, the configuration and deployment of the cloud platform are high in complexity, and are not beneficial to testing or data crawling and other scenes, and the configuration of the plurality of IP addresses for one domain name and flexible domain name resolution are conveniently achieved. According to the method and the device, only relevant configuration needs to be carried out on the analysis configuration file, other complicated configuration is not needed, and the method and the device can flexibly configure a plurality of IP addresses for the domain name and carry out corresponding domain name analysis based on the scheme of the method and the device.
For example, only the computer device needs to install and operate the domain name resolution program, and on this basis, after the user performs configuration of the relevant domain name and IP on the resolution configuration file, the user can read the resolution configuration file through the file reading function in the domain name resolution program and determine the target IP from the multiple IPs corresponding to the domain name, and the installation and configuration in the whole process are simple.
Moreover, after the domain name IP correspondence in the analysis configuration file needs to be modified, since the analysis configuration file is an independent file and does not involve code modification of a domain name analysis program, and the like, domain name analysis can be performed based on the modified analysis configuration file without re-running.
It can be understood that a plurality of domain names to be resolved may exist in the computer device at the same time, and if the computer device resolves the plurality of domain names in sequence, it is necessary to spend a long time, resulting in a resolution delay, so that the time for the client to wait for the resolution result is relatively short. In order to solve the problem, the application also provides a scheme for concurrently processing a plurality of domain names to be resolved.
For example, referring to fig. 2, which shows a schematic flow chart of another embodiment of the domain name resolution method of the present application, the method of the present embodiment may include:
s201, obtaining a plurality of domain name resolution packages.
For example, a plurality of domain name resolution packages transmitted by the client are obtained. Or obtaining a plurality of domain name resolution packages transmitted by a plurality of clients to obtain a plurality of domain name resolution packages to be resolved.
S202, starting a plurality of resolution threads according to the number of the obtained domain name resolution packages.
In order to improve the domain name resolution efficiency, under the condition that a plurality of domain name resolution packages to be resolved exist at the same time, the computer equipment starts a plurality of resolution threads so as to respectively resolve different domain name resolution packages through the plurality of resolution threads, and the plurality of domain name resolution packages are concurrently resolved.
For example, in one implementation, an asynchronous concurrency program may be invoked and multiple resolution threads may be started by the asynchronous concurrency program based on the number of domain name resolution packets to be processed. For example, the domain name resolution program may call an asynchronous concurrent program encapsulated in the same package as the domain name resolution package, so as to start multiple threads through the asynchronous concurrent program, and the multiple started threads are referred to as resolution threads in the present application.
Optionally, the asynchronous concurrent program may be an asynchronous concurrent program based on a python language, for example, the asynchronous concurrent program may be a get program.
S203, respectively allocating the obtained domain name resolution packages to the plurality of resolution threads, so that each resolution thread is allocated with a domain name resolution package.
And S204, for each domain name resolution packet, resolving a target domain name to be resolved in the domain name resolution packet by using a resolution thread corresponding to the domain name resolution packet.
The multiple resolution threads can concurrently process the domain name resolution packages which need to be processed respectively.
And S205, calling a file reading function by using the analysis thread, and transmitting the target domain name analyzed by the analysis thread to the file reading function.
S206, aiming at each analysis thread, at least one IP address corresponding to the target domain name is inquired from the analysis configuration file through the file reading function, and the target IP address serving as a domain name analysis result is determined from the at least one IP address.
After the target domain name in the domain name resolution package is resolved by each resolution thread, a file reading function can be called to read the resolution configuration file, and finally, the domain name resolution result corresponding to the target domain name pair resolved by the resolution thread is determined.
The process of analyzing the file reading function to obtain the target IP address may refer to the related description of the foregoing embodiment, and is not described herein again.
And S207, acquiring a target IP address resolved by the file reading function through the resolution thread, and sending the target IP address to a client requesting to resolve the target domain name.
After each resolution thread sends the resolved target domain name to the file reading function, the target IP address resolved by the file reading function for the target domain name can be obtained, and correspondingly, the resolution thread can return the target IP to the corresponding client.
In response to the domain name resolution method of the present application, the present application also provides a domain name resolution apparatus, as shown in fig. 3, which shows a schematic structural diagram of an embodiment of the domain name resolution apparatus of the present application. The apparatus of this embodiment may include:
a packet obtaining unit 301, configured to obtain a domain name resolution packet transmitted by a client;
a packet parsing unit 302, configured to parse a target domain name to be parsed in the domain name parsing packet;
a function calling unit 303, configured to call a file reading function, and transfer the target domain name to the file reading function;
a file querying unit 304, configured to query, through the file reading function, at least one IP address corresponding to the target domain name from an analysis configuration file, where the analysis configuration file is configured by a user and includes at least one pair of domain name IP correspondence, and the domain name IP correspondence includes a domain name and one or more IP addresses corresponding to the domain name;
an IP determining unit 305, configured to determine, from the at least one IP address obtained through the query by using the file reading function, a target IP address as a result of domain name resolution;
an IP returning unit 306, configured to return the target IP address to the client.
In one possible implementation manner, the IP determining unit includes:
a first IP determining unit, configured to determine, by using the file reading function, an IP address corresponding to the target domain name as a target IP address serving as a domain name resolution result when the target domain name is queried from the resolution configuration file;
and the second IP determining unit is used for querying a plurality of IP addresses corresponding to the target domain name from the analysis configuration file, and selecting one IP address from the plurality of IP addresses as a target IP address of a domain name analysis result according to a set selection strategy through the file reading function.
Optionally, the second IP determining unit is specifically configured to randomly select one IP address from the multiple IP addresses through the file reading function as a target IP address of a domain name resolution result.
In another possible implementation manner, the packet obtaining unit is specifically configured to obtain a plurality of domain name resolution packets transmitted by a client; or obtaining domain name resolution packages transmitted by a plurality of clients to obtain a plurality of domain name resolution packages to be resolved;
the device, still include:
a thread starting unit, which is used for starting a plurality of resolution threads according to the number of the obtained domain name resolution packages before the package resolution unit resolves the domain name resolution packages;
the packet distribution unit is used for distributing the obtained domain name resolution packets to the resolution threads respectively so that each resolution thread is distributed with one domain name resolution packet;
the packet analyzing unit is specifically configured to, for each domain name analyzing packet, analyze a target domain name to be analyzed in the domain name analyzing packet by using an analyzing thread corresponding to the domain name analyzing packet;
the function call unit is specifically configured to call a file reading function by using the analysis thread, and transfer the target domain name analyzed by the analysis thread to the file reading function.
Optionally, the thread starting unit is specifically configured to invoke an asynchronous concurrent program, and start a plurality of resolution threads based on the number of domain name resolution packages to be processed through the asynchronous concurrent program.
For the device embodiments, since they correspond substantially to the method embodiments, reference may be made to the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be embodied in other specific forms without departing from the spirit or scope of the present application. The present embodiment is an exemplary example only, and should not be taken as limiting, and the specific disclosure should not be taken as limiting the purpose of the application. For example, the division of the unit or the sub-unit is only one logical function division, and there may be another division manner in actual implementation, for example, a plurality of units or a plurality of sub-units are combined together. In addition, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
Additionally, the systems and methods described, as well as the illustrations of various embodiments, can be combined or integrated with other systems, modules, techniques, or methods without departing from the scope of the application. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The foregoing is directed to embodiments of the present invention, and it is understood that various modifications and improvements can be made by those skilled in the art without departing from the spirit of the invention.

Claims (8)

1. A domain name resolution method is characterized by comprising the following steps:
obtaining a domain name resolution packet transmitted by a client;
analyzing a target domain name to be analyzed in the domain name analysis packet;
calling a file reading function, and transmitting the target domain name to the file reading function;
querying at least one IP address corresponding to the target domain name from an analysis configuration file through the file reading function, wherein the analysis configuration file is configured by a user and comprises at least one pair of domain name IP corresponding relations, and the domain name IP corresponding relations comprise domain names and one or more IP addresses corresponding to the domain names;
determining a target IP address serving as a domain name resolution result from the at least one inquired IP address through the file reading function, wherein the step comprises the following steps: inquiring a plurality of IP addresses corresponding to the target domain name from the analysis configuration file, and selecting one IP address from the plurality of IP addresses as a target IP address of a domain name analysis result according to a set selection strategy through the file reading function;
returning the target IP address to the client;
wherein, selecting an IP address from the plurality of IP addresses as a target IP address of a domain name resolution result according to a set selection policy by the file reading function includes: and randomly selecting one IP address from the plurality of IP addresses through the file reading function as a target IP address of a domain name resolution result.
2. The method according to claim 1, wherein the determining, by the file reading function, a target IP address as a result of domain name resolution from the at least one IP address obtained by the query, further comprises:
and if the target domain name corresponds to one IP address, determining the inquired IP address as the target IP address serving as the domain name resolution result through the file reading function.
3. The method according to claim 1, wherein the obtaining the domain name resolution package transmitted by the client comprises:
obtaining a plurality of domain name resolution packages transmitted by a client;
or obtaining domain name resolution packages transmitted by a plurality of clients to obtain a plurality of domain name resolution packages to be resolved;
before the target domain name to be resolved in the domain name resolution package is resolved, the method further includes:
starting a plurality of resolution threads according to the number of the obtained domain name resolution packages;
respectively allocating the obtained domain name resolution packages to the resolution threads, so that each resolution thread is allocated with one domain name resolution package;
the analyzing the target domain name to be analyzed in the domain name analysis packet includes:
for each domain name resolution packet, resolving a target domain name to be resolved in the domain name resolution packet by using a resolution thread corresponding to the domain name resolution packet;
the calling a file reading function and transferring the target domain name to the file reading function includes:
and calling a file reading function by using the analysis thread, and transmitting the target domain name analyzed by the analysis thread to the file reading function.
4. The method according to claim 3, wherein starting a plurality of resolution threads according to the obtained number of domain name resolution packages comprises:
and calling an asynchronous concurrent program, and starting a plurality of analysis threads through the asynchronous concurrent program based on the number of the domain name analysis packages to be processed.
5. A domain name resolution apparatus, comprising:
the packet obtaining unit is used for obtaining a domain name resolution packet transmitted by a client;
the packet analysis unit is used for analyzing a target domain name to be analyzed in the domain name analysis packet;
the function calling unit is used for calling a file reading function and transmitting the target domain name to the file reading function;
a file query unit, configured to query at least one IP address corresponding to the target domain name from an analysis configuration file through the file reading function, where the analysis configuration file is configured by a user and includes at least one pair of domain name IP correspondence relationships, and the domain name IP correspondence relationships include a domain name and one or more IP addresses corresponding to the domain name;
an IP determining unit, configured to determine, from the at least one IP address obtained through the query by using the file reading function, a target IP address serving as a result of domain name resolution, where the IP determining unit includes: a second IP determining unit, configured to, if multiple IP addresses corresponding to the target domain name are found in the parsing configuration file, select an IP address from the multiple IP addresses as a target IP address of a domain name parsing result according to a set selection policy through the file reading function; the second IP determining unit is specifically configured to randomly select one IP address from the multiple IP addresses through the file reading function as a target IP address of a domain name resolution result;
and the IP return unit is used for returning the target IP address to the client.
6. The apparatus of claim 5, wherein the IP determination unit further comprises:
and the first IP determining unit is used for determining the inquired IP address as the target IP address serving as the domain name resolution result through the file reading function when the IP address corresponding to the target domain name is inquired from the resolution configuration file.
7. The apparatus according to claim 5, wherein the packet obtaining unit is specifically configured to obtain a plurality of domain name resolution packets transmitted by a client; or obtaining domain name resolution packages transmitted by a plurality of clients to obtain a plurality of domain name resolution packages to be resolved;
the device, still include:
the thread starting unit is used for starting a plurality of analysis threads according to the number of the obtained domain name analysis packages before the package analysis unit analyzes the domain name analysis packages;
the packet distribution unit is used for distributing the obtained domain name resolution packets to the resolution threads respectively so that each resolution thread is distributed with one domain name resolution packet;
the packet analyzing unit is specifically configured to analyze, for each domain name analyzing packet, a target domain name to be analyzed in the domain name analyzing packet by using an analyzing thread corresponding to the domain name analyzing packet;
the function calling unit is specifically configured to call a file reading function by using the analysis thread, and transfer the target domain name analyzed by the analysis thread to the file reading function.
8. The apparatus according to claim 7, wherein the thread starting unit is specifically configured to invoke an asynchronous concurrent program, and start a plurality of resolution threads by the asynchronous concurrent program based on the number of domain name resolution packages to be processed.
CN202010686061.3A 2020-07-16 2020-07-16 Domain name resolution method and device Active CN111935329B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010686061.3A CN111935329B (en) 2020-07-16 2020-07-16 Domain name resolution method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010686061.3A CN111935329B (en) 2020-07-16 2020-07-16 Domain name resolution method and device

Publications (2)

Publication Number Publication Date
CN111935329A CN111935329A (en) 2020-11-13
CN111935329B true CN111935329B (en) 2023-03-31

Family

ID=73313176

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010686061.3A Active CN111935329B (en) 2020-07-16 2020-07-16 Domain name resolution method and device

Country Status (1)

Country Link
CN (1) CN111935329B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938462B (en) * 2020-12-28 2024-07-16 京东科技控股股份有限公司 Domain name resolution method, device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106210147A (en) * 2016-09-13 2016-12-07 郑州云海信息技术有限公司 A kind of load-balancing method based on poll and device
CN108737582A (en) * 2017-04-18 2018-11-02 艺龙网信息技术(北京)有限公司 The method and device of domain name mapping
CN110149423A (en) * 2019-07-04 2019-08-20 深圳市珍爱捷云信息技术有限公司 Domain name processing method, device, readable storage medium storing program for executing and electronic equipment
CN110753136A (en) * 2019-10-24 2020-02-04 北京锐安科技有限公司 Domain name resolution method, device, equipment and storage medium
CN111049941A (en) * 2019-11-27 2020-04-21 上海帝联网络科技有限公司 DNS scheduling method, domain name server and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105897822B (en) * 2015-11-11 2019-07-26 法法汽车(中国)有限公司 A kind of content distributing network CDN node selection method and its device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106210147A (en) * 2016-09-13 2016-12-07 郑州云海信息技术有限公司 A kind of load-balancing method based on poll and device
CN108737582A (en) * 2017-04-18 2018-11-02 艺龙网信息技术(北京)有限公司 The method and device of domain name mapping
CN110149423A (en) * 2019-07-04 2019-08-20 深圳市珍爱捷云信息技术有限公司 Domain name processing method, device, readable storage medium storing program for executing and electronic equipment
CN110753136A (en) * 2019-10-24 2020-02-04 北京锐安科技有限公司 Domain name resolution method, device, equipment and storage medium
CN111049941A (en) * 2019-11-27 2020-04-21 上海帝联网络科技有限公司 DNS scheduling method, domain name server and computer readable storage medium

Also Published As

Publication number Publication date
CN111935329A (en) 2020-11-13

Similar Documents

Publication Publication Date Title
JP6912469B2 (en) Access request conversion method and device
CN109067930B (en) Domain name access method, domain name resolution method, server, terminal and storage medium
US6324580B1 (en) Load balancing for replicated services
US7152118B2 (en) System, method and computer program product for caching domain name system information on a network gateway
CN103685590B (en) Obtain the method and system of IP address
CN109347997A (en) Domain name analytic method, device, server and storage medium
CN102077189A (en) Request routing using network computing components
CN101981572A (en) Request routing
CN102047243A (en) Request routing based on class
CN103167044A (en) Intelligent analysis method of domain name system (DNS) and poking measurement device and system
CN104092785A (en) Method for domain name registration and resolution, and resource access method and resource access device based on domain name
CN111787129A (en) Method and system for configuring local DNS server for client
CN111935329B (en) Domain name resolution method and device
CN113315852B (en) Domain name resolution method, device and system
CN105915655B (en) Network agent method and agency plant
CN113014573B (en) Monitoring method, system, electronic device and storage medium of DNS (Domain name Server)
CN111614792B (en) Transparent transmission method, system, server, electronic device and storage medium
CN113596105B (en) Content acquisition method, edge node and computer readable storage medium
CN114356456A (en) Service processing method, device, storage medium and electronic equipment
CN114928556A (en) Interface service test method and related equipment
CN112714078A (en) Network traffic identification method and device, storage medium and server
KR100347985B1 (en) System for Providing the Internet Address Supplementary Services and Method thereof
CN104869182A (en) Domain name resolution method and device
CN114401247B (en) High concurrency service request processing system based on bind service
CN114915610B (en) Method, device, electronic equipment and storage medium for sending network request

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant