Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
A first embodiment provided by the present disclosure is an embodiment of a method for resolving a domain name.
The embodiments of the present disclosure are described in detail below with reference to fig. 1 and fig. 2, where fig. 1 is a flowchart of a method for resolving a domain name provided by the embodiments of the present disclosure; fig. 2 illustrates a network structure diagram of a method of resolving a domain name according to an embodiment of the present disclosure.
Step S101, acquiring a retrieval domain name.
The IP address, which is called an internet protocol address in its entirety, is a digital label assigned to an internet protocol device used by a user to access the internet. The IP address is a uniform address format provided by the IP protocol, and it allocates a logical address to each network and each host on the internet, so as to mask the difference of physical addresses. The web content is only finally accessible via the IP address. Web page content is typically accessed using a domain name that is easy to remember, instead of an IP address, to which the domain name and IP address are mapped.
A Domain Name (also called Domain Name) is a Name of a certain computer or group of computers on the internet, which is composed of a string of names separated by dots, and is used to identify the electronic position (sometimes also referred to as geographical location) of the computer during data transmission. For example www.sohu.com or www.sina.com.cn. Generally, after a domain name is input in an address bar in a user interface of a browser, a corresponding IP address is retrieved through the domain name, and then web page content guided by the IP address can be displayed in a display area of the browser.
And step S102, searching whether the domain name matched with the searched domain name exists in the request context information stored in the local cache based on a preset filtering condition.
A local cache (english cache), referred to as cache for short, is a memory (also called SRAM) with a faster access speed than a general random access memory (also called DRAM).
The disclosed embodiments provide a request context information during domain name resolution. The request context information is a data set that is stored in a local cache and maps a domain name and an IP address to each other. The IP address is retrieved through the request context information cached locally, and the response speed of webpage access is improved.
Requesting context information, including: the domain name, the corresponding IP address, the effective time threshold value and the preset elimination strategy.
The preset elimination strategy is a strategy for eliminating the domain name in the request context information.
The preset filtering condition refers to a condition that the domain name meets a preset elimination strategy and is within an effective time threshold range.
The method comprises the steps of searching whether a domain name matched with a searched domain name exists in request context information stored in a local cache based on a preset filtering condition, firstly obtaining a preset elimination strategy in the request context information, screening a plurality of first effective domain names from the request context information according to the preset elimination strategy, then screening a second effective domain name from the first effective domain names according to an effective time threshold, and judging whether the domain name matched with the searched domain name exists in the second effective domain name.
Step S103, if not, generating a first domain name resolution request message including the retrieval domain name based on a protocol associated with a transmission control protocol, and sending the first domain name resolution request message to a first domain name resolution server.
And if the retrieval domain name does not exist in the request context information cached locally, sending a first domain name resolution request message to the first domain name resolution server so as to acquire a required domain name resolution result from the first domain name resolution server.
A Transmission Control Protocol (TCP) is a connection-oriented, reliable transport layer communication Protocol based on byte stream.
Another common communication Protocol is the User Datagram Protocol (UDP), which is a simple connectionless, unreliable Datagram oriented transport layer Protocol. The traditional local domain name resolution server (LocalDNS) uses UDP communication. The domain name resolution using the LocalDNS faces some problems such as domain name resolution hijacking, domain name resolution pollution, slow node scheduling effect and the like.
The protocol associated with the transmission control protocol is a communication protocol extended on the basis of TCP. Such as HTTP. HTTP is a simple request-response protocol, which typically runs on top of TCP, specifying what messages a client may send to a server and what responses to get.
The domain name resolution by adopting the protocol associated with the transmission control protocol can avoid the domain name resolution hijacking problem or the domain name resolution pollution problem caused by adopting the protocol associated with the user datagram protocol to carry out the domain name resolution.
The function of the first domain name resolution server in the embodiment of the present disclosure is the same as that of a LocalDNS, and the difference is only the communication mode with the client.
After the sending of the first domain name resolution request message to the first domain name resolution server, the method further includes the following steps:
step S104, a first domain name resolution result is obtained according to the first domain name resolution response message returned by the first domain name resolution server.
The method specifically comprises the following steps:
and step S104-21, acquiring a first domain name resolution response message returned by the first domain name resolution server.
The first domain name resolution response message is a message returned by the first domain name resolution server in response to the first domain name resolution request message.
And step S104-22, analyzing the message header information of the first domain name resolution response message, and acquiring a first domain name resolution result.
The first domain name resolution result comprises: the domain name, the corresponding IP address, the effective time threshold value and the preset elimination strategy.
Step S104-23, the first domain name resolution result is stored in the request context information.
And storing the acquired first domain name resolution result in the request context information of the local cache, thereby improving the efficiency of searching the domain name next time.
Optionally, before the obtaining of the first domain name resolution response message returned by the first domain name resolution server, the method further includes the following steps:
step S104-11, obtaining the delay time of the first domain name resolution server responding to the first domain name resolution request message.
And step S104-12, judging whether the delay time is greater than a preset delay threshold value.
The preset delay threshold is a time for limiting access to the first domain name resolution server, and if the delay time is greater than the preset delay threshold, it is determined that a problem occurs in accessing the first domain name resolution server. For example, the network connecting the first domain name resolution server is congested or the first domain name resolution server is running slowly.
And step S104-13, if yes, generating a second domain name resolution request message including the retrieval domain name based on a protocol associated with a user datagram protocol, and sending the second domain name resolution request message to a local domain name resolution server.
And when the first domain name resolution server cannot normally respond to the first domain name resolution request message, acquiring a domain name resolution result by adopting a traditional domain name resolution mode.
After the sending of the second domain name resolution request message to the local domain name resolution server, the method further includes the following steps:
and step S104-14, acquiring a second domain name resolution response message returned by the local domain name resolution server.
And step S104-15, analyzing the message body information of the second domain name resolution response message, and acquiring a second domain name resolution result.
Step S104-16, the second domain name resolution result is stored in the request context information.
The embodiment of the disclosure provides a method for storing the domain name resolution result in the request context information of the local cache, thereby greatly reducing the delay problem during the http dns domain name resolution and improving the response speed of the domain name resolution.
Corresponding to the first embodiment provided by the present disclosure, the present disclosure also provides a second embodiment, that is, an apparatus for resolving a domain name. Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant portions should be referred to the corresponding description of the first embodiment. The device embodiments described below are merely illustrative.
Fig. 3 illustrates an embodiment of an apparatus for resolving a domain name provided by the present disclosure. Fig. 3 is a block diagram of units of an apparatus for resolving a domain name according to an embodiment of the present disclosure.
Referring to fig. 3, the present disclosure provides an apparatus for resolving a domain name, including: an acquisition unit 301, a retrieval unit 302, and a first request unit 303.
An obtaining unit 301, configured to obtain a search domain name;
a retrieving unit 302, configured to retrieve, based on a preset filtering condition, whether a domain name matching the retrieved domain name exists in the request context information stored in the local cache;
a first requesting unit 303, configured to, if the output result of the retrieving unit 302 is "no", generate a first resolved domain name request message including the retrieved domain name based on a protocol associated with a transmission control protocol, and send the first resolved domain name request message to a first domain name resolution server.
Optionally, in the apparatus, the apparatus further includes: acquiring a first domain name resolution result unit;
the unit for obtaining the first domain name resolution result includes:
a first domain name resolution server sub-unit is used for receiving a first domain name resolution request message from a first domain name resolution server;
a first domain name resolution result acquisition subunit, configured to analyze header information of the first domain name resolution response message, and acquire a first domain name resolution result;
a save first domain name resolution result subunit, configured to save the first domain name resolution result in the request context information.
Optionally, in the apparatus, the apparatus further includes: a second request unit;
in the second request unit, comprising:
an obtaining delay time subunit, configured to obtain a delay time for the first domain name resolution server to respond to the first resolution domain name request message;
a delay time judging subunit, configured to judge whether the delay time is greater than a preset delay threshold;
and a send second domain name resolution request message subunit, configured to, if the output result of the determination delay time subunit is "yes", generate a second domain name resolution request message including the retrieved domain name based on a protocol associated with a user datagram protocol, and send the second domain name resolution request message to the local domain name resolution server.
Optionally, in the apparatus, the apparatus further includes: acquiring a second domain name resolution result unit;
the unit for obtaining the second domain name resolution result includes:
a second domain name resolution response message acquiring subunit, configured to acquire a second domain name resolution response message returned by the local domain name resolution server;
a second domain name resolution result obtaining subunit, configured to analyze message body information of the second domain name resolution response message, and obtain a second domain name resolution result;
and a save second domain name resolution result subunit, configured to save the second domain name resolution result in the request context information.
The embodiment of the disclosure provides a method for storing the domain name resolution result in the request context information of the local cache, thereby greatly reducing the delay problem during the http dns domain name resolution and improving the response speed of the domain name resolution.
The present disclosure provides a third embodiment, that is, an electronic device, where the electronic device is used for a method for resolving a domain name, and the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the one processor to cause the at least one processor to perform the method of resolving a domain name as described in the first embodiment.
The fourth embodiment provides a computer storage medium for resolving a domain name, where the computer storage medium stores computer-executable instructions that can execute the method for resolving a domain name as described in the first embodiment.
Referring now to FIG. 4, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 401 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 401.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.