CN112311774A - Data processing method and device, electronic equipment and storage medium - Google Patents

Data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112311774A
CN112311774A CN202011110831.6A CN202011110831A CN112311774A CN 112311774 A CN112311774 A CN 112311774A CN 202011110831 A CN202011110831 A CN 202011110831A CN 112311774 A CN112311774 A CN 112311774A
Authority
CN
China
Prior art keywords
request
data
network protocol
protocol type
response
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.)
Granted
Application number
CN202011110831.6A
Other languages
Chinese (zh)
Other versions
CN112311774B (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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network 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 Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202011110831.6A priority Critical patent/CN112311774B/en
Publication of CN112311774A publication Critical patent/CN112311774A/en
Application granted granted Critical
Publication of CN112311774B publication Critical patent/CN112311774B/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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention relates to a data processing method, a device, an electronic device and a storage medium, wherein the method comprises the following steps: receiving a data acquisition request of a first network protocol type sent by a client; calling a database corresponding to the first network protocol type, and converting the data acquisition request into request data of a second network protocol type; acquiring response data of a second network protocol type from an upstream server according to the request data; and calling a database corresponding to the first network protocol type, converting the response data into a data acquisition response of the first network protocol type, and sending the data acquisition response to the client. The embodiment of the invention can directly acquire the response data of the second network protocol type corresponding to the request data from the upstream server, ensure that the client can be directly analyzed and used after receiving the response data, and realize the interaction between the client and the upstream server.

Description

Data processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data processing method and apparatus, an electronic device, and a storage medium.
Background
In the current cloud computing product, in order to implement hot change or better fault tolerance for inter-service call, the hot change or better fault tolerance must be completed on 7-layer load balancing (SLB), and currently, 7-layer SLBs of a mainstream all use nginx as a server, and nginx is a lightweight http server.
However, most of the currently received request messages by the nginx server are request messages encapsulated by the client by using a quic (quick UDP Internet connection) protocol, so that the client using the quic protocol cannot interact with the nginx server using the Http protocol.
Disclosure of Invention
In order to solve the technical problems described above or at least partially solve the technical problems, the present application provides a data processing method, an apparatus, an electronic device, and a storage medium.
In a first aspect, the present application provides a data processing method, including:
receiving a data acquisition request of a first network protocol type sent by a client;
calling a database corresponding to the first network protocol type, and converting the data acquisition request into request data of a second network protocol type;
acquiring response data of a second network protocol type from an upstream server according to the request data;
and calling a database corresponding to the first network protocol type, converting the response data into a data acquisition response of the first network protocol type, and sending the data acquisition response to the client.
Optionally, the invoking a database corresponding to the first network protocol type to convert the data obtaining request into request data of a second network protocol type includes:
reading request content in the data acquisition request;
and when the request content is read, executing a hook function corresponding to the request content in the database, and converting the request content into request data of a second network protocol type by using the hook function.
Optionally, the obtaining, by the upstream server according to the request data, response data of the second network protocol type includes:
sending an acquisition request for acquiring response data corresponding to the request data to the upstream server according to the second network protocol type;
response data of the second network protocol type sent by the upstream server is received.
Optionally, the invoking a database corresponding to the first network protocol type, and converting the response data into a data acquisition response of the first network protocol type includes:
when the response data is acquired, executing a hook function corresponding to the response data in the database, and converting the response data into a data acquisition response of a first network type by using the hook function.
Optionally, the method further includes:
detecting whether a handshake request sent by the client is received;
if a handshake request sent by the client is received, executing a hook function corresponding to the handshake request in the database, and searching an authentication certificate corresponding to the handshake request in preset configuration information by using the hook function;
generating a handshake response based on the handshake request and the authentication certificate;
sending the handshake response to the client.
Optionally, the method further includes:
detecting whether a connection establishment request sent by the client side is received;
if a connection establishing request sent by the client is received, executing a hook function corresponding to the connection establishing request in the database, and establishing network connection by using the hook function;
and sending a connection establishment response to the client.
Optionally, the invoking a database corresponding to the first network protocol type to convert the data obtaining request into request data of a second network protocol type further includes:
if the data acquisition request is received, extracting a destination address of the data acquisition request;
reading the message content in the data acquisition request by using the callback function corresponding to the data acquisition request according to the corresponding relation between the preset destination address and the callback function;
and calling a database corresponding to the first network protocol type, and converting the message content into request data of a second network protocol type.
In a second aspect, the present application provides a data processing apparatus comprising:
the receiving module is used for receiving a data acquisition request of a first network protocol type sent by a client;
the first conversion module is used for calling a database corresponding to the first network protocol type and converting the data acquisition request into request data of a second network protocol type;
the acquisition module is used for acquiring response data of a second network protocol type from an upstream server according to the request data;
and the second conversion module is used for calling the database corresponding to the first network protocol type, converting the response data into a data acquisition response of the first network protocol type and sending the data acquisition response to the client.
Optionally, the first conversion module includes:
a first reading unit, configured to read request content in the data acquisition request;
and the execution conversion unit is used for executing a hook function corresponding to the request content in the database when the request content is read, and converting the request content into request data of a second network protocol type by using the hook function.
Optionally, the obtaining module includes:
a sending unit, configured to send, to the upstream server according to the second network protocol type, an acquisition request for acquiring response data corresponding to the request data;
and the receiving unit is used for receiving the response data of the second network protocol type sent by the upstream server.
Optionally, the second conversion module is further configured to:
when the response data is acquired, executing a hook function corresponding to the response data in the database, and converting the response data into a data acquisition response of a first network type by using the hook function.
Optionally, the apparatus further comprises:
the first detection module is used for detecting whether a handshake request sent by the client is received;
the execution searching module is used for executing a hook function corresponding to the handshake request in the database if the handshake request sent by the client is received, and searching an authentication certificate corresponding to the handshake request in preset configuration information by using the hook function;
a generation module to generate a handshake response based on the handshake request and the authentication certificate;
a first sending module, configured to send the handshake response to the client.
Optionally, the apparatus further comprises:
the second detection module is used for detecting whether a connection establishment request sent by the client side is received;
the execution establishing module is used for executing a hook function corresponding to the connection establishing request in the database and establishing network connection by utilizing the hook function if the connection establishing request sent by the client is received;
and the second sending module is used for sending a connection establishing response to the client.
Optionally, the first conversion module is further configured to:
the extracting unit is used for extracting a destination address of the data acquisition request if the data acquisition request is received;
the second reading unit is used for reading the message content in the data acquisition request by using the callback function corresponding to the data acquisition request according to the corresponding relation between the preset destination address and the callback function;
and the calling unit is used for calling a database corresponding to the first network protocol type and converting the message content into request data of a second network protocol type.
In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing the data processing method of any one of the first aspect when executing the program stored in the memory.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon a program of a data processing method, which when executed by a processor, implements the steps of the data processing method of any one of the first aspects.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
the embodiment of the invention receives a data acquisition request of a first network protocol type sent by a client, calls a database corresponding to the first network protocol type, converts the data acquisition request into request data of a second network protocol type, acquires response data of the second network protocol type from an upstream server according to the request data, and finally can call the database corresponding to the first network protocol type, converts the response data into a data acquisition response of the first network protocol type and sends the response data to the client.
According to the embodiment of the invention, the data acquisition request of the first network protocol type of the client is converted into the request data of the second network protocol type, the response data of the second network protocol type corresponding to the request data can be directly acquired from the upstream server, the response data of the second network protocol type is converted into the data acquisition response of the first network protocol type, the client can be ensured to be directly analyzed and used after receiving the response data, and the interaction between the client and the upstream server is realized.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart of a data processing method according to an embodiment of the present application;
fig. 2 is a flowchart illustrating interaction between a client (client) and a nginx server according to an embodiment of the present disclosure;
FIG. 3 is a flowchart of step S102 in FIG. 1;
FIG. 4 is a flowchart of step S103 in FIG. 3;
fig. 5 is another flowchart of a data processing method according to an embodiment of the present application;
fig. 6 is another flowchart of a data processing method according to an embodiment of the present application;
FIG. 7 is a flowchart of step S102 in FIG. 1;
fig. 8 is a block diagram of a data processing apparatus according to an embodiment of the present application;
fig. 9 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The noun explains:
QUIC (quick UDP Internet connection) protocol is a UDP-based low-latency Internet transport layer protocol developed by Google.
The lsquic database is an open source implementation that supports the QUIC protocol. The LSQUIC database provides tools for a QUIC server or client to operate using optional Http (or Http/3) functionality, Http support is directly included in the LSQUIC. The library hides the interaction between the Http application layer and the QUIC transport layer and provides a simple, unified method of sending and receiving Http messages. In the background, the library will compress and decompress the Http header, add and delete Http/3 stream frames, and operate the necessary control flow. The lsquic is a technology which is continuously iterated and advanced, the support and iteration speed related to the lsquic are high, the latest lsquic library can be upgraded to meet the expansion of a quic protocol, and the expandability is excellent. lsquic is more lightweight, has no redundancy beyond supporting the quic protocol, and is easy to learn and maintain code.
Nginx (engine x) is a high-performance HTTP and reverse proxy web server, which is used mainly as a 7-layer SLB in cloud computing network products.
Seven-layer load balancing is at the application layer, which can fulfill protocol requests for many applications. For example, the http application load balancing can implement rules such as http information rewriting, header information rewriting, security application rule control, URL matching rule control, forwarding, rewrite, and the like, so that in the application layer service, what we can do is more, and then Nginx is a typical seven-layer load balancing SLB. Seven-layer load balancing packets are distributed at the topmost layer, but seven-layer load balancing is closer to the service, such as: the http protocol is a seven-layer protocol, and Nginx can be used for session maintenance, URL path rule matching, head header rewriting and the like, which cannot be realized by four-layer load balancing.
epoll (I/O event notification facility, I/O event notification mechanism).
Because most of the currently received request messages encapsulated by the client side by using a quic (quick UDP Internet connection) protocol, the client side using the quic protocol cannot interact with the nginx server using the Http protocol. To this end, an embodiment of the present invention provides a data processing method, an apparatus, an electronic device, and a storage medium, where the data processing method may be applied to a nginx server, where the nginx server includes: the data processing method comprises the following steps that an epoll module, a quic module, an lsquic database and an Http module are used, a nginx server can be respectively communicated with a client and an upstream server, wherein a quic callback function is arranged in the quic module, the quic module is communicated with the lsquic database, and as shown in fig. 1, the data processing method comprises the following steps:
step S101, receiving a data acquisition request of a first network protocol type sent by a client;
in this embodiment of the present invention, the first network protocol type may refer to a quic protocol, and the data obtaining request refers to a request for obtaining data from an upstream server through a nginx server, such as: for example, after the AAA website inputs the search keyword, a request for acquiring data from the server of the AAA website is generated based on the search keyword and the like.
In practical application, after the client sends the data acquisition request to the nginx server, the nginx server receives the data acquisition request.
Exemplarily, fig. 2 is a schematic diagram of an interaction flow between a client (client) and a nginx server, where in a data acquisition request phase requested by the client: the client sends a data acquisition request of the quic protocol, and the nginx server receives the data acquisition request.
Step S102, calling a database corresponding to the first network protocol type, and converting the data acquisition request into request data of a second network protocol type;
in the embodiment of the present invention, the second network protocol type is different from the first network protocol type, for example, the second network protocol type may be an http protocol, and the database may refer to an lsquick database, where the database includes a function for converting a request of the first network protocol type into data of the second network protocol type and a function for converting response data of the second network protocol type into response data of the first network protocol type.
In this step, a function in the lsquic database may convert the data acquisition request, and the request data obtained after the conversion is request data of the second network protocol type.
For example, in practical application, as shown in fig. 2, an epoll in the nginx server receives a data acquisition request, wakes up a read _ handler function of a quic module, the read _ handler function reads a message of the data acquisition request, the quic module calls an lsquic _ packet _ in function in an lsquic database, and the lsquic _ packet _ in function performs quic protocol decapsulation on the message to obtain http request information.
Step S103, response data of a second network protocol type is obtained from an upstream server according to the request data;
in practical application, information such as a destination address, a destination port, request content and the like can be extracted from request data, a corresponding upstream server is determined according to the destination address and the destination port, and response data corresponding to the request content can be acquired from the upstream server.
For example, in practical application, as shown in fig. 2, a quick module calls a lsquick _ process _ contacts function in an lsquick database, the lsquick _ process _ contacts function starts a processing process, the lsquick database calls a parse _ header function, the parse _ header function reads a request header, the lsquick database calls a new stream function, the new stream function establishes a new data stream, a quick callback function calls an init _ connection function, the init _ connection function performs an initialization connection, the lsquick database calls a read stream function, and a quick function calls a run phase function, then an Http module establishes a connection with an upstream stream through an upstream _ connect function, the Http module sends a request to the send request function, and adds an Http event to an overlay, an uplink calls a stream header function, and sends a Http _ header to an upstream server ngx to obtain data to the upstream server.
And step S104, calling a database corresponding to the first network protocol type, converting the response data into a data acquisition response of the first network protocol type, and sending the data acquisition response to the client.
For example, in practical applications, as shown in fig. 2, the Http module calls a c → send _ chain function to notify the quic module that data is to be sent to the client, the quic module calls a stream _ sentwrite function to notify the lsquic database that data is to be sent, the quic module calls an lsquic _ process _ conns function, the lsquic _ process _ conns function starts a processing process, the lsquic database calls a write stream function to convert Http data into response data supporting quic, the lsquic database calls a send packets function, the send packets function sends a data acquisition response to the client, and the lsquic database calls a close stream function to close the data stream.
The embodiment of the invention receives a data acquisition request of a first network protocol type sent by a client, calls a database corresponding to the first network protocol type, converts the data acquisition request into request data of a second network protocol type, acquires response data of the second network protocol type from an upstream server according to the request data, and finally can call the database corresponding to the first network protocol type, converts the response data into a data acquisition response of the first network protocol type and sends the response data to the client.
According to the embodiment of the invention, the data acquisition request of the first network protocol type of the client is converted into the request data of the second network protocol type, the response data of the second network protocol type corresponding to the request data can be directly acquired from the upstream server, the response data of the second network protocol type is converted into the data acquisition response of the first network protocol type, the client can be ensured to be directly analyzed and used after receiving the response data, and the interaction between the client and the upstream server is realized.
In another embodiment of the present invention, as shown in fig. 3, the step S102 includes:
step S201, reading the request content in the data acquisition request;
step S202, when the request content is read, executing a hook function corresponding to the request content in the database, and converting the request content into request data of a second network protocol type by using the hook function.
In an embodiment of the present invention, the hook function may be configured to hook the request content in advance, so that once the request content is read, the hook function may be executed, and the client request is converted into the request data of the second network protocol type by using the hook function.
The embodiment of the invention can convert the request content into the request data of the second network protocol type by utilizing the hook function, and can be conveniently and directly used in an upstream server supporting the second network protocol type.
In another embodiment of the present invention, as shown in fig. 4, the step S103 includes:
step S301, sending an acquisition request for acquiring response data corresponding to the request data to the upstream server according to the second network protocol type;
in this step, an acquisition request of the second network protocol type may be generated based on the request data, and then the acquisition request is sent to the upstream server, so that the upstream server supporting the second network protocol type may directly parse the acquisition request, and search for corresponding data according to the request data in the acquisition request.
Step S302, receiving response data of the second network protocol type sent by the upstream server.
The embodiment of the invention can acquire the corresponding response data in the upstream server through the acquisition request of the second network protocol type, and can be convenient for directly and quickly acquiring the response data of the second network protocol type corresponding to the request data in the upstream server supporting the second network protocol type.
In another embodiment of the present invention, the step S104 includes:
when the response data is acquired, executing a hook function corresponding to the response data in the database, and converting the response data into a data acquisition response of a first network type by using the hook function.
In an embodiment of the present invention, the hooking function may be configured to hook the response data in advance, so that once the response data is obtained, the hooking function may be executed to convert the response data into a data obtaining response of the first network type using the hooking function.
In yet another embodiment of the present invention, as shown in fig. 5, the method further comprises:
step S401, detecting whether a handshake request sent by the client is received;
in this step, the nginx server may continuously detect whether a handshake request sent by the client is received.
In practical applications, as shown in fig. 2, for example, an interaction flow diagram between a client (client) and a nginx server is shown, in a handshake phase of a client request, the client sends a handshake request of a quic protocol, and the nginx server may receive the handshake request.
Step S402, if a handshake request sent by the client is received, executing a hook function corresponding to the handshake request in the database, and searching an authentication certificate corresponding to the handshake request in preset configuration information by using the hook function;
in this step, after receiving the handshake request, the handshake request may automatically trigger a hook function corresponding to the handshake request, and the hook function searches for an authentication certificate corresponding to the handshake request in preset configuration information.
For example, in practical application, as shown in fig. 2, an epoll in a nginx server receives a handshake request, wakes up a read _ handler function of a quic module, the read _ handler function reads a message of the handshake request, the quic module calls an lsquic _ packet _ in function in an lsquic database, the lsquic _ packet _ in function decapsulates the message through a quic protocol to obtain request information of http, the lsquic database calls a lookup cert function, and the lookup cert function searches for an authentication certificate of the http in preset configuration information of the nginx.
Step S403, generating a handshake response based on the handshake request and the authentication certificate;
in this step, the nginx server may generate a handshake response according to the information in the handshake request and the acquired authentication certificate.
Illustratively, in practical applications, as shown in fig. 2, the quic module calls an lsquic _ process _ conns function, the lsquic _ process _ conns function starts a processing process, and a handshake response is generated based on the request information and the authentication certificate
Step S404, sending the handshake response to the client.
In this step, the nginx server may send the handshake response to the client.
Illustratively, in practical applications, as shown in fig. 2, the lsquic database calls a send packets function, and the send packets function sends a handshake response to the client.
The embodiment of the invention can search the authentication certificate by utilizing the hook function and then return the handshake response when receiving the handshake request, thereby being convenient for finishing handshake with the client.
In yet another embodiment of the present invention, as shown in fig. 6, the method further includes:
step S501, detecting whether a connection establishment request sent by the client is received;
for example, in practical application, as shown in fig. 2, in a new quic connection phase requested by a client, the client sends a new quic connection request of a quic protocol, and the nginx server may receive the connection establishment request.
Step S502, if a connection establishing request sent by the client is received, executing a hook function corresponding to the connection establishing request in the database, and establishing network connection by using the hook function;
in the embodiment of the present invention, the parameters required for network connection are obtained from the Http module.
For example, in practical application, as shown in fig. 2, an epoll receives a new quick connection request, wakes up a read _ handler function of a quick module, the read _ handler function reads a message of the new quick connection request, the quick module calls an lsquick _ packet _ in function in an lsquick database, the lsquick _ packet _ in function performs quick protocol decapsulation on the message to obtain http request information, the quick module calls an lsquick _ process _ conn function in the lsquick database, the lsquick _ process _ conn function starts a processing process, the lsquick database calls a new conn function, and the new connection is established by the new conn function.
Step S503, sending a connection establishment response to the client.
Exemplarily, in practical application, as shown in fig. 2, a quic callback function calls a new conn _ ctx function, the new conn _ ctx function obtains context information in an Http module, an lsquic database calls a send packets function, and the send packets function sends a new quic connection response to a client.
The embodiment of the invention can establish network connection by utilizing the hook function and then return a connection establishment response when receiving the connection establishment request, thereby being convenient for realizing the connection establishment with the client.
In another embodiment of the present invention, as shown in fig. 7, the step S102 further includes:
step S601, if the data acquisition request is received, extracting a destination address of the data acquisition request;
for example, in practical application, as shown in fig. 2, a client sends a data acquisition request of a quic protocol, an epoll receives the data acquisition request, and wakes up a read _ handle function of a quic module.
Step S602, according to the corresponding relation between the preset destination address and the callback function, reading the message content in the data acquisition request by using the callback function corresponding to the data acquisition request;
for example, in practical applications, as shown in fig. 2, the read _ handler function reads a packet of the data acquisition request.
Step S603, call the database corresponding to the first network protocol type, and convert the message content into request data of a second network protocol type.
For example, in practical application, as shown in fig. 2, the quic module calls an lsquic _ packet _ in function in an lsquic database, and the lsquic _ packet _ in function performs quic protocol decapsulation on the packet to obtain http request information.
According to the embodiment of the invention, when a data acquisition request sent by a client is received, a corresponding callback function is automatically determined according to a destination address, the message content is read by using the callback function, then the database corresponding to the first network protocol type is called, the message content is converted into the request data of the second network protocol type, and the reading of the message content and the conversion of the message content in the data acquisition request are realized.
In still another embodiment of the present invention, there is also provided a data processing apparatus, as shown in fig. 8, including:
a receiving module 11, configured to receive a data acquisition request of a first network protocol type sent by a client;
a first conversion module 12, configured to invoke a database corresponding to the first network protocol type, and convert the data acquisition request into request data of a second network protocol type;
an obtaining module 13, configured to obtain, by an upstream server, response data of the second network protocol type according to the request data;
the second conversion module 14 is configured to invoke a database corresponding to the first network protocol type, convert the response data into a data acquisition response of the first network protocol type, and send the data acquisition response to the client.
Optionally, the first conversion module includes:
a first reading unit, configured to read request content in the data acquisition request;
and the execution conversion unit is used for executing a hook function corresponding to the request content in the database when the request content is read, and converting the request content into request data of a second network protocol type by using the hook function.
Optionally, the obtaining module includes:
a sending unit, configured to send, to the upstream server according to the second network protocol type, an acquisition request for acquiring response data corresponding to the request data;
and the receiving unit is used for receiving the response data of the second network protocol type sent by the upstream server.
Optionally, the second conversion module is further configured to:
when the response data is acquired, executing a hook function corresponding to the response data in the database, and converting the response data into a data acquisition response of a first network type by using the hook function.
Optionally, the apparatus further comprises:
the first detection module is used for detecting whether a handshake request sent by the client is received;
the execution searching module is used for executing a hook function corresponding to the handshake request in the database if the handshake request sent by the client is received, and searching an authentication certificate corresponding to the handshake request in preset configuration information by using the hook function;
a generation module to generate a handshake response based on the handshake request and the authentication certificate;
a first sending module, configured to send the handshake response to the client.
Optionally, the apparatus further comprises:
the second detection module is used for detecting whether a connection establishment request sent by the client side is received;
the execution establishing module is used for executing a hook function corresponding to the connection establishing request in the database and establishing network connection by utilizing the hook function if the connection establishing request sent by the client is received;
and the second sending module is used for sending a connection establishing response to the client.
Optionally, the first conversion module is further configured to:
the extracting unit is used for extracting a destination address of the data acquisition request if the data acquisition request is received;
the second reading unit is used for reading the message content in the data acquisition request by using the callback function corresponding to the data acquisition request according to the corresponding relation between the preset destination address and the callback function;
and the calling unit is used for calling a database corresponding to the first network protocol type and converting the message content into request data of a second network protocol type.
In another embodiment of the present invention, an electronic device is further provided, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the data processing method of any one of the first aspect when executing the program stored in the memory.
In the electronic device provided by the embodiment of the present invention, the processor implements, by executing the program stored in the memory, a data acquisition request of a first network protocol type sent by the client, then invokes the database corresponding to the first network protocol type, converts the data acquisition request into request data of a second network protocol type, acquires response data of the second network protocol type from the upstream server according to the request data, and finally invokes the database corresponding to the first network protocol type, converts the response data into a data acquisition response of the first network protocol type, and sends the data acquisition response to the client. According to the embodiment of the invention, the data acquisition request of the first network protocol type of the client is converted into the request data of the second network protocol type, the response data of the second network protocol type corresponding to the request data can be directly acquired from the upstream server, the response data of the second network protocol type is converted into the data acquisition response of the first network protocol type, the client can be ensured to be directly analyzed and used after receiving the response data, and the interaction between the client and the upstream server is realized.
The communication bus 1140 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 1140 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 9, but this does not indicate only one bus or one type of bus.
The communication interface 1120 is used for communication between the electronic device and other devices.
The memory 1130 may include a Random Access Memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The processor 1110 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the integrated circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
In still another embodiment of the present invention, there is also provided a computer-readable storage medium having stored thereon a program of a data processing method, which when executed by a processor, implements the steps of the data processing method described in any of the above embodiments.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of data processing, the method comprising:
receiving a data acquisition request of a first network protocol type sent by a client;
calling a database corresponding to the first network protocol type, and converting the data acquisition request into request data of a second network protocol type;
acquiring response data of a second network protocol type from an upstream server according to the request data;
and calling a database corresponding to the first network protocol type, converting the response data into a data acquisition response of the first network protocol type, and sending the data acquisition response to the client.
2. The data processing method according to claim 1, wherein the invoking a database corresponding to the first network protocol type to convert the data acquisition request into request data of a second network protocol type includes:
reading request content in the data acquisition request;
and when the request content is read, executing a hook function corresponding to the request content in the database, and converting the request content into request data of a second network protocol type by using the hook function.
3. The data processing method according to claim 1, wherein said obtaining response data of the second network protocol type at an upstream server according to the request data comprises:
sending an acquisition request for acquiring response data corresponding to the request data to the upstream server according to the second network protocol type;
response data of the second network protocol type sent by the upstream server is received.
4. The data processing method according to claim 1, wherein the invoking a database corresponding to the first network protocol type to convert the response data into a data acquisition response of the first network protocol type includes:
when the response data is acquired, executing a hook function corresponding to the response data in the database, and converting the response data into a data acquisition response of a first network type by using the hook function.
5. The data processing method of claim 1, wherein the method further comprises:
detecting whether a handshake request sent by the client is received;
if a handshake request sent by the client is received, executing a hook function corresponding to the handshake request in the database, and searching an authentication certificate corresponding to the handshake request in preset configuration information by using the hook function;
generating a handshake response based on the handshake request and the authentication certificate;
sending the handshake response to the client.
6. The data processing method of claim 1, wherein the method further comprises:
detecting whether a connection establishment request sent by the client side is received;
if a connection establishing request sent by the client is received, executing a hook function corresponding to the connection establishing request in the database, and establishing network connection by using the hook function;
and sending a connection establishment response to the client.
7. The data processing method according to claim 1, wherein the invoking a database corresponding to the first network protocol type converts the data acquisition request into request data of a second network protocol type, and further comprising:
if the data acquisition request is received, extracting a destination address of the data acquisition request;
reading the message content in the data acquisition request by using the callback function corresponding to the data acquisition request according to the corresponding relation between the preset destination address and the callback function;
and calling a database corresponding to the first network protocol type, and converting the message content into request data of a second network protocol type.
8. A data processing apparatus, comprising:
the receiving module is used for receiving a data acquisition request of a first network protocol type sent by a client;
the first conversion module is used for calling a database corresponding to the first network protocol type and converting the data acquisition request into request data of a second network protocol type;
the acquisition module is used for acquiring response data of a second network protocol type from an upstream server according to the request data;
and the second conversion module is used for calling the database corresponding to the first network protocol type, converting the response data into a data acquisition response of the first network protocol type and sending the data acquisition response to the client.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the data processing method according to any one of claims 1 to 7 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a program of a data processing method, which when executed by a processor implements the steps of the data processing method of any one of claims 1 to 7.
CN202011110831.6A 2020-10-16 2020-10-16 Data processing method and device, electronic equipment and storage medium Active CN112311774B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011110831.6A CN112311774B (en) 2020-10-16 2020-10-16 Data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011110831.6A CN112311774B (en) 2020-10-16 2020-10-16 Data processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112311774A true CN112311774A (en) 2021-02-02
CN112311774B CN112311774B (en) 2023-05-05

Family

ID=74328008

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011110831.6A Active CN112311774B (en) 2020-10-16 2020-10-16 Data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112311774B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113382062A (en) * 2021-06-08 2021-09-10 北京天空卫士网络安全技术有限公司 Data transmission method, device and system
CN113542301A (en) * 2021-07-30 2021-10-22 深圳追一科技有限公司 Interaction method and device, electronic equipment and storage medium
CN113761041A (en) * 2021-07-23 2021-12-07 北京国电通网络技术有限公司 Data export method, system and device and electronic equipment
CN113992641A (en) * 2021-10-11 2022-01-28 北京达佳互联信息技术有限公司 Data processing method, device, equipment and storage medium
CN114070833A (en) * 2021-11-18 2022-02-18 中国工商银行股份有限公司 Multi-protocol service compatible method, system, device, medium, and program product
CN114448847A (en) * 2022-01-28 2022-05-06 上海哔哩哔哩科技有限公司 Nginx-based request testing method and tool
CN115426416A (en) * 2022-11-03 2022-12-02 北京京东拓先科技有限公司 Protocol conversion method and device, electronic equipment and storage medium
WO2023274146A1 (en) * 2021-07-01 2023-01-05 华为技术有限公司 Remote access method, electronic device, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150127853A1 (en) * 2013-11-01 2015-05-07 Google Inc. Communication across network address translation
CN109150788A (en) * 2017-06-13 2019-01-04 中兴通讯股份有限公司 Control method, apparatus, gateway and the storage medium of network data transmission
CN109525661A (en) * 2018-11-14 2019-03-26 北京奇艺世纪科技有限公司 Data transmission method and device
CN110233880A (en) * 2019-05-23 2019-09-13 北京字节跳动网络技术有限公司 Transmission method, system, medium and the electronic equipment of UDP message packet
CN110677405A (en) * 2019-09-26 2020-01-10 北京金山云网络技术有限公司 Data processing method and device, electronic equipment and storage medium
CN111294399A (en) * 2020-02-04 2020-06-16 网宿科技股份有限公司 Data transmission method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150127853A1 (en) * 2013-11-01 2015-05-07 Google Inc. Communication across network address translation
CN109150788A (en) * 2017-06-13 2019-01-04 中兴通讯股份有限公司 Control method, apparatus, gateway and the storage medium of network data transmission
CN109525661A (en) * 2018-11-14 2019-03-26 北京奇艺世纪科技有限公司 Data transmission method and device
CN110233880A (en) * 2019-05-23 2019-09-13 北京字节跳动网络技术有限公司 Transmission method, system, medium and the electronic equipment of UDP message packet
CN110677405A (en) * 2019-09-26 2020-01-10 北京金山云网络技术有限公司 Data processing method and device, electronic equipment and storage medium
CN111294399A (en) * 2020-02-04 2020-06-16 网宿科技股份有限公司 Data transmission method and device

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113382062A (en) * 2021-06-08 2021-09-10 北京天空卫士网络安全技术有限公司 Data transmission method, device and system
WO2023274146A1 (en) * 2021-07-01 2023-01-05 华为技术有限公司 Remote access method, electronic device, and storage medium
CN113761041A (en) * 2021-07-23 2021-12-07 北京国电通网络技术有限公司 Data export method, system and device and electronic equipment
CN113542301A (en) * 2021-07-30 2021-10-22 深圳追一科技有限公司 Interaction method and device, electronic equipment and storage medium
CN113542301B (en) * 2021-07-30 2023-06-02 深圳追一科技有限公司 Interaction method and device, electronic equipment and storage medium
CN113992641A (en) * 2021-10-11 2022-01-28 北京达佳互联信息技术有限公司 Data processing method, device, equipment and storage medium
CN114070833A (en) * 2021-11-18 2022-02-18 中国工商银行股份有限公司 Multi-protocol service compatible method, system, device, medium, and program product
CN114448847A (en) * 2022-01-28 2022-05-06 上海哔哩哔哩科技有限公司 Nginx-based request testing method and tool
CN115426416A (en) * 2022-11-03 2022-12-02 北京京东拓先科技有限公司 Protocol conversion method and device, electronic equipment and storage medium
CN115426416B (en) * 2022-11-03 2023-04-07 北京京东拓先科技有限公司 Protocol conversion method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112311774B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
CN112311774B (en) Data processing method and device, electronic equipment and storage medium
US11729294B2 (en) Processing DNS queries to identify pre-processing information
US10778554B2 (en) Latency measurement in resource requests
US9912740B2 (en) Latency measurement in resource requests
US9253065B2 (en) Latency measurement in resource requests
US10511567B2 (en) Network resource identification
US9185012B2 (en) Latency measurement in resource requests
US9479476B2 (en) Processing of DNS queries
JP2018536935A (en) Access request conversion method and apparatus
US8984164B2 (en) Methods for reducing latency in network connections and systems thereof
CN107463453B (en) Method, device, equipment and storage medium for communication between different applications of same terminal
CN113259479B (en) Data processing method and equipment
WO2022007406A1 (en) K8s-based service deployment method, apparatus, device, and medium
CN111917900A (en) Request processing method and device for domain name proxy
WO2014094240A1 (en) Internet application interaction method, device and system
CN112104640A (en) Data processing method, device and equipment of gateway and readable storage medium
Jin et al. Improved resource directory based on DNS name self-registration for device transparent access in heterogeneous IoT networks
CN113992748A (en) Reverse proxy method, system, medium, and terminal
CN111953718B (en) Page debugging method and device
AU2018390863B2 (en) Computer system and method for extracting dynamic content from websites
CN116150513A (en) Data processing method, device, electronic equipment and computer readable storage medium
CN114650271B (en) Global load DNS neighbor site learning method and device
Zheng et al. Qos evaluation of web services
CN112688959B (en) Address protection method and device and electronic equipment
JP2005339149A (en) Data processor, data processing method and data processing program

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