Data processing method and device, equipment and storage medium

By converting the three-layer packets processed by the virtual network card into data packets on the server and forwarding them directly to the application layer, the problems of high CPU usage and slow transmission caused by the dependence of the virtual network card are solved, and more efficient data processing and concurrency capabilities are achieved.

CN120455571APending Publication Date: 2025-08-08CETC CYBERSPACE SECURITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510706156.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the prior art, the network proxy technology of mobile operating systems Android and iOS relies on virtual network cards to cause the server to have too high CPU share when processing large amounts of data, slow network transmission, limited concurrent processing capabilities, and complex processing processes.

Method used

By routing traffic to the target virtual network card based on preset routing rules, using network address translation technology to process layer three packets, forwarding them to the network protocol stack, and forwarding data packets to the server through network proxy protocol at the application layer, reducing dependence on virtual network card.

Benefits of technology

It improves the server's data processing efficiency and concurrent processing capabilities, reduces CPU share, and simplifies processing flow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120455571A_ABST
    Figure CN120455571A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device, equipment and a storage medium, and relates to the technical field of network communication, and the method comprises the steps: routing the matched flow of a to-be-accessed target address to a target virtual network card based on a preset routing rule, and reading an original three-layer message corresponding to the matched flow from the target virtual network card; processing the original three-layer message based on a preset network address translation technology to obtain a target three-layer message, and forwarding the target three-layer message to a target network protocol stack; processing the target three-layer message by using a preset network layer and a preset transmission layer to obtain a target data message, and forwarding the target data message to a target application layer; and forwarding the target data message to the target server by using the target application layer based on a preset network proxy protocol, so that the target server processes the target data message to obtain a target processing result, and returns the target processing result to the target virtual network card. According to the invention, the data processing efficiency can be improved, and the concurrent processing capability of the server can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a data processing method, device, equipment and storage medium. Background Art

[0002] Currently, the two most popular mobile operating systems, Android and iOS, only support network proxy technology limited to using virtual network adapters (VNICs) to obtain network traffic. VNICs default to TUN mode, and data read from the VNIC is typically Layer 3 packets. The network proxy client or VPN (Virtual Private Network) client encrypts the Layer 3 packets and sends them to the proxy server. After decrypting the data, the proxy server must re-inject the received Layer 3 packets into the system's network protocol stack through the VNIC. The network protocol stack uses the routing table to determine the physical network adapter for the network packet and ultimately sends the data to the target server. However, because the server relies on the VNIC to forward data, forwarding large amounts of data can lead to excessive CPU usage and slow network proxy data transmission. The server needs to write data to the VNIC, which limits the VNIC's concurrent processing capabilities. When faced with numerous clients transmitting data concurrently, the server can easily reach a maximum I / O bottleneck. Furthermore, the server needs to install and activate a VNIC in TUN mode to write the Layer 3 packets into the system's network protocol stack, which complicates the process.

[0003] To sum up, how to improve the efficiency of data processing and enhance the concurrent processing capabilities of the server is a technical problem that needs to be solved urgently. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a data processing method, apparatus, device and storage medium that can improve the efficiency of data processing and enhance the concurrent processing capability of the server. The specific solution is as follows:

[0005] In a first aspect, the present application provides a data processing method, comprising:

[0006] Routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules, and reading the original three-layer message corresponding to the matching traffic from the target virtual network card;

[0007] Processing the original Layer 3 message based on a preset network address translation technology to obtain a target Layer 3 message, and forwarding the target Layer 3 message to a target network protocol stack;

[0008] After the target network protocol stack receives the target layer-3 message, it processes the target layer-3 message using a preset network layer and a preset transport layer to obtain a target data message, and forwards the target data message to a target application layer;

[0009] The target application layer is used to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain a corresponding target processing result, and returns the target processing result to the target virtual network card.

[0010] Optionally, before routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rule, the method further includes:

[0011] Open the target virtual network card based on the preset system interface, and set the target IP address and target subnet mask corresponding to the target virtual network card;

[0012] Setting a target routing table based on the preset routing rule, the target address to be accessed, the target IP address corresponding to the target virtual network card, and the target subnet mask;

[0013] Accordingly, routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules includes:

[0014] According to the target IP address and the target subnet mask corresponding to the target virtual network card in the target routing table, the matching traffic corresponding to the target address to be accessed is routed to the target virtual network card.

[0015] Optionally, the processing the original layer-3 message based on a preset network address translation technology to obtain a target layer-3 message includes:

[0016] Determine the source IP address corresponding to the original three-layer message, and determine the IP address corresponding to the target address to be accessed based on the source IP address and the target routing table;

[0017] Based on the preset network address translation technology, the source IP address of the original three-layer message is converted into the IP address corresponding to the target address to be accessed to obtain the target three-layer message, and the mapping relationship between the source IP address of the original three-layer message and the IP address corresponding to the target address to be accessed is recorded in the preset address translation table.

[0018] Optionally, the processing the target layer-3 message by using a preset network layer and a preset transport layer to obtain a target data message, and forwarding the target data message to a target application layer includes:

[0019] Extracting a target transport layer message corresponding to the target layer 3 message using the preset network layer; if the target transport layer protocol corresponding to the target transport layer message is a preset transmission control protocol, parsing the target transport layer message using the preset transport layer to obtain a source port, a destination port, a sequence number, an acknowledgment number, a flag bit, and the target data message corresponding to the target transport layer message;

[0020] Determine a target notification event corresponding to the target transport layer message, and determine a target structure corresponding to the target data message based on a preset data structure, the source port, the target port, the sequence number, the acknowledgment number, and the flag bit, so as to determine a connection state of a TCP connection corresponding to the target data message based on the target structure;

[0021] Generate a target interface between the target network protocol stack and the target application layer, and forward the target data message and the target notification event to the target application layer based on the target interface, so as to utilize the target application layer to forward the target data message to the target server based on the target notification event and the preset network proxy protocol.

[0022] Optionally, the forwarding the target data message to the target server by using the target application layer based on the target notification event and the preset network proxy protocol includes:

[0023] If the target notification event is a preset new connection event, using the target application layer to determine the IP address and port of the preset proxy server based on the target notification event, and establishing a TCP connection between the target application layer and the preset proxy server based on the IP address and port of the preset proxy server, and establishing a target secure channel between the target application layer and the preset proxy server based on the TCP connection;

[0024] If the target notification event is a preset data arrival event, the target application layer is used to forward the target data message to the preset proxy server based on the target secure channel and the preset network proxy protocol, and the preset proxy server is used to forward the target data message to the target server.

[0025] Optionally, the using a preset network layer and a preset transport layer to process the target layer-3 message to obtain a target data message, and forwarding the target data message to a target application layer includes:

[0026] Extracting a target transport layer message corresponding to the target layer-3 message using the preset network layer; if the target transport layer protocol corresponding to the target transport layer message is a preset user datagram protocol, parsing the target transport layer message using the preset transport layer to obtain a target port and the target data message corresponding to the target transport layer message, and forwarding the target transport layer message to the target application layer;

[0027] Accordingly, the forwarding of the target data message to the target server by using the target application layer based on a preset network proxy protocol includes:

[0028] The target application layer forwards the target data message corresponding to the target transport layer message to a preset proxy server based on the preset network proxy protocol and the target port corresponding to the target transport layer message, and the preset proxy server forwards the target data message to the target server.

[0029] Optionally, returning the target processing result to the target virtual network card includes:

[0030] forwarding the target processing result to the target application layer using the target server and based on the target secure channel between the target application layer and the preset proxy server;

[0031] Using the target application layer to transmit the target processing result back to the target network protocol stack based on the target interface;

[0032] Determining the target structure corresponding to the target processing result through the target network protocol stack, and determining the transport layer message corresponding to the target processing result based on the target structure, and determining the three-layer message corresponding to the transport layer message;

[0033] The layer-3 message is uploaded to the target virtual network card based on the preset network address translation technology.

[0034] In a second aspect, the present application provides a data processing device, comprising:

[0035] The original three-layer message reading module is used to route the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules, and read the original three-layer message corresponding to the matching traffic from the target virtual network card;

[0036] a target layer 3 message forwarding module, configured to process the original layer 3 message based on a preset network address translation technology to obtain a target layer 3 message, and forward the target layer 3 message to a target network protocol stack;

[0037] a target data message forwarding module, configured to, after the target three-layer message is received by the target network protocol stack, process the target three-layer message using a preset network layer and a preset transport layer to obtain a target data message, and forward the target data message to a target application layer;

[0038] The target processing result returning module is used to use the target application layer to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain the corresponding target processing result, and returns the target processing result to the target virtual network card.

[0039] In a third aspect, the present application provides an electronic device, comprising:

[0040] Memory, used to store computer programs;

[0041] The processor is used to execute the computer program to implement the aforementioned data processing method.

[0042] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned data processing method is implemented.

[0043] In the present application, first, based on the preset routing rules, the matching traffic corresponding to the target address to be accessed is routed to the target virtual network card, and the original three-layer message corresponding to the matching traffic is read from the target virtual network card; then, based on the preset network address translation technology, the original three-layer message is processed to obtain the target three-layer message, and the target three-layer message is forwarded to the target network protocol stack; then, after the target network protocol stack receives the target three-layer message, the preset network layer and the preset transport layer are used to process the target three-layer message to obtain the target data message, and the target data message is forwarded to the target application layer; finally, the target application layer is used to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain the corresponding target processing result, and returns the target processing result to the target virtual network card. As can be seen from the above, in this application, the original three-layer message is first read from the target virtual network card, and then the target three-layer message is obtained through the preset network address translation technology, and the target three-layer message is forwarded to the target network protocol stack, and the target three-layer message is processed by the preset network layer and the preset transport layer of the target network protocol stack to obtain the target data message, and then the target data message is forwarded to the target application layer, and finally the target application layer is used to forward the target data message to the target server based on the preset network proxy protocol. In this way, in this application, the three-layer message data read from the target virtual network card is processed by the target network protocol stack to obtain the target data message, and the target data message is forwarded to the target application layer, thereby forwarding the target data message to the target server based on the preset network proxy protocol. Since the server no longer needs to process the three-layer message, it no longer depends on the virtual network card and can directly forward the target data message to the target server. In this way, the server can concurrently process more client data forwarding requests, and the server's CPU occupancy rate is greatly reduced when processing client requests for the same data, thereby improving the efficiency of data processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0045] Figure 1 A system architecture diagram of a data processing solution provided for this application;

[0046] Figure 2 A flow chart of a data processing method provided in this application;

[0047] Figure 3A flow chart of a specific data processing method provided for this application;

[0048] Figure 4 A schematic diagram of the structure of a data processing device provided in this application;

[0049] Figure 5 This is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION

[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0051] The two popular mobile operating systems, Android and iOS, currently support network proxy technology limited to using virtual network adapters (VNICs) to obtain network traffic. By default, VNICs use TUN mode. Data read from the VNIC is typically Layer 3 packets. The network proxy client or VPN client encrypts the Layer 3 packets and sends them to the proxy server. After decrypting the data, the proxy server must re-inject the received Layer 3 packets into the system's network protocol stack through the VNIC. The network protocol stack uses the routing table to determine the physical network adapter for the network packet and ultimately sends the data to the target server. However, because the server relies on the VNIC to forward data, forwarding large amounts of data can lead to excessive CPU usage and slow network proxy data transmission. The server needs to write data to the VNIC, which limits the VNIC's concurrent processing capabilities. When faced with numerous clients transmitting data concurrently, the server can easily reach a maximum I / O processing bottleneck. Furthermore, the server needs to install and activate a VNIC in TUN mode to write the Layer 3 packets into the system's network protocol stack, which complicates the process. To this end, this application provides a data processing solution that can improve the efficiency of data processing and enhance the concurrent processing capabilities of the server.

[0052] The system framework used in the data processing solution of this application can be found in Figure 1 As shown, specifically, this application includes: a network device, a TUN read / write module, a TCP / IP protocol stack, and an application layer. The network device includes a TUN virtual network card, the TUN read / write module includes a TUN read module and a TUN write module, and the application layer includes a TCP data stream processor, a UDP data stream processor, and a DNS (Domain Name System) resolution.

[0053] See also Figure 2 As shown, an embodiment of the present invention discloses a data processing method, which may include:

[0054] Step S11: Routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rule, and reading the original three-layer message corresponding to the matching traffic from the target virtual network card.

[0055] In this embodiment, before routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules, the above-mentioned method may further include: first, opening the target virtual network card based on the preset system interface, and setting the target IP address and target subnet mask corresponding to the target virtual network card; then setting the target routing table based on the preset routing rules, the target address to be accessed, the target IP address and target subnet mask corresponding to the target virtual network card; accordingly, routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules may include: routing the matching traffic corresponding to the target address to be accessed to the target virtual network card according to the target IP address and target subnet mask corresponding to the target virtual network card in the target routing table. Specifically, Android, iOS, and Linux desktop systems currently all have built-in TUN virtual network cards. In this embodiment, the target virtual network card is first opened through the system interface, and the target IP address and target subnet mask of the target virtual network card are pre-set. In this way, by setting an identity identifier for the target virtual network card, the target virtual network card can communicate with other network devices. A routing rule is then added to the target routing table, directing the routing information for the target address to the target virtual network card. When a local application accesses network data from the target address, the system automatically sends the matching traffic for the target address to the virtual network card. This allows the TUN read / write module to read data from the target virtual network card and obtain the original Layer 3 packets corresponding to the matching traffic. It is understood that these original Layer 3 packets are primarily network layer IP packets.

[0056] Step S12: Process the original Layer 3 message based on a preset network address translation technology to obtain a target Layer 3 message, and forward the target Layer 3 message to a target network protocol stack.

[0057] In this embodiment, the above-mentioned processing of the original three-layer message based on the preset network address translation technology to obtain the target three-layer message may include: first determining the source IP address corresponding to the original three-layer message, and determining the IP address corresponding to the target address to be accessed based on the source IP address and the target routing table; then converting the source IP address of the original three-layer message to the IP address corresponding to the target address to be accessed based on the preset network address translation technology to obtain the target three-layer message, and recording the mapping relationship between the source IP address of the original three-layer message and the IP address corresponding to the target address to be accessed into the preset address translation table. It can be understood that the source IP address of the original three-layer message read from the target virtual network card is the address of the target virtual network card. NAT (Network Address Translation) parses the read original three-layer message and extracts key information such as the source IP address. The original Layer 3 packet's source IP address is replaced, and the target virtual network card's address is translated into the IP address corresponding to the target address to be accessed, resulting in the target Layer 3 packet. The mapping between the original Layer 3 packet's source IP address and the target address's IP address is recorded in the NAT table for subsequent address translation. Finally, the target Layer 3 packet obtained through NAT address translation is forwarded to the upper-layer network protocol stack for further data processing.

[0058] Step S13: After the target network protocol stack receives the target layer-3 message, it processes the target layer-3 message using a preset network layer and a preset transport layer to obtain a target data message, and forwards the target data message to a target application layer.

[0059] It should be noted that the network protocol stack is responsible for processing the target three-layer message received from the TUN read-write module. In a specific embodiment, the above-mentioned use of the preset network layer and the preset transport layer to process the target three-layer message to obtain the target data message, and forwarding the target data message to the target application layer, can include: first using the preset network layer to extract the target transport layer message corresponding to the target three-layer message, if the target transport layer protocol corresponding to the target transport layer message is the preset transmission control protocol, then using the preset transport layer to parse the target transport layer message to obtain the source port, target port, sequence number, confirmation number, flag bit and the target data message corresponding to the target transport layer message; then determining the target notification corresponding to the target transport layer message Event, and based on the preset data structure, the source port, the target port, the sequence number, the confirmation number and the flag bit, determine the target structure corresponding to the target data message, so as to determine the connection status of the TCP connection corresponding to the target data message based on the target structure; finally, generate a target interface between the target network protocol stack and the target application layer, and forward the target data message and the target notification event to the target application layer based on the target interface, so as to utilize the target application layer to forward the target data message to the target server based on the target notification event and the preset network proxy protocol. Specifically, first parse the IP header corresponding to the target three-layer message, and check the legitimacy of the IP header to confirm that the target three-layer message has not been tampered with during transmission. Then, the transport layer protocol corresponding to the target transport layer message is confirmed. If the target transport layer message is a TCP (Transmission Control Protocol) message, the TCP header of the target transport layer message is extracted to obtain the source port, destination port, sequence number, acknowledgment number, flag bit and target data message corresponding to the target transport layer message. Based on the source port, destination port, sequence number, acknowledgment number, flag bit and target data message, the target structure of the TCP connection corresponding to the target data message, namely the Socks structure, is confirmed. While the TCP connection is ongoing, the Socks structure is continuously updated to track every change in the TCP connection. The network protocol stack provides the application layer with interfaces such as the TCP new connection interface, the TCP data readable interface, the TCP data writable interface and the TCP closing interface, and uses each interface to forward the target data message and the corresponding target notification event to the target application layer, so that the target application layer can encapsulate and forward the extracted target data message.

[0060] Step S14: Utilize the target application layer to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain a corresponding target processing result, and returns the target processing result to the target virtual network card.

[0061] In a specific embodiment, the target application layer receives the target data message and target notification event sent by the target network protocol stack, and uses a TCP data stream processor to process the target data message and the target notification event. The above-mentioned use of the target application layer to forward the target data message to the target server based on the target notification event and the preset network proxy protocol may include: if the target notification event is a preset new connection event, then using the target application layer to determine the IP address and port of the preset proxy server based on the target notification event, and establishing a TCP connection between the target application layer and the preset proxy server based on the IP address and port of the preset proxy server, and establishing a target security channel between the target application layer and the preset proxy server based on the TCP connection; if the target notification event is a preset data arrival event, then using the target application layer to forward the target data message to the preset proxy server based on the target security channel and the preset network proxy protocol, and using the preset proxy server to forward the target data message to the target server. Specifically, the TCP data stream processor is responsible for processing TCP new connection events, data arrival events, TCP packet return events, TCP connection closing events, etc. After receiving a new connection notification, the TCP data stream processor determines the target address and port of the TCP connection based on the corresponding new connection notification, namely the target address and port of the proxy server, and then establishes a TCP connection with the proxy server. Specifically, the target application layer sends a SYN (synchronize) packet to the pre-set proxy server. Upon receiving the SYN packet, the pre-set proxy server returns a SYN-ACK (synchronize acknowledgement) packet if it agrees to establish the connection. Upon receiving the SYN-ACK packet, the target application layer verifies the response's validity and then sends an ACK (acknowledgement) packet to the pre-set proxy server, completing the three-way handshake. The connection status is then updated to established. A secure channel is then established between the target application layer and the pre-set proxy server. Upon receiving a data arrival event, the TCP data stream processor retrieves the target data packet using the TCP data readable interface, encapsulates the target data packet into the proxy protocol format using the SOCKS (Socket Secure) proxy protocol, and sends it over a secure channel to the pre-set proxy server. The pre-set proxy server then forwards the data to the target server for processing.

[0062] It can be understood that the above-mentioned returning the target processing result to the target virtual network card may include: first, using the target server and based on the target secure channel between the target application layer and the preset proxy server, forwarding the target processing result to the target application layer; then using the target application layer based on the target interface to return the target processing result to the target network protocol stack; then determining the target structure corresponding to the target processing result through the target network protocol stack, and determining the transport layer message corresponding to the target processing result based on the target structure, and determining the three-layer message corresponding to the transport layer message; finally, uploading the three-layer message to the target virtual network card based on the preset network address translation technology. Specifically, the target server forwards the target processing result to the preset proxy server, and then the preset proxy server sends the target processing result to the target application layer based on the target secure channel between the preset proxy server and the target application layer. The target application layer sends the target processing result to the target network protocol stack based on the data writable interface. The target network protocol stack adds a TCP header and an IP header to the target processing result based on the Socks structure context associated with the target processing result to form a three-layer message, and then transfers the three-layer message to the lower-layer TUN read-write module. After network address conversion, the TUN write module writes the three-layer message to the target virtual network card, completing the application's sending and receiving process.

[0063] As can be seen from the above, in this embodiment, the matching traffic corresponding to the target address to be accessed is first routed to the target virtual network card based on the preset routing rules, and the original three-layer message corresponding to the matching traffic is read from the target virtual network card; then, the original three-layer message is processed based on the preset network address translation technology to obtain the target three-layer message, and the target three-layer message is forwarded to the target network protocol stack; then, after the target network protocol stack receives the target three-layer message, the preset network layer and the preset transport layer are used to process the target three-layer message to obtain the target data message, and the target data message is forwarded to the target application layer; finally, the target application layer is used to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain the corresponding target processing result, and returns the target processing result to the target virtual network card. As can be seen from the above, in this embodiment, the original three-layer message is first read from the target virtual network card, and then the target three-layer message is obtained through the preset network address translation technology, and the target three-layer message is forwarded to the target network protocol stack, and the target three-layer message is processed by the preset network layer and the preset transport layer of the target network protocol stack to obtain the target data message, and then the target data message is forwarded to the target application layer, and finally the target application layer is used to forward the target data message to the target server based on the preset network proxy protocol. In this way, in this embodiment, the three-layer message data read from the target virtual network card is processed by the target network protocol stack to obtain the target data message, and the target data message is forwarded to the target application layer, thereby forwarding the target data message to the target server based on the preset network proxy protocol. Since the server no longer needs to process the three-layer message, it no longer relies on the virtual network card and can directly forward the target data message to the target server. In this way, the server can concurrently process more client data forwarding requests, and the server's CPU occupancy is greatly reduced when processing client requests for the same data, thereby improving the efficiency of data processing.

[0064] See also Figure 3 As shown, in order to improve the efficiency of data processing, the embodiment of the present invention further discloses a data processing method, which may include:

[0065] Step S21: Routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rule, and reading the original three-layer message corresponding to the matching traffic from the target virtual network card.

[0066] Step S22: Process the original layer-3 message based on a preset network address translation technology to obtain a target layer-3 message, and forward the target layer-3 message to a target network protocol stack.

[0067] Step S23: After the target network protocol stack receives the target layer-3 message, it processes the target layer-3 message using a preset network layer and a preset transport layer to obtain a target data message, and forwards the target data message to a target application layer.

[0068] In one specific embodiment, processing the target Layer 3 message using a preset network layer and a preset transport layer to obtain a target data message and forwarding the target data message to a target application layer may include: extracting a target transport layer message corresponding to the target Layer 3 message using the preset network layer; if the target transport layer protocol corresponding to the target transport layer message is a preset User Datagram Protocol (UDP); parsing the target transport layer message using the preset transport layer to obtain a target port corresponding to the target transport layer message and the target data message; and forwarding the target transport layer message to the target application layer. Specifically, the IP header corresponding to the target Layer 3 message is first parsed and the validity of the IP header is checked to confirm that the target Layer 3 message has not been tampered with during transmission. The transport layer protocol corresponding to the target transport layer message is then confirmed; if the target transport layer message is a UDP (User Data Protocol) message, the target port and target data message corresponding to the target transport layer message are determined; and the target transport layer message is directly sent to the target application layer for processing by the target application layer.

[0069] Step S24: Utilize the target application layer to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain a corresponding target processing result, and returns the target processing result to the target virtual network card.

[0070] In a specific embodiment, after the target application layer receives the UDP message sent by the target network protocol stack, the above-mentioned forwarding of the target data message to the target server based on the preset network proxy protocol by the target application layer may include: utilizing the target application layer to forward the target data message corresponding to the target transport layer message to the preset proxy server based on the preset network proxy protocol and the target port corresponding to the target transport layer message, and utilizing the preset proxy server to forward the target data message to the target server. Specifically, the UDP data stream processor of the target application layer determines the target port corresponding to the target transport layer message, and encapsulates the target data message corresponding to the target transport layer message into the proxy protocol format through the socks proxy protocol and forwards it to the preset proxy server. Thereafter, the proxy server forwards the target data message to the target server based on the target port corresponding to the target transport layer message.

[0071] It should be noted that the TCP data stream processor in the target application layer is responsible for processing TCP new connection events, data arrival events, TCP packet return events, and TCP connection closing events. The UDP data stream processor is responsible for forwarding UDP packets. In addition, for products requiring domain name filtering and forwarding, the DNS resolution module in the target application layer can provide additional filtering.

[0072] For more specific processing procedures of the above steps S21 and S22, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0073] As can be seen from the above, in this embodiment, the target transport layer message corresponding to the target three-layer message is first extracted; when the target transport layer message is a UDP message, the target transport layer message is parsed to obtain the target port and target data message corresponding to the target transport layer message, and the target transport layer message is forwarded to the target application layer; then, the target application layer forwards the target data message to the preset proxy server based on the preset network proxy protocol and the target port corresponding to the target transport layer message, and uses the preset proxy server to forward the target data message to the target server, so that the target server processes the target data message to obtain the corresponding target processing result. In this way, the server can concurrently process more client data forwarding requests, and the server's CPU occupancy rate is greatly reduced when processing client requests for the same data, thereby improving the efficiency of data processing.

[0074] Accordingly, see Figure 4 As shown, the embodiment of the present application further provides a data processing device, which may include:

[0075] The original three-layer message reading module 11 is used to route the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules, and read the original three-layer message corresponding to the matching traffic from the target virtual network card;

[0076] a target layer 3 message forwarding module 12, configured to process the original layer 3 message based on a preset network address translation technology to obtain a target layer 3 message, and forward the target layer 3 message to a target network protocol stack;

[0077] a target data message forwarding module 13, configured to, after receiving the target layer-3 message at the target network protocol stack, process the target layer-3 message using a preset network layer and a preset transport layer to obtain a target data message, and forward the target data message to a target application layer;

[0078] The target processing result returning module 14 is used to use the target application layer to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain the corresponding target processing result, and returns the target processing result to the target virtual network card.

[0079] As can be seen from the above, in this application, the matching traffic corresponding to the target address to be accessed is first routed to the target virtual network card based on the preset routing rules, and the original three-layer message corresponding to the matching traffic is read from the target virtual network card; then, the original three-layer message is processed based on the preset network address translation technology to obtain the target three-layer message, and the target three-layer message is forwarded to the target network protocol stack; then, after the target network protocol stack receives the target three-layer message, the preset network layer and the preset transport layer are used to process the target three-layer message to obtain the target data message, and the target data message is forwarded to the target application layer; finally, the target application layer is used to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain the corresponding target processing result, and returns the target processing result to the target virtual network card. As can be seen from the above, in this application, the original three-layer message is first read from the target virtual network card, and then the target three-layer message is obtained through the preset network address translation technology, and the target three-layer message is forwarded to the target network protocol stack, and the target three-layer message is processed by the preset network layer and the preset transport layer of the target network protocol stack to obtain the target data message, and then the target data message is forwarded to the target application layer, and finally the target application layer is used to forward the target data message to the target server based on the preset network proxy protocol. In this way, in this application, the three-layer message data read from the target virtual network card is processed by the target network protocol stack to obtain the target data message, and the target data message is forwarded to the target application layer, thereby forwarding the target data message to the target server based on the preset network proxy protocol. Since the server no longer needs to process the three-layer message, it no longer depends on the virtual network card and can directly forward the target data message to the target server. In this way, the server can concurrently process more client data forwarding requests, and the server's CPU occupancy rate is greatly reduced when processing client requests for the same data, thereby improving the efficiency of data processing.

[0080] In some specific implementations, the data processing device may further include:

[0081] A target IP address determination module is used to open the target virtual network card based on a preset system interface and set the target IP address and target subnet mask corresponding to the target virtual network card;

[0082] A target routing table determination module is used to set a target routing table based on the preset routing rule, the target address to be accessed, the target IP address corresponding to the target virtual network card, and the target subnet mask;

[0083] Accordingly, the original layer-3 message reading module 11 may include:

[0084] A matching traffic routing unit is used to route the matching traffic corresponding to the target address to be accessed to the target virtual network card according to the target IP address and the target subnet mask corresponding to the target virtual network card in the target routing table.

[0085] In some specific implementations, the target layer-3 message forwarding module 12 may include:

[0086] a source IP address determining unit, configured to determine a source IP address corresponding to the original layer-3 message, and determine an IP address corresponding to the target address to be accessed based on the source IP address and the target routing table;

[0087] A source IP address conversion unit is used to convert the source IP address of the original three-layer message into the IP address corresponding to the target address to be accessed based on the preset network address conversion technology to obtain the target three-layer message, and record the mapping relationship between the source IP address of the original three-layer message and the IP address corresponding to the target address to be accessed in a preset address conversion table.

[0088] In some specific implementations, the target data packet forwarding module 13 may include:

[0089] a target data message determination submodule, configured to extract a target transport layer message corresponding to the target layer 3 message by using the preset network layer; if the target transport layer protocol corresponding to the target transport layer message is a preset transmission control protocol, then parse the target transport layer message by using the preset transport layer to obtain a source port, a target port, a sequence number, an acknowledgment number, a flag bit, and the target data message corresponding to the target transport layer message;

[0090] a target structure determination submodule, configured to determine a target notification event corresponding to the target transport layer message, and determine a target structure corresponding to the target data message based on a preset data structure, the source port, the target port, the sequence number, the confirmation number, and the flag bit, so as to determine a connection state of a TCP connection corresponding to the target data message based on the target structure;

[0091] The target data message forwarding submodule is used to generate a target interface between the target network protocol stack and the target application layer, and forward the target data message and the target notification event to the target application layer based on the target interface, so as to utilize the target application layer to forward the target data message to the target server based on the target notification event and the preset network proxy protocol.

[0092] In some specific implementations, the target data packet forwarding submodule may include:

[0093] A TCP connection establishing unit, configured to, if the target notification event is a preset new connection event, determine, using the target application layer, an IP address and port of a preset proxy server based on the target notification event, establish a TCP connection between the target application layer and the preset proxy server based on the IP address and port of the preset proxy server, and establish a target secure channel between the target application layer and the preset proxy server based on the TCP connection;

[0094] A first target data message forwarding unit is used to forward the target data message to the preset proxy server using the target application layer based on the target security channel and the preset network proxy protocol if the target notification event is a preset data arrival event, and to forward the target data message to the target server using the preset proxy server.

[0095] In some specific implementations, the target data packet forwarding module 13 may include:

[0096] a target transport layer message forwarding unit, configured to extract a target transport layer message corresponding to the target layer-3 message by using the preset network layer; if the target transport layer protocol corresponding to the target transport layer message is a preset user datagram protocol, parse the target transport layer message by using the preset transport layer to obtain a target port and the target data message corresponding to the target transport layer message, and forward the target transport layer message to the target application layer;

[0097] Accordingly, the target processing result returning module 14 may include:

[0098] The second target data message forwarding unit is used to use the target application layer based on the preset network proxy protocol and the target port corresponding to the target transport layer message to forward the target data message corresponding to the target transport layer message to the preset proxy server, and use the preset proxy server to forward the target data message to the target server.

[0099] In some specific implementations, the target processing result returning module 14 may include:

[0100] a target processing result forwarding unit, configured to forward the target processing result to the target application layer by using the target server and based on a target secure channel between the target application layer and the preset proxy server;

[0101] A target processing result returning unit, configured to use the target application layer to return the target processing result to the target network protocol stack based on the target interface;

[0102] A layer-3 message determining unit, configured to determine the target structure corresponding to the target processing result through the target network protocol stack, and determine a transport layer message corresponding to the target processing result based on the target structure, and determine a layer-3 message corresponding to the transport layer message;

[0103] The layer 3 message uploading unit is configured to upload the layer 3 message to the target virtual network card based on the preset network address translation technology.

[0104] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation on the scope of use of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the data processing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0105] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0106] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0107] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs that can be used to implement the data processing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs that can be used to perform other specific tasks.

[0108] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned data processing method is implemented. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.

[0109] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0110] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0111] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0112] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0113] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data processing method, characterized in that: include: Routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules, and reading the original three-layer message corresponding to the matching traffic from the target virtual network card; Processing the original Layer 3 message based on a preset network address translation technology to obtain a target Layer 3 message, and forwarding the target Layer 3 message to a target network protocol stack; After the target network protocol stack receives the target layer-3 message, it processes the target layer-3 message using a preset network layer and a preset transport layer to obtain a target data message, and forwards the target data message to a target application layer; The target application layer is used to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain a corresponding target processing result, and returns the target processing result to the target virtual network card.

2. The data processing method according to claim 1, wherein: Before routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rule, the method further includes: Open the target virtual network card based on the preset system interface, and set the target IP address and target subnet mask corresponding to the target virtual network card; Setting a target routing table based on the preset routing rule, the target address to be accessed, the target IP address corresponding to the target virtual network card, and the target subnet mask; Accordingly, routing the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules includes: According to the target IP address and the target subnet mask corresponding to the target virtual network card in the target routing table, the matching traffic corresponding to the target address to be accessed is routed to the target virtual network card.

3. The data processing method according to claim 2, characterized in that: The processing of the original layer-3 message based on the preset network address translation technology to obtain the target layer-3 message includes: Determine the source IP address corresponding to the original three-layer message, and determine the IP address corresponding to the target address to be accessed based on the source IP address and the target routing table; Based on the preset network address translation technology, the source IP address of the original three-layer message is converted into the IP address corresponding to the target address to be accessed to obtain the target three-layer message, and the mapping relationship between the source IP address of the original three-layer message and the IP address corresponding to the target address to be accessed is recorded in the preset address translation table.

4. The data processing method according to claim 1, wherein: The method of processing the target layer-3 message by using a preset network layer and a preset transport layer to obtain a target data message, and forwarding the target data message to a target application layer, includes: Extracting a target transport layer message corresponding to the target layer 3 message using the preset network layer; if the target transport layer protocol corresponding to the target transport layer message is a preset transmission control protocol, parsing the target transport layer message using the preset transport layer to obtain a source port, a destination port, a sequence number, an acknowledgment number, a flag bit, and the target data message corresponding to the target transport layer message; Determine a target notification event corresponding to the target transport layer message, and determine a target structure corresponding to the target data message based on a preset data structure, the source port, the target port, the sequence number, the acknowledgment number, and the flag bit, so as to determine a connection state of a TCP connection corresponding to the target data message based on the target structure; Generate a target interface between the target network protocol stack and the target application layer, and forward the target data message and the target notification event to the target application layer based on the target interface, so as to utilize the target application layer to forward the target data message to the target server based on the target notification event and the preset network proxy protocol.

5. The data processing method according to claim 4, characterized in that: The forwarding of the target data message to the target server by using the target application layer based on the target notification event and the preset network proxy protocol includes: If the target notification event is a preset new connection event, using the target application layer to determine the IP address and port of the preset proxy server based on the target notification event, and establishing a TCP connection between the target application layer and the preset proxy server based on the IP address and port of the preset proxy server, and establishing a target secure channel between the target application layer and the preset proxy server based on the TCP connection; If the target notification event is a preset data arrival event, the target application layer is used to forward the target data message to the preset proxy server based on the target secure channel and the preset network proxy protocol, and the preset proxy server is used to forward the target data message to the target server.

6. The data processing method according to claim 1, wherein: The method of processing the target layer-3 message by using a preset network layer and a preset transport layer to obtain a target data message, and forwarding the target data message to a target application layer, includes: Extracting a target transport layer message corresponding to the target layer-3 message using the preset network layer; if the target transport layer protocol corresponding to the target transport layer message is a preset user datagram protocol, parsing the target transport layer message using the preset transport layer to obtain a target port and the target data message corresponding to the target transport layer message, and forwarding the target transport layer message to the target application layer; Accordingly, the forwarding of the target data message to the target server by using the target application layer based on a preset network proxy protocol includes: The target application layer forwards the target data message corresponding to the target transport layer message to a preset proxy server based on the preset network proxy protocol and the target port corresponding to the target transport layer message, and the preset proxy server forwards the target data message to the target server.

7. The data processing method according to claim 4 or 5, characterized in that: The returning the target processing result to the target virtual network card includes: forwarding the target processing result to the target application layer using the target server and based on the target secure channel between the target application layer and the preset proxy server; Using the target application layer to transmit the target processing result back to the target network protocol stack based on the target interface; Determining the target structure corresponding to the target processing result through the target network protocol stack, and determining the transport layer message corresponding to the target processing result based on the target structure, and determining the three-layer message corresponding to the transport layer message; The three-layer message is uploaded to the target virtual network card based on the preset network address translation technology.

8. A data processing device, characterized in that: include: The original three-layer message reading module is used to route the matching traffic corresponding to the target address to be accessed to the target virtual network card based on the preset routing rules, and read the original three-layer message corresponding to the matching traffic from the target virtual network card; a target layer 3 message forwarding module, configured to process the original layer 3 message based on a preset network address translation technology to obtain a target layer 3 message, and forward the target layer 3 message to a target network protocol stack; a target data message forwarding module, configured to, after the target three-layer message is received by the target network protocol stack, process the target three-layer message using a preset network layer and a preset transport layer to obtain a target data message, and forward the target data message to a target application layer; The target processing result returning module is used to use the target application layer to forward the target data message to the target server based on the preset network proxy protocol, so that the target server processes the target data message to obtain the corresponding target processing result, and returns the target processing result to the target virtual network card.

9. An electronic device, characterized in that: The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the data processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that Used to store a computer program, which, when executed by a processor, implements the data processing method according to any one of claims 1 to 7.