WO2022100425A1 - 数据处理方法、装置、相关设备及存储介质 - Google Patents
数据处理方法、装置、相关设备及存储介质 Download PDFInfo
- Publication number
- WO2022100425A1 WO2022100425A1 PCT/CN2021/126230 CN2021126230W WO2022100425A1 WO 2022100425 A1 WO2022100425 A1 WO 2022100425A1 CN 2021126230 W CN2021126230 W CN 2021126230W WO 2022100425 A1 WO2022100425 A1 WO 2022100425A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- client
- gateway
- connection
- address
- access address
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/2514—Translation of Internet protocol [IP] addresses between local and global IP addresses
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/256—NAT traversal
- H04L61/2575—NAT traversal using address mapping retrieval, e.g. simple traversal of user datagram protocol through session traversal utilities for NAT [STUN]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/12—Setup of transport tunnels
Definitions
- the present application relates to the field of computer technology, in particular to data processing.
- Peer-to-Peer refers to the realization of transmission between two clients in different private networks. Since the clients belong to different private networks, the two are in different The transmission between clients of the private network can only be performed by relying on the public network, that is, when clients in different private networks need to transmit data, the public network needs to forward the data.
- hole punching technology can also be used to connect clients in different private networks directly. However, the current hole punching technology has a low success rate for connecting two clients in different private networks. The success rate of communication connection between clients of different private networks has become a current research hotspot.
- Embodiments of the present application provide a data processing method, apparatus, related equipment, and storage medium, which can improve the success rate of establishing a communication connection between clients in a private network.
- an embodiment of the present application provides a data processing method, including:
- connection test packet sent by the first client, where the connection test packet carries the access address of the second client; the first client belongs to the first private network, the second client belongs to the second private network, and the The first private network is provided with a first gateway, and the second private network is provided with a second gateway;
- connection data packet is sent to the second client through the second gateway, so that the first client and the second client are connected according to the connection Packets establish a communication connection.
- an embodiment of the present application provides a data processing method, including:
- connection test packet carries the access address of the second client, so that the first gateway stores the access address of the second client according to the connection test packet;
- the first client belongs to a first private network
- the second client belongs to a second private network
- the first private network is provided with the first gateway
- the second private network is provided with a second gateway;
- an embodiment of the present application provides a data processing apparatus, including:
- a receiving unit configured to receive a connection test packet sent by the first client, where the connection test packet carries the access address of the second client; the first client belongs to the first private network, and the second client belongs to the second client Two private networks, the first private network is provided with a first gateway, and the second private network is provided with a second gateway;
- a determining unit configured to determine the access address of the second client carried in the connection test package
- a storage unit for storing the access address of the second client
- the receiving unit is further configured to receive a connection data packet sent by the first client to the second client;
- the determining unit is further configured to check whether a first address storage notification message sent by the second gateway has been received, wherein the first address storage notification message indicates that the second gateway has stored the first client sent after the access address of the terminal;
- a sending unit configured to send the received connection data packet to the second client through the second gateway when the determining unit determines that the first address storage notification message has been received, so that the The first client and the second client establish a communication connection according to the connection data packet.
- an embodiment of the present application provides a data processing apparatus, including:
- a sending unit configured to send a connection test packet to the first gateway, where the connection test packet carries the access address of the second client, so that the first gateway stores the access address of the second client according to the connection test packet;
- the first client belongs to a first private network
- the second client belongs to a second private network
- the first private network is provided with the first gateway
- the second private network is provided with a second gateway;
- a determining unit configured to check whether an address storage notification message sent by the second gateway has been received, wherein the address storage notification message is sent by the second gateway after storing the access address of the first client ;
- the sending unit is further configured to determine, in the determining unit, that the address storage notification message has been received, and send a connection data packet for the second client to the first gateway, so that the first gateway passes through The second gateway sends the connection data packet to the second client, so that the first client and the second client establish a communication connection according to the connection data packet.
- an embodiment of the present application provides a gateway device, including a processor, an input device, an output device, and a memory, wherein the processor, the input device, the output device, and the memory are connected to each other, wherein the memory is used to store A computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the data processing method described in the above aspects.
- an embodiment of the present application provides a terminal device, including a processor, an input device, an output device, and a memory, where the processor, the input device, the output device, and the memory are connected to each other, wherein the memory is used for storing
- a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the data processing method described in the above aspects.
- an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program is used to execute the data processing method described in the above aspects.
- embodiments of the present application provide a computer program product including instructions, which, when executed on a computer, cause the computer to execute the data processing method described in the above aspects.
- the first gateway may receive a connection test packet sent by the first client, so that based on the The packet header file stores the access address of the second client. Further, when the first gateway can determine that the second gateway has also stored the access address of the first client, the connection data packet of the first client is sent to the second gateway through the second gateway. The second client, so that a communication connection can be established between the first client and the second client based on the connection data packet.
- the connection data packets can be forwarded smoothly through the first gateway and the second gateway, so that the first client and the second client can A communication connection is established between the terminals, and since the probability of the connection data packet being discarded by the first gateway or the second gateway is low, the success rate of establishing a communication connection between the first client and the second client can be improved.
- 1a is a system architecture diagram of a data processing method provided by an embodiment of the present application.
- Fig. 1b is a kind of schematic diagram of punching holes so that the first client and the second client establish a communication connection;
- 1c is a schematic diagram of interaction between a first client and a second client and a proxy server provided by an embodiment of the present application;
- Fig. 1d is a schematic diagram of a kind of hole punching provided by an embodiment of the present application to enable a first client and a second client to establish a communication connection;
- FIG. 2 is a schematic flowchart of a data processing method provided by an embodiment of the present application.
- 3a is a schematic diagram of a client connecting to multiple gateways according to an embodiment of the present application
- Fig. 3b is a kind of comparison diagram of the success rate of punching hole provided by the embodiment of the present application.
- Figure 3c is a schematic diagram of a hole punching success rate provided by an embodiment of the present application.
- FIG. 4 is a schematic flowchart of a data processing method provided by an embodiment of the present application.
- FIG. 5 is a schematic diagram of the number of times a first client determines a target route according to an embodiment of the present application
- FIG. 6 is a schematic block diagram of a data processing apparatus provided by an embodiment of the present application.
- FIG. 7 is a schematic block diagram of a data processing apparatus provided by an embodiment of the present application.
- FIG. 8 is a schematic block diagram of a gateway device provided by an embodiment of the present application.
- FIG. 9 is a schematic block diagram of a terminal device provided by an embodiment of the present application.
- the embodiments of the present application propose A data processing method is provided, wherein the first gateway of the first client and the second gateway of the second client can respectively pre-store the access address of the counterpart client, then record the access address of the counterpart client based on the first gateway and the second gateway, So that the first gateway and the second gateway can realize the successful forwarding of the connection data packet when acquiring the connection data packet used to indicate the establishment of a communication connection between the first client and the second client, and also Thus, the success rate of establishing the communication connection between the first client and the second client is improved.
- the opposite client is a client in a different private network from the current client.
- the first client may belong to the first private network marked by 10 in FIG. 1a.
- the second client may belong to the second private network marked by 11 in FIG. 1a, wherein the first client may be the client marked by 101 in the first private network 10, and the second client may be the second private network.
- the first client 101 can access the public network through the first gateway
- the second client 102 can access the public network through the second gateway.
- Access to a network, wherein the first gateway may be, for example, the gateway marked by 103 in FIG.
- the second gateway may be, for example, the gateway marked by 104 in FIG. 1a.
- the network types to which the first gateway 103 and the second gateway 104 belong are not classified, and may belong to either a private network or a public network, which is not limited in this embodiment of the present application.
- both the first gateway and the second gateway are application programming interface (Application Programming Interface, API) gateways, therefore, the first gateway may also be referred to as the first interface gateway, and the second gateway may also be referred to as the first gateway Two-interface gateway.
- API Application Programming Interface
- both the first gateway and the second gateway belong to external network gateways
- the external network gateway is a gateway configured with a network address translation (Net Address Transport, NAT) protocol
- the network address translation protocol is used to The client address of the client of the private network accessing the private network is mapped to the access address for public network access, and based on the access information sent from the public network to the client located in the private network, the access address corresponding to the access information is converted into The corresponding private address (ie client address) is forwarded to the corresponding client, so that the client in the private network can interact with the public network based on the network address translation protocol deployed in the gateway.
- NAT Network Address Transport
- the gateways deployed with the NAT protocol can be divided into full cone NAT, restricted cone NAT, port restricted cone NAT, symmetric NAT and dynamic NAT.
- the proposed data processing method so that the first client and the second client in different private networks establish communication, can be applied to the first gateway of the first client and the second gateway of the second client are both dynamic NAT is implemented, but when the first gateway or the second gateway is not a gateway of the dynamic NAT type, the embodiments of the present application may also be used.
- a reverse link technology, a birthday attack technology, or a port prediction technology can also be used to implement between the first client and the second client Establish a communication connection.
- the reverse link technology is that the first client and the second client correspond to different gateways with NAT deployed. If the first client wants to communicate with the second client, it can send the The second client sends a connection request and simultaneously sends a connection data packet to the access address of the second client. After the second client receives the connection request forwarded by the proxy server, it can send a connection data packet to the access address of the first client. Thereby, the communication between the first client and the second client is realized.
- the birthday attack technique is mainly used in the connection problem where the NAT deployed on the corresponding gateway is a port-restricted NAT and a symmetric NAT.
- the reverse link technology is a technology that allows dynamic NAT to actively initiate hole punching, as shown in Figure 1b, which may include the following steps:
- the first client sends a connection request to the second client through the proxy server;
- the second client after receiving the connection request, the second client sends a connection request to the first client through the proxy server;
- the second client sends a connection data packet to the first client
- the connection data packet may be discarded by the first gateway (static NAT gateway) of the first client, because the first client has not communicated directly with the second client However, at this time, the second gateway (dynamic NAT gateway) of the second client can be made to record the access address of the first client;
- the first client directly sends the connection data packet to the second client. Since the access address of the first client is recorded in the second gateway of the second client, the connection data packet can pass through the second gateway. The access address of the second client is recorded in the first gateway of a client;
- punching a hole refers to allowing clients in different private networks to create connections, and the private network may be, for example, a Transmission Control Protocol/Internet Protocol (transmission Control Protocol/Internet Protocol, TCP/IP) network.
- TCP/IP Transmission Control Protocol/Internet Protocol
- the use of the reverse link technology can solve the hole punching of the dynamic NAT gateway and the static NAT gateway, so as to realize the establishment of communication connections between the clients of different private networks, the NAT in the gateways corresponding to the first client and the second client
- the NAT deployed in the gateway behaves as a cone NAT when the other client actively connects to the gateway where the dynamic NAT is located, in which the cone NAT maps the external port to a fixed port, so that the gateway deployed with dynamic NAT can successfully forward the communication messages received from the public network to the corresponding client; and if the opposite client requests to actively connect to the gateway deployed with dynamic NAT, the NAT deployed in the gateway It appears as a dynamic NAT.
- the gateway of the dynamic NAT cannot succeed after receiving the communication message (such as a connection packet requesting a communication connection) sent by the other client. Forwarding to the corresponding client (or the success rate of forwarding to the corresponding client is low), it can be seen that the gateway deployed with dynamic NAT can only connect successfully if it actively initiates the connection.
- the reverse link technology enables the gateway deployed with the dynamic NAT to initiate a connection actively, thereby realizing the communication connection problem between the client deploying the dynamic NAT gateway and the client deploying the non-dynamic NAT gateway.
- the NATs deployed by the gateways corresponding to the first client and the second client are both dynamic, because the gateway corresponding to any client is actively connected, the NAT in the gateway of the other client will be a dynamic type, so that any The gateway corresponding to one client cannot correctly forward the connection data packet sent by the other client through the gateway to request the communication connection, resulting in the failure of the communication connection between the first client and the second client.
- the NATs deployed in the gateways corresponding to the first client and the second client are both dynamic, it is difficult to realize the intercommunication between the first client and the second client.
- an embodiment of the present application proposes a data processing method for solving the NAT types in the gateways corresponding to the two clients The client intercommunication problem when both are dynamic types.
- the first client and the second client in order to establish a communication connection between the first client and the second client, can respectively send messages to the corresponding first gateway and the second client.
- the second gateway sends a connection test packet with Time To Live (TTL), the connection test packet records the access address of the opposite client (ie the external access address of the opposite client), and based on the time to live, the connection test packet is made Just reach the gateway of the local client, but not the gateway of the opposite client, so that the access address of the opposite client can be recorded in the gateway of the local client. Therefore, the gateway of the dynamic type NAT can be deployed when receiving the opposite client.
- the external port After sending the connection data packet requesting a communication connection, the external port is not mapped to a random port, so as to realize the correct forwarding of the received connection data packet, so that the first client and the second client can establish a communication connection .
- the first client and the second client can respectively determine the access address of the client when accessing the public network, wherein the first client and the second client both use network penetration
- the protocol determines the access address of the client when accessing the public network, wherein the network penetration protocol may be, for example, a NAT penetration hole punching standard (Session Traversal Utilities for NAT, STUN) protocol.
- the first client and the second client are clients belonging to different private networks, the first client and the second client cannot communicate directly, but the first client If the access address of the client is sent to the second client, and the access address of the second client is obtained, the first client and the second client can send the access address of the local client to the other client through the proxy server, wherein the The connection relationship between the first client, the second client and the proxy server may be as shown in FIG. 1c, the proxy server is the server marked by 105 in FIG. 1c, then the first client 101 determines the first client After obtaining the access address of the client, the proxy server 105 sends the access address of the first client to the second client 102.
- the proxy server 105 sends the access address of the first client to the second client 102.
- the access address of the second client is sent to the first client 101, so that the first client and the second client respectively determine the access address of the opposite client.
- the first client may send a connection test packet carrying the access address of the second client to the first gateway, wherein the first client When the client sends a connection test packet carrying the access address of the second client to the first gateway, it will record source address information and destination address information in the header file of the connection test packet, and the source address information is the first The intranet address (or client address) of the client, and the target address information is the access address of the second client. It can be understood that the access address of the second client is the public network accessed by the second client through the second gateway After receiving the connection test packet, the first gateway can determine the second gateway based on the source address information and destination address information recorded in the packet header file.
- the access address of the client so that the first gateway can store the access address of the second client.
- the first gateway receives the connection data packet from the second gateway, the first gateway has recorded the gateway of the second gateway. address (ie, the access address of the second client), so after receiving the connection data packet from the second gateway, the first gateway will successfully forward the connection data packet to the first client based on the stored information.
- the second client can also send a connection test packet carrying the access address of the first client to the second gateway, so that the second gateway stores the source address information and destination address recorded in the header file of the connection test packet information, so that the second gateway can store the access address of the first client.
- the second gateway receives the connection data packet of the first gateway, it can also successfully forward the connection data packet to the second client.
- FIG. 1d when the first gateway of the first client and the second gateway of the second client are both dynamic gateways, a communication connection is established between the first client and the second client The specific steps are as follows:
- the first client sends a connection request for establishing a communication connection to the second client through the proxy server;
- the first client sends a connection test packet to the second client.
- the connection test packet just arrives at the first gateway, and the survival time of the connection test packet is 0 after reaching the first gateway. Therefore, the first After receiving the connection test packet, the gateway will no longer forward the connection test packet to the second client, therefore, the second client will not receive the connection test packet. After the first gateway receives the connection test packet, the first gateway will record the access address of the second client carried in the connection test packet;
- the second client after receiving the connection request, can also send a connection test packet to the second gateway, and the connection test packet also just arrives at the second gateway and is no longer forwarded.
- the access address of the first client carried in the connection test package will also be recorded;
- the dynamic second gateway can receive the data packets of the first client. Therefore, the second client can send the first client through the proxy server. The client sends an address storage notification message to inform the first client (or the first gateway) that the second gateway has stored the access address of the first client;
- the first client after receiving the address storage notification message, can send a connection data packet to the second client, and the connection data packet can smoothly pass through the first gateway and the second gateway, and reach the second client;
- the second client after the second client receives the connection data packet sent by the first client, it can return confirmation information of successful reception to the first client, thereby realizing the establishment of communication between the first client and the second client connect.
- FIG. 2 is a schematic flowchart of a data processing method proposed by an embodiment of the present application.
- the method may be applied to the first gateway of the first client. As shown in FIG. 2 , the method may include:
- S201 Receive a connection test packet sent by a first client, where the connection test packet carries an access address of a second client.
- the first client belongs to a first private network
- the second client belongs to a second private network
- the first private network is provided with a first gateway
- the second private network is provided with
- the second gateway, the first gateway and the second gateway are both external network gateways;
- the external network gateway is deployed with a network address translation protocol, and the network address translation protocol
- the first gateway converts the client address used by the first client to access the first private network to the access address for accessing the public network.
- the access address of the first client when the second client accesses the public network, the second gateway converts the client address of the second client accessing the second private network to the address of the second client address.
- the first gateway may also first determine the types of network address translation protocols respectively deployed in the first gateway and in the second gateway, wherein , the types of the network address translation protocol include dynamic type and static type.
- the static type network address translation protocol converts the internal network address (ie client address) into a fixed external network access address, while the dynamic type network address translation protocol Then, during address translation, it may be randomly mapped into different access addresses.
- the first gateway and the second gateway serving as external network gateways can accurately transfer the access addresses used by the first client and the second client to access the public network, so as to establish the first client and the second client in the future.
- the data connection between the two clients lays the foundation for realization and improves the success rate of establishment.
- the first client may first determine the first protocol type of the network address translation protocol in the first gateway and the second protocol type of the network address translation protocol in the second gateway, if the Both the first protocol type and the second protocol type belong to the dynamic type, then trigger the execution of the step of receiving the connection test packet from the first client, however, the first protocol type or the second protocol type is not a dynamic type
- the embodiments of the present application can also be used when the protocol is used.
- the protocol characteristics of the dynamic type NAT protocol include: if the access address of the source client is not stored in the gateway including the NAT protocol, after receiving the connection data packet sent from the unstored source client, When the connection data packet is forwarded, the mapped random port is used, and the mapping based on the random port may have the risk of the connection data packet being discarded, thereby causing the hole punching failure between the first client and the second client.
- the gateway of the dynamic type network translation address pre-stores the access address of the opposite client for implementation, wherein, if the first gateway of the first client and the second gateway of the second client are both gateways including the dynamic type network translation address, Then, in order to ensure that the first client and the second client can punch holes successfully, the access address of the second client can be stored in the first gateway, and the access address of the first client can be stored in the second gateway, so as to realize The access address of the opposite client is stored in the gateway including the dynamic type of network translation address, so that the first gateway and the second gateway can ensure that the first gateway and the second gateway send the first client to the second client (or the second client).
- the connection data packet can be forwarded to the opposite client, so as to realize the communication connection
- the first gateway may determine from the connection test packet after receiving the connection test packet sent by the first client that carries the access address of the second client obtain the access address of the second client, and store the access address of the second client, that is, to execute S202; then it is also understandable that the second gateway can also obtain from the second client the address that carries the first client Access the connection test package of the address, determine the access address of the first client from the connection test package, and store the access address of the first client.
- the access address of the second client is acquired by the first client from the proxy server in advance, and the access address of the second client acquired by the proxy server is that the second client adopts a network penetration protocol (such as the above STUN protocol).
- the specific manner in which the first client generates a connection test packet carrying the access address of the second client is: after the second client determines the access address of the second client, the second client uses the proxy server to determine the access address of the second client.
- the access address of the client is sent to the first client; the first client obtains the access address of the second client sent by the second client to the first client through the proxy server, and sends the second client to the second client.
- the access address of the client is added to the connection test packet, and the connection test packet to which the access address of the second client is added is sent to the first gateway.
- the access address of the second client is determined by the second client using the network penetration protocol, the access address of the second client is carried in the connection test packet and provided to the first gateway for storage, so as to establish the first client later.
- the communication connection between the client and the second client lays the foundation.
- S202 Store the access address of the second client carried in the connection test packet.
- S203 Receive a connection data packet sent by the first client to the second client.
- the first address storage notification message is sent by the second gateway after storing the access address of the first client.
- the first gateway may determine the access address of the second client based on the record in the packet header file, wherein the first gateway and the first client may belong to the same terminal device, or the The first gateway may also be an independent device independent of the terminal device to which the first client belongs. In this embodiment of the present application, the relationship between the first gateway and the device to which the first client belongs is not limited.
- the first gateway after determining the access address of the second client, the first gateway will not continue to forward the connection test packet, that is, the connection test packet only reaches the first client from the first client One gateway stops. Since the second gateway does not store the access address of the first client, if the first gateway continues to forward the connection test packet to the second gateway, the second gateway will determine that the access address from the first client The connection test package is an unfamiliar connection test package, and the access address of the first client is blocked. Therefore, in order to avoid the second gateway from blocking the access address of the first client, and the first gateway is made to store the access of the second client address, the first gateway can set the number of target routes for the connection test packet, so that the connection test packet starts from the first client and stops forwarding when it arrives at the first gateway.
- the number of target routes is used to indicate the number of intranet gateways through which the connection test packet departs from the first client and reaches the first gateway, and each time it reaches an intranet For the gateway, the number of target routes is decremented by one, and when the number of target routes reaches 0, it stops forwarding the connection data packet.
- the first client is the client marked by 30 in Figure 3a
- the first gateway is the gateway marked by 34 in Figure 3a
- the gateways marked by 31, 32 and 33 in Figure 3a are all is an intranet gateway, then when the first client 30 sends a connection test packet for the first gateway 34, it can first determine the number of intranet gateways that need to pass through.
- the number of network gateways is 3, then the number of target routes set by the first client for the connection test packet is 4, so that the first client 30 can just send the connection test packet to the first gateway 34, and the After the first gateway 34 receives the connection test packet, the number of times of the target route will be reduced to 0, and after receiving the connection test packet, the first gateway can determine the second connection test packet based on the header file of the connection test packet.
- the access address of the gateway is stored, and the connection test packet is directly discarded after the access address of the second gateway is stored.
- the first gateway after storing the access address of the second client, if the first gateway receives a connection data packet sent by the first client to the second client, the connection data packet is used to indicate that the first A communication connection is established between the client and the second client. After receiving the connection data packet sent by the first client to the second client, the first gateway can first determine whether the second gateway has stored the first client's data. The access address, wherein the first gateway can determine whether the second gateway has stored the access address of the first client by acquiring the first address storage notification message sent by the second gateway.
- the first gateway receives the first address storage notification message sent by the second gateway, it can be determined that the second gateway has stored the access address of the first client, and if the first gateway has not After receiving the first address storage notification message sent by the second gateway, it can be determined that the second gateway does not store the access address of the first client, wherein the first address storage notification message is that the second gateway is storing It is sent after obtaining the access address of the first client. If the first gateway determines to receive the first address storage notification message sent by the second gateway, the obtained connection data packet may be sent to the second client through the second gateway, so that the first client and the The second client establishes a communication connection based on the connection data packet.
- the second client can After it is determined that the connection data packet is received, an acknowledgement message confirming receipt of the connection data packet is sent to the first client, so far, the first client and the second client complete the communication connection.
- the creation of the communication connection between the first client and the second client can also be initiated by the second gateway, that is, after the second gateway stores the access address of the first client, it receives the first client from the first gateway.
- the gateway has stored the notification message of the access address of the second client, and further sends a connection data packet indicating establishing a communication connection between the first client and the second client to the first client, so that the first client Establish a communication connection with the second client based on the connection data packet.
- the first gateway may also send a second address storage notification message to the second gateway, where the second address storage notification message is used to identify the The first gateway stores the access address of the second client.
- the second gateway can clarify whether the first gateway has successfully saved the access address of the second client based on the acquired second address storage notification message, which improves the According to the establishment success rate of the communication connection between a client and the second client.
- the first gateway may receive a connection test packet sent by the first client, so that the packet header of the connection test is based on the first gateway.
- the file obtains the access address of the second client, and stores the access address of the second client.
- send the first client The connection data packet to the second client is sent to the second client through the second gateway, so that a communication connection can be established between the first client and the second client based on the connection data packet.
- the connection data packets can be forwarded smoothly through the first gateway and the second gateway, so that the first client and the second client can A communication connection is established between the terminals, and since the probability of the connection data packet being discarded by the first gateway or the second gateway is low, the success rate of establishing a communication connection between the first client and the second client can be improved.
- a data processing method for establishing a communication connection between a first client and a second client and a related art for establishing a first client and a second client will be proposed by using the embodiments of the present application.
- the communication connection between the first client and the second client is established by using the related technology, as can be seen from the test result marked by 301 in Fig. 3b, the first client
- the probability of successfully establishing a communication connection with the second client is only 33%, while the probability of successfully establishing a communication connection between the first client and the second client using the method proposed in the embodiment of the present application is 94%.
- the success rate of establishing a communication connection between the first client and the second client can be effectively improved.
- the data processing method proposed by the embodiment of the present application can also be applied when the gateways of the first client and the second client are both dynamic NATs, and the first client and the second client are A communication connection is established between them, and the probability of successfully establishing a communication connection is 99%. It can be seen that the data processing method proposed in the embodiment of the present application can effectively improve the success of establishing a communication connection for the first client and the second client Rate.
- FIG. 4 is a schematic flowchart of a data processing method proposed by an embodiment of the present application.
- the method can be applied to a terminal device with the above-mentioned first client installed.
- the method may include:
- connection test packet Send a connection test packet to a first gateway, where the connection test packet carries the access address of the second client, so that the first gateway stores the access address of the second client according to the connection test packet.
- the first client when the first client sends the connection test packet to the first gateway, it may first obtain the access address of the second client through a proxy server, and the access address of the second client is obtained by using network penetration. If the protocol is determined and sent to the proxy server, after obtaining the access address of the second client, the first client can add the access address of the second client to the connection test package, and report to the The first gateway sends a connection test packet to which the access address of the second client is added, wherein the first client belongs to the first private network, the second client belongs to the second private network, and the first client belongs to the second private network.
- a private network is provided with the first gateway, and the second private network is provided with a second gateway, that is to say, it can be understood that the first client communicates with the public network through the first gateway, and the second client communicates with the public network through the first gateway.
- the second gateway communicates with the public network. Since the access address of the second client is determined by the second client using the network penetration protocol, the access address of the second client is carried in the connection test packet and provided to the first gateway for storage, so as to establish the first client later.
- the communication connection between the client and the second client lays the foundation.
- the second client sends a connection test packet including the access address of the first client to the second gateway, so that the second client The gateway determines and stores the access address of the first client based on the connection test package, so that both the first gateway and the second gateway can store the access address of the opposite client.
- the first gateway can set the number of target routes for the connection test packet to make the connection test The packet starts from the first client and stops forwarding when it arrives at the first gateway.
- the first client may first determine the number of target routes, where the number of target routes is used to indicate that the connection test packet is sent from the first gateway. The number of intranet gateways through which a client starts and arrives at the first gateway. After the first client determines the number of target routes, the number of target routes can be added to the connection test packet.
- the first gateway is reached when the target value is obtained, wherein the target value may be 0, for example.
- Any data packet starts from the first client and reaches the first gateway of the first client through at least one intranet gateway.
- the first client can set the target routing times for the connection test packet first. Set the initial routing times for the connection request packet, and send the connection request packet to the target gateway according to the initial routing times, wherein the connection request packet is a data packet; further, the first client can download the connection request packet from the
- the target gateway obtains the gateway address of the target gateway, and judges whether the gateway address is the access address of the first client; if it is determined that the gateway address is the access address of the first client, the initial The number of routes is taken as the number of target routes.
- the processing of adding one to the initial routing times is performed; Connect the request packet until the access address of the first client is obtained, and determine the target times of the plus-one processing performed when the access address of the first client is obtained; update the initial routing times according to the target times, and use The updated initial routing times are used as the target routing times, thereby realizing the purpose of accurately determining the target routing times.
- the number of routes set by the first client for the connection request packet is used to indicate the time-to-live (TTL) of the connection request packet.
- TTL time-to-live
- the first client can obtain the intranet gateway 1 from the intranet gateway 1.
- the gateway address 1 is the gateway address 1 that the intranet gateway 1 feeds back to the first client after receiving the connection request packet. After the first client obtains the gateway address 1, the gateway address 1 and the The access address of the first client is matched.
- S402 Check whether an address storage notification message sent by the second gateway has been received.
- the address storage notification message is sent by the second gateway after storing the access address of the first client.
- the first client sends the connection test packet to the first gateway, so that after the first gateway stores the access address of the second client, the first client can send the packet by whether it receives the second gateway. address storage notification message, and determine whether the second gateway stores the access address of the first client, wherein the address storage notification message is sent by the second gateway after storing the access address of the first client . If the first client determines that it has received the address storage notification message sent by the second gateway, it can send the connection data packet to be sent to the second client to the first gateway, so that the first gateway can send the connection data packet to the first gateway. The packet is forwarded to the second gateway, and finally the second client is made to receive the connection data packet, so that the first client and the second client establish a communication connection based on the connection data packet.
- the first client may send a connection test packet carrying the access address of the second client to the first gateway to Make the first gateway obtain the access address of the second client from the connection test package, and store the access address of the second client, so as to store the access address of the second client in the first gateway, further, if If the first client determines that the second gateway has also stored the access address of the first client, it can send the connection data packet to the second client through the first gateway and the second gateway, so that the connection data packet can pass through smoothly
- the first gateway and the second gateway reach the second client, so that the first client and the second client can establish a communication connection based on the connection data packet, and improve the relationship between the first client and the second client.
- the success rate of establishing a communication connection between them are possible.
- the embodiments of the present application further provide a data processing apparatus, and the data processing apparatus may be a computer program (including program code) running in the above-mentioned first gateway.
- the data processing apparatus can be used to execute the data processing method described in FIG. 2 , please refer to FIG.
- a receiving unit 601 configured to receive a connection test packet sent by a first client, where the connection test packet carries an access address of a second client; the first client belongs to the first private network, and the second client belongs to a second private network, the first private network is provided with a first gateway, and the second private network is provided with a second gateway;
- a determining unit 602 configured to determine the access address of the second client carried in the connection test package
- a storage unit 603, configured to store the access address of the second client
- the receiving unit 601 is further configured to receive a connection data packet sent by the first client to the second client;
- the determining unit 602 is further configured to check whether the first address storage notification message sent by the second gateway has been received, wherein the first address storage notification message is that the second gateway is storing the first address storage notification message. Sent after the client's access address;
- the sending unit 604 is configured to send the received connection data packet to the second client through the second gateway when the determining unit 602 determines that the first address storage notification message has been received, so that all The first client and the second client establish a communication connection according to the connection data packet.
- the access address of the second client is determined by using a network penetration protocol; the receiving unit is further configured to pass a proxy server before receiving the connection test packet sent by the first client Obtain the access address of the second client sent by the second client to the first client.
- the first gateway and the second gateway are both external network gateways
- the external network gateway is deployed with a network address translation protocol, and the network address translation protocol is used to convert the client address when the client accesses the private network to the access address for public network access;
- the first gateway converts the client address of the first client accessing the first private network into the access address of the first client; the client address of the second client accessing the second private network is converted into the access address of the second client by the second gateway.
- the determining unit 602 is further configured to determine the first protocol type of the network address translation protocol in the first gateway, and the second protocol type of the network address translation protocol in the second gateway;
- the receiving unit 601 is further configured to trigger the receiving unit to receive the connection test packet sent by the first client if both the first protocol type and the second protocol type are dynamic types.
- connection test packet is set with a target route count, and the target route count is used to indicate the number of intranet gateways through which the connection test packet passes from the first client to the first gateway. number.
- the receiving unit 601 may receive a connection test packet sent by the first client when it is determined that a communication connection needs to be established between the first client and the second client, so that the determining unit 602 is based on the
- the header file of the connection test obtains the access address of the second client, so that the storage unit 603 stores the access address of the second client, and further, when the determining unit 602 can determine that the second gateway has also stored the access address of the first client,
- the sending unit 604 sends the connection data packet sent from the first client to the second client, and sends it to the second client through the second gateway, so that the connection data packet can be communicated between the first client and the second client based on the connection data packet. Establish a communication connection.
- the connection data packets can be forwarded smoothly through the first gateway and the second gateway, so that the first client and the second client can A communication connection is established between the terminals, and since the probability of the connection data packet being discarded by the first gateway or the second gateway is low, the success rate of establishing a communication connection between the first client and the second client can be improved.
- an embodiment of the present application further proposes a data processing apparatus.
- the data processing apparatus is configured in the aforementioned terminal device, and may be a computer program (including code).
- the data processing apparatus can be used to execute the data processing method described in FIG. 4 , please refer to FIG. 7 , the data processing apparatus includes: a sending unit 701 .
- a sending unit 701 is configured to send a connection test packet to the first gateway, where the connection test packet carries the access address of the second client, so that the first gateway stores the second client's access address according to the connection test packet.
- Access address the first client belongs to the first private network
- the second client belongs to the second private network
- the first private network is provided with the first gateway
- the second private network is provided with a second gateway ;
- Determining unit 702 configured to check whether an address storage notification message sent by the second gateway has been received, wherein the address storage notification message is sent by the second gateway after storing the access address of the first client of;
- the sending unit 701 is further configured to send the connection data packet of the second client to the first gateway when the determining unit 702 determines that the address storage notification message has been received, so that the first The gateway sends the connection data packet to the second client through the second gateway, so that the first client and the second client establish a communication connection according to the connection data packet.
- the sending unit 701 is specifically configured to:
- the apparatus further includes: a determining unit 702 and an adding unit 703 .
- Determining unit 702 configured to determine the number of target routes, where the number of target routes is used to indicate the number of intranet gateways through which the connection test packet departs from the first client and arrives at the first gateway;
- the adding unit 703 is configured to add the number of times of the target route to the connection test packet, wherein, in the process of the sending unit 701 sending the connection test packet to the first gateway, each time the connection test packet arrives at an internal network gateway, the number of target routes is subtracted by one, and the connection test packet arrives at the first gateway when the target value is obtained after the number of target routes is subtracted by one.
- any data packet from the first client to the first gateway of the first client passes through at least one intranet gateway, and the apparatus further includes: a setting unit 704 and a judging unit 705 .
- a setting unit 704 configured to set the initial routing times for the connection request packet
- the sending unit 701 is further configured to send the connection request packet to the target gateway of the first private network according to the initial routing times, where the connection request packet is a data packet;
- Judging unit 705, configured to judge whether the gateway address of the target gateway obtained from the target gateway is the access address of the first client
- the determining unit 702 is further configured to use the initial routing times as the target routing times if it is determined that the gateway address is the access address of the first client.
- the apparatus further includes: an execution unit 706 and an update unit 707 .
- the executing unit 706 is configured to, if it is determined that the gateway address is not the access address of the first client, execute a process of adding one to the initial routing times;
- the sending unit 701 is further configured to forward the connection request packet in the first private network according to the number of initial routes processed by adding one, until the access address of the first client is obtained;
- the determining unit 702 is further configured to determine the target number of times of the plus one processing performed when the access address of the first client is obtained;
- the updating unit 707 is configured to update the initial routing times according to the target times, and use the updated initial routing times as the target routing times.
- the sending unit 701 may send a connection test packet carrying the access address of the second client to the first gateway, so that the The first gateway obtains the access address of the second client from the connection test package, and stores the access address of the second client, so as to store the access address of the second client in the first gateway, and further, determines the first gateway.
- the second gateway has also stored the access address of the first client, then the sending unit 701 can send the connection data packet to the second client through the first gateway and the second gateway, so that the connection data packet can pass through the first client smoothly
- the gateway and the second gateway and reach the second client, so that the first client and the second client realize the establishment of a communication connection based on the connection data packet, and improve the establishment of communication between the first client and the second client Connection success rate.
- FIG. 8 is a schematic block diagram of the structure of a gateway device provided by an embodiment of the present application, where the gateway device is the above-mentioned first gateway, wherein the gateway device may be a server, and the server may be an independent physical server , it can also be a server cluster or distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security Cloud servers for services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms.
- the terminal may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto.
- the gateway device may also be a terminal device.
- the gateway device in this embodiment as shown in FIG. 8 may include: one or more processors 801 ; one or more input devices 802 , one or more output devices 803 and a memory 804 .
- the above-mentioned processor 801 , input device 802 , output device 803 and memory 804 are connected through a bus 805 .
- the memory 804 is used for storing a computer program, the computer program includes program instructions, and the processor 801 is used for executing the program instructions stored in the memory 804 .
- the memory 804 may include volatile memory (volatile memory), such as random-access memory (random-access memory, RAM); the memory 804 may also include non-volatile memory (non-volatile memory), such as flash memory (flash memory), solid-state drive (solid-state drive, SSD), etc.; the memory 804 may also include a combination of the above-mentioned types of memory.
- volatile memory volatile memory
- non-volatile memory non-volatile memory
- flash memory flash memory
- solid-state drive solid-state drive
- SSD solid-state drive
- the processor 801 may be a central processing unit (central processing unit, CPU).
- the processor 801 may further include a hardware chip.
- the above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or the like.
- the PLD can be a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL), or the like.
- the processor 801 may also be a combination of the above structures.
- the memory 804 is used to store a computer program
- the computer program includes program instructions
- the processor 801 is used to execute the program instructions stored in the memory 804 to implement the steps of the corresponding method in FIG. 2 .
- the processor 801 is configured to invoke the program instructions for executing:
- connection test packet sent by the first client, where the connection test packet carries the access address of the second client;
- the first client belongs to the first private network, and the second client belongs to the second client a private network, the first private network is provided with a first gateway, and the second private network is provided with a second gateway;
- the second gateway When receiving the connection data packet sent by the first client to the second client, if the first address storage notification message sent by the second gateway has been received, the second gateway sends the sending a connection data packet to the second client, so that the first client and the second client establish a communication connection according to the connection data packet; wherein, the first address storage notification message is the Sent by the second gateway after storing the access address of the first client.
- FIG. 9 is a schematic structural block diagram of a terminal device provided by an embodiment of the present application, where the terminal device is the above-mentioned first client.
- the terminal device in this embodiment as shown in FIG. 9 may include: one or more processors 901 ; one or more input devices 902 , one or more output devices 903 and a memory 904 .
- the above-mentioned processor 901 , input device 902 , output device 903 and memory 904 are connected through a bus 905 .
- the memory 904 is used to store a computer program, the computer program includes program instructions, and the processor 901 is used to execute the program instructions stored in the memory 904 .
- the memory 904 may include volatile memory (volatile memory), such as random-access memory (random-access memory, RAM); the memory 904 may also include non-volatile memory (non-volatile memory), such as flash memory (flash memory), solid-state drive (solid-state drive, SSD), etc.; the memory 904 may also include a combination of the above-mentioned types of memory.
- volatile memory volatile memory
- non-volatile memory non-volatile memory
- flash memory flash memory
- solid-state drive solid-state drive
- SSD solid-state drive
- the processor 901 may be a central processing unit (CPU).
- the processor 901 may further include a hardware chip.
- the above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or the like.
- the PLD may be a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL), or the like.
- the processor 901 may also be a combination of the above structures.
- the memory 904 is used to store a computer program
- the computer program includes program instructions
- the processor 901 is used to execute the program instructions stored in the memory 904 to implement the steps of the corresponding method in FIG. 4 .
- the processor 901 is configured to invoke the program instructions for executing:
- connection test packet carries the access address of the second client, so that the first gateway stores the access address of the second client according to the connection test packet;
- the first client belongs to a first private network
- the second client belongs to a second private network
- the first private network is provided with the first gateway
- the second private network is provided with a second gateway;
- connection data packet sent to the second client is sent to the first gateway, so that the first gateway passes through the second gateway Send the connection data packet to the second client, so that the first client and the second client establish a communication connection according to the connection data packet; wherein, the address storage notification message is all
- the second gateway is sent after storing the access address of the first client.
- Embodiments of the present application provide a computer program product or computer program, where the computer program product or computer program includes a computer program, and the computer program is stored in a computer-readable storage medium.
- the processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method embodiment shown in FIG. 2 or FIG. 4 .
- the computer-readable storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), and the like.
- the embodiments of the present application also provide a computer program product including instructions, which, when executed on a computer, cause the computer to execute the methods provided by the above embodiments.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本发明实施例公开了一种数据处理方法、装置、相关设备及存储介质,其中方法包括:接收第一客户端发送的连接测试包;确定连接测试包携带的第二客户端的访问地址,并存储第二客户端的访问地址;当接收到第一客户端发送至第二客户端的连接数据包时,若已接收到第二网关发送的第一地址存储通知消息,则通过第二网关将连接数据包发送至第二客户端,以使得第一客户端和第二客户端根据连接数据包建立通信连接;其中,该第二网关是一种API网关,可提升为处于私有网络的客户端之间建立通信连接的成功率。
Description
本申请要求于2020年11月10日提交中国专利局、申请号为202011246040.6、申请名称为“数据处理方法、装置、相关设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及计算机技术领域,尤其涉及数据处理。
点对点传输(Peer-to-Peer,或者Point-to-Point,P2P)是指实现处于不同私有网络的两个客户端之间的传输,由于客户端所属的私有网络不同,那么这两个处于不同私有网络的客户端之间的传输,只能依赖公有网络进行,即在处于不同私有网络的客户端需要进行数据传输时,需要由公有网络进行数据的转发。为了提升点对点传输的效率,还可采用打洞技术使得处于不同私有网络的客户端直接相连,但当前的打洞技术连接两个处于不同私有网络的客户端的成功率较低,因此,如何提升处于不同私有网络的客户端之间的通信连接成功率成为了当前的研究热点。
发明内容
本申请实施例提供了一种数据处理方法、装置、相关设备及存储介质,可提升为处于私有网络的客户端之间建立通信连接的成功率。
一方面,本申请实施例提供了一种数据处理方法,包括:
接收第一客户端发送的连接测试包,所述连接测试包中携带第二客户端的访问地址;所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有第一网关,所述第二私有网络设有第二网关;
存储所述连接测试包携带的所述第二客户端的访问地址;
接收所述第一客户端向所述第二客户端发送的连接数据包;
检查是否已接收到所述第二网关发送的第一地址存储通知消息,其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;
当检查结果为是时,通过所述第二网关将接收到的所述连接数据包发送至所述第二客户端,以使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
再一方面,本申请实施例提供了一种数据处理方法,包括:
向第一网关发送连接测试包,所述连接测试包携带第二客户端的访问地址,以使所述第一网关根据所述连接测试包存储所述第二客户端的访问地址;第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有所述第一网关,所述第二私有网络设有第二网关;
检查是否已接收到所述第二网关发送的第一地址存储通知消息,其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;
当检查结果为是时,向所述第一网关发送针对所述第二客户端的连接数据包,以使所述第一网关通过所述第二网关将所述连接数据包发送至所述第二客户端,从而使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
再一方面,本申请实施例提供了一种数据处理装置,包括:
接收单元,用于接收第一客户端发送的连接测试包,所述连接测试包中携带第二客户端的访问地址;所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有第一网关,所述第二私有网络设有第二网关;
确定单元,用于确定所述连接测试包携带的所述第二客户端的访问地址;
存储单元,用于存储所述第二客户端的访问地址;
所述接收单元还用于接收所述第一客户端向所述第二客户端发送的连接数据包;
所述确定单元还用于检查是否已接收到所述第二网关发送的第一地址存储通知消息,其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;
发送单元,用于当所述确定单元确定已接收到第一地址存储通知消息时,通过所述第二网关将接收到的所述连接数据包发送至所述第二客户端,以使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
再一方面,本申请实施例提供了一种数据处理装置,包括:
发送单元,用于向第一网关发送连接测试包,所述连接测试包携带第二客户端的访问地址,以使所述第一网关根据所述连接测试包存储所述第二客户端的访问地址;第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有所述第一网关,所述第二私有网络设有第二网关;
确定单元,用于检查是否已接收到所述第二网关发送的地址存储通知消息,其中,所述地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;
所述发送单元,还用于在所述确定单元确定已接收到所述地址存储通知消息,向所述第一网关发送针对所述第二客户端的连接数据包,以使所述第一网关通过所述第二网关将所述连接数据包发送至所述第二客户端,从而使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
再一方面,本申请实施例提供了一种网关设备,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行以上方面所述的数据处理方法。
再一方面,本申请实施例提供了一种终端设备,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行以上方面所述的数据处理方法。
再一方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序用于执行以上方面所述的数据处理方法。
又一方面,本申请实施例提供了一种包括指令的计算机程序产品,当其在计算机上运行时,使得所述计算机执行以上方面所述的数据处理方法。
在本申请实施例中,第一网关可在确定需要在第一客户端和第二客户端之间建立通信 连接时,接收该第一客户端发送的连接测试包,从而基于该连接测试包的包头文件存储该第二客户端的访问地址,进一步地,该第一网关可确定该第二网关也已存储第一客户端的访问地址时,将第一客户端的连接数据包,通过第二网关发送到第二客户端,以使得该第一客户端和该第二客户端之间可基于该连接数据包建立通信连接。由于该第一网关和第二网关中已预先存储了对方客户端的访问地址,因此,连接数据包可顺利通过该第一网关和第二网关进行转发,从而可在第一客户端和第二客户端之间建立通信连接,并由于该连接数据包被第一网关或第二网关丢弃的概率较低,也就可以提升在第一客户端和第二客户端之间建立通信连接的成功率。
图1a是本申请实施例提供的一种数据处理方法的系统架构图;
图1b是一种打洞使得第一客户端和第二客户端建立通信连接的示意图;
图1c是本申请实施例提供的一种第一客户端和第二客户端,以及代理服务器的交互示意图;
图1d是本申请实施例提供的一种打洞使得第一客户端和第二客户端建立通信连接的示意图;
图2是本申请实施例提供的一种数据处理方法的示意流程图;
图3a是本申请实施例提供的一种客户端连接多个网关的示意图;
图3b是本申请实施例提供的一种打洞成功率的对比图;
图3c是本申请实施例提供的一种打洞成功率的示意图;
图4是本申请实施例提供的一种数据处理方法的示意流程图;
图5是本申请实施例提供的一种第一客户端确定目标路由次数的示意图;
图6是本申请实施例提供的一种数据处理装置的示意性框图;
图7是本申请实施例提供的一种数据处理装置的示意性框图;
图8是本申请实施例提供的一种网关设备的示意性框图;
图9是本申请实施例提供的一种终端设备的示意性框图。
为了在处于不同私有网络的第一客户端和第二客户端之间建立通信连接,并有效提升在该第一客户端和第二客户端之间建立通信连接的成功率,本申请实施例提出了一种数据处理方法,该第一客户端的第一网关和第二客户端的第二网关可分别预先存储对方客户端的访问地址,那么基于该第一网关和第二网关记录对方客户端的访问地址,使得该第一网关和该第二网关在获取到用于指示在该第一客户端和第二客户端之间建立通信连接的连接数据包时,可实现对该连接数据包的成功转发,也就提升了对建立第一客户端和第二客户端的通信连接时的成功率。在一个实施例中,对方客户端是和当前客户端处于不同私有网络的客户端,如图1a所示,该第一客户端可以属于如图1a中由10标记的第一私有网络,该第二客户端例如可以属于如图1a中由11标记的第二私有网络,其中,该第一客户端可以是第一私有网络10中由101标记的客户端,该第二客户端则可以是第二私有网络11中由102标记的客户端,在一个实施例中,该第一客户端101可通过第一网关实现对公有网络的访问, 该第二客户端102可通过第二网关实现对公有网络的访问,其中,该第一网关例如可以是如图1a中由103标记的网关,该第二网关例如可以是如图1a中由104标记的网关。其中,需要说明的是,该第一网关103和第二网关104所属的网络类型不做划分,可以是属于私有网络,也可以属于公有网络,本申请实施例不做限定。其中,该第一网关和第二网关均是一种应用程序接口(Application Programming Interface,API)网关,所以,该第一网关也可称为第一接口网关,该第二网关也可称为第二接口网关。
在一个实施例中,该第一网关和该第二网关均属于外网网关,外网网关是配置有网络地址转换(Net Address Transport,NAT)协议的网关,该网络地址转换协议用于将位于私有网络的客户端访问私有网络的客户端地址,映射为进行公有网络访问的访问地址,以及基于从公有网络发送到位于私有网络中的客户端的访问信息,将该访问信息对应的访问地址转换为对应的私有地址(即客户端地址),并转发到对应的客户端,从而使得处于私有网络的客户端基于网关中部署的网络地址转换协议,可实现和公有网络之间的交互。其中,根据NAT进行地址转换的方式,可将部署有NAT协议的网关划分为全锥形NAT,限制锥形NAT,端口限制锥形NAT,对称型NAT和动态型NAT,其中,本申请实施例所提出的数据处理方法,以使得处于不同私有网络的第一客户端和第二客户端建立通信,可以应用于该第一客户端的第一网关和该第二客户端的第二网关均为动态型NAT时实施的,但是在该第一网关或该第二网关不是动态NAT类型的网关时,也可采用本申请实施例。或者,在该第一网关或该第二网关不是动态NAT类型的网关时,也可采用反向链接技术,或者生日攻击技术,或者端口预测技术实现在第一客户端和第二客户端之间建立通信连接。
在一个实施例中,反向链接技术是第一客户端和第二客户端对应不同的部署有NAT的网关,如果第一客户端想要和第二客户端通信,则可通过代理服务器向第二客户端发送连接请求,并同时向第二客户端的访问地址发送连接数据包,在第二客户端接收到代理服务器转发的连接请求后,则可向第一客户端的访问地址发送连接数据包,从而实现第一客户端和第二客户端的通信。生日攻击技术主要用在对应网关部署的NAT为端口限制型NAT和对称型NAT的连接问题中,由于对称型NAT的外部端口是随机变化的,端口限制型NAT需要预测对称型NAT的外部端口,往对称型NAT的随机端口发包,对称型NAT使用不同的套接字(socket)往端口限制型NAT发包。其中,该反向链接技术是让动态型NAT主动发起打洞的技术,如图1b所示,具体可包括如下步骤:
s11,第一客户端通过代理服务器向第二客户端发送连接请求;
s12,第二客户端接收到该连接请求后,通过代理服务器向第一客户端发送连接请求;
s13,第二客户端给第一客户端发送连接数据包,该连接数据包可能被第一客户端的第一网关(静态NAT网关)丢弃,因为第一客户端还没有和第二客户端直接通信过,此时,可使得第二客户端的第二网关(动态NAT网关)记录下了第一客户端的访问地址;
s14,第一客户端直接给第二客户端发送连接数据包,由于第二客户端的第二网关中记录了第一客户端的访问地址,所以该连接数据包可以通过该第二网关,此时第一客户端的第一网关中记录了第二客户端的访问地址;
s15,第二客户端接收到第一客户端发送的连接数据包后,给第一客户端发送确认信息, 这个确认信息可以通过网关并到达该第一客户端,从而实现在第一客户端和第二客户端之间的打洞。其中,打洞是指使得处于不同私有网络的客户端创建连接,该私有网络例如可以是传输控制协议/互联网络协议(transmission Control Protocol/Internet Protocol,TCP/IP)网络。
虽然采用反向链接技术可解决动态型NAT网关和静态NAT网关的打洞,从而实现对不同私有网络的客户端建立通信连接,但在该第一客户端和第二客户端对应的网关中NAT的类型均为动态类型时,由于动态型NAT在对方客户端主动连接该动态型NAT所在的网关时,该网关中部署的NAT表现为锥形NAT,其中,锥形NAT把外部端口映射为固定端口,以使部署有动态型NAT的网关可成功将从公有网络接收的通信消息转发到对应客户端;而如果对方客户端请求主动连接该部署有动态型NAT的网关,该网关中部署的NAT则表现为动态型NAT,由于动态型NAT将外部端口为随机端口,所以使得该动态型NAT的网关在接收到对方客户端发送的通信消息(如请求通信连接的连接数据包)后,无法成功转发到对应客户端(或转发到对应客户端的成功率较低),由此可见,部署有动态型NAT的网关只有主动发起连接才能连接成功。反向链接技术就是通过让部署有动态型NAT的网关主动发起连接,从而实现了对部署动态型NAT网关的客户端和部署非动态型NAT网关的客户端之间的通信连接问题。但是在第一客户端和第二客户端对应网关部署的NAT均为动态型时,由于由任意一个客户端对应的网关主动连接,都会使得对方客户端的网关中的NAT为动态类型,从而使得任意一个客户端对应的网关均无法将对方客户端通过网关发送用于请求通信连接的连接数据包进行正确转发,从而导致第一客户端和第二客户端之间通信连接失败,也就是说,在第一客户端和第二客户端对应网关中部署的NAT均为动态型时,难以实现第一客户端和第二客户端之间的互通。
为了解决两个客户端对应的网关中NAT的类型均为动态类型时的客户端互通问题,本申请实施例提出了一种数据处理方法,用于解决两个客户端对应的网关中NAT的类型均为动态类型时的客户端互通问题。其中,本申请实施例所提出的数据处理方法,为了在第一客户端和第二客户端之间建立通信连接,该第一客户端和该第二客户端可分别向对应的第一网关和第二网关发送具备存活时间(Time To Live,TTL)的连接测试包,该连接测试包记录了对方客户端的访问地址(即对方客户端的外部访问地址),基于该存活时间,使得该连接测试包恰好到达本端客户端的网关,而不会到达对方客户端的网关,从而实现在本端客户端的网关中记录下对方客户端的访问地址,因此可实现部署的动态类型NAT的网关在接收到对方客户端发送的请求通信连接的连接数据包后,不将该外部端口映射为随机端口,从而实现对接收到的连接数据包的正确转发,以使该第一客户端和该第二客户端建立通信连接。具体地,该第一客户端和该第二客户端可先分别确定出本客户端访问公有网络时的访问地址,其中,该第一客户端和该第二客户端均是采用的网络穿透协议确定出本客户端进行公有网络访问时的访问地址的,其中,该网络穿透协议例如可以是一种NAT的穿透打洞标准(Session Traversal Utilities for NAT,STUN)协议。由于该第一客户端和该第二客户端是属于不同私有网络的客户端,因此,该第一客户端和该第二客户端无法实现直接通信,但第一客户端为了将该第一客户端的访问地址发送到第二客户端,并获取到该第二客 户端的访问地址,则该第一客户端和第二客户端可通过代理服务器将本端的访问地址发送到对方客户端,其中,该第一客户端,第二客户端和代理服务器之间的连接关系可如图1c所示,该代理服务器为如图1c中由105标记的服务器,则第一客户端101在确定出该第一客户端的访问地址后,通过代理服务器105将该第一客户端的访问地址发送到第二客户端102,该第二客户端102在确定出该第二客户端的访问地址后,则通过该代理服务器105将该第二客户端的访问地址发送到第一客户端101,从而使得第一客户端和第二客户端分别确定出对方客户端的访问地址。
在第一客户端和该第二客户端分别确定出对方客户端的访问地址后,该第一客户端可向第一网关发送携带有第二客户端的访问地址的连接测试包,其中,该第一客户端在向第一网关发送携带该第二客户端的访问地址的连接测试包时,会在该连接测试包的包头文件中记录源地址信息和目的地址信息,该源地址信息即是该第一客户端的内网地址(或客户端地址),目标地址信息即是第二客户端的访问地址,可以理解的是,该第二客户端的访问地址是该第二客户端通过第二网关进行公有网络访问的外网地址,也即是该第二网关的网关地址,那么第一网关在接收到该连接测试包后,则可基于该包头文件中记录的源地址信息和目的地址信息,确定该第二客户端的访问地址,从而使得第一网关实现对第二客户端的访问地址的存储,在该第一网关接收到来自第二网关的连接数据包时,由于第一网关中已记录第二网关的网关地址(即第二客户端的访问地址),所以在接收到来自该第二网关的连接数据包后,该第一网关将基于存储的信息将该连接数据包成功转发到该第一客户端。
同样的,该第二客户端也可向第二网关发送携带有第一客户端的访问地址的连接测试包,从而使得第二网关存储该连接测试包的包头文件中记录的源地址信息和目的地址信息,使得第二网关实现对第一客户端的访问地址的存储,在该第二网关接收到第一网关的连接数据包时,也就同样可实现将该连接数据包成功转发到第二客户端。在具体实现中,如图1d所示,在该第一客户端的第一网关和第二客户端的第二网关均为动态型网关时,在第一客户端和第二客户端之间建立通信连接具体执行如下步骤:
s21,第一客户端通过代理服务器给第二客户端发送建立通信连接的连接请求;
s22,同时第一客户端向第二客户端发送连接测试包,该连接测试包刚好到达第一网关,且在到达该第一网关后该连接测试包的存活时间为0,因此,该第一网关接收到该连接测试包后不再转发该连接测试包到第二客户端,因此,该第二客户端不会接收到该连接测试包。在第一网关接收到该连接测试包后,该第一网关将记录该连接测试包携带的第二客户端的访问地址;
s23,第二客户端在接收到该连接请求后,也可向第二网关发送连接测试包,该连接测试包也恰好到达第二网关,并不再向外转发,该第二网关在接收到该连接测试包后,也将记录该连接测试包携带的第一客户端的访问地址;
s24,第二客户端在向第二网关发送连接测试包后,该动态型的第二网关就可以实现接收第一客户端的数据包了,因此,该第二客户端可通过代理服务器向第一客户端发送地址存储通知消息,以告知第一客户端(或第一网关)该第二网关已存储该第一客户端的访问地址;
s25,第一客户端在接收到该地址存储通知消息后,则可向第二客户端发送连接数据包,该连接数据包可顺利通过第一网关和第二网关,并到达第二客户端;
s26,在第二客户端接收到该第一客户端发送的连接数据包后,可向第一客户端返回接收成功的确认信息,从而实现在第一客户端和第二客户端之间建立通信连接。
请参见图2,是本申请实施例提出的一种数据处理方法的示意流程图,该方法可应用在上述的第一客户端的第一网关中,如图2所示,该方法可包括:
S201,接收第一客户端发送的连接测试包,所述连接测试包中携带第二客户端的访问地址。
在一个实施例中,所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有第一网关,所述第二私有网络设有第二网关,所述第一网关和所述第二网关均为外网网关;所述外网网关部署有网络地址转换协议,所述网络地址转换协议用于将客户端访问私有网络时的客户端地址转换为进行公有网络访问的访问地址,在所述第一客户端访问公有网络时,所述第一网关将所述第一客户端访问所述第一私有网络的客户端地址转换为所述第一客户端的访问地址;所述第二客户端访问所述公有网络时,第二网关将所述第二客户端访问所述第二私有网络的客户端地址转换为所述第二客户端的访问地址。在需要在该第一客户端和第二客户端之间建立通信连接时,该第一网关还可先确定在该第一网关中和第二网关中分别部署的网络地址转换协议的类型,其中,该网络地址转换协议的类型包括动态类型和静态类型,静态类型的网络地址转换协议将内网地址(即客户端地址)转换为固定的外网的访问地址,而动态类型的网络地址转换协议则在进行地址转换时,可能随机映射成不同的访问地址。通过网络地址转换协议,作为外网网关的第一网关和第二网关可以准确的转出第一客户端和第二客户端用于访问公有网络的访问地址,为后续建立第一客户端和第二客户端间的数据连接打下实现基础,提高了建立成功率。
在一个实施例中,该第一客户端可先确定所述第一网关中网络地址转换协议的第一协议类型,以及所述第二网关中网络地址转换协议的第二协议类型,如果所述第一协议类型和所述第二协议类型均属于动态类型,则触发执行从所述第一客户端接收连接测试包的步骤,但是,在该第一协议类型或第二协议类型存在不是动态类型的协议时,也可采用本申请实施例。其中,动态类型的网络地址转换协议的协议特性包括:如果包括该网络地址转换协议的网关中未存储来源客户端的访问地址,那么在接收到来自未存储的来源客户端发送的连接数据包后,在转发该连接数据包时使用的是映射的随机端口,基于随机端口的映射就会存在连接数据包被丢弃的风险,从而导致第一客户端和第二客户端之间打洞失败。为了避免包括动态类型的网络转换地址的网关(即动态类型的NAT网关)在接收到连接数据包后抛弃该连接数据包,从而实现对接收到的连接数据包进行正确转发,可通过在该包括动态类型的网络转换地址的网关中预先存储对方客户端的访问地址进行实现,其中,若第一客户端的第一网关和该第二客户端的第二网关均为包括动态类型的网络转换地址的网关,那么为了保证第一客户端和第二客户端打洞成功,则可先在该第一网关中存储第二客户端的访问地址,以及在该第二网关中存储第一客户端的访问地址,从而实现在包括动态 类型的网络转换地址的网关中存储对方客户端的访问地址,也就可以保证该第一网关和该第二网关在接收到第一客户端发送至第二客户端(或第二客户端发送至第一客户端)的连接数据包时,可将该连接数据包转发到对方客户端,从而实现第一客户端和第二客户端之间的通信连接。
在一个实施例中,该第一网关为了存储该第二客户端的访问地址,可在接收该第一客户端发送携带了第二客户端的访问地址的连接测试包后,从该连接测试包中确定出第二客户端的访问地址,并存储该第二客户端的访问地址,即转而执行S202;那么同样可以理解的是,该第二网关也可从第二客户端中获取携带了第一客户端的访问地址的连接测试包,并从该连接测试包中确定出该第一客户端的访问地址,并存储该第一客户端的访问地址。其中,该第二客户端的访问地址是第一客户端预先从代理服务器获取的,而该代理服务器获取的第二客户端的访问地址则是该第二客户端采用网络穿透协议(如上述STUN协议)确定的,该第一客户端生成携带第二客户端的访问地址的连接测试包的具体方式为:该第二客户端在确定出该第二客户端的访问地址后,通过代理服务器将该第二客户端的访问地址发送给该第一客户端;该第一客户端通过代理服务器获取所述第二客户端向所述第一客户端发送的该第二客户端的访问地址,并将该第二客户端的访问地址添加到该连接测试包中,以及将添加了该第二客户端的访问地址的连接测试包发送给该第一网关。
由于第二客户端的访问地址是该第二客户端采用网络穿透协议确定的,将第二客户端的访问地址携带在连接测试包中提供给第一网关进行存储,为后续建立所述第一客户端和所述第二客户端根据间的通信连接打下了基础。
S202,存储所述连接测试包携带的所述第二客户端的访问地址。
S203,接收所述第一客户端向所述第二客户端发送的连接数据包。
S204,检查是否已接收到所述第二网关发送的第一地址存储通知消息。
S205,当检查结果为是时,通过所述第二网关将接收到的所述连接数据包发送至所述第二客户端,以使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的。
在S202-S205中,该第一网关在接收到第一客户端发送的连接测试包后,由于该连接测试包的包头文件中将记录该连接测试包对应的源地址信息和目的地址信息,那么该第一网关在接收到该连接测试包后,则可基于包头文件的记录确定第二客户端的访问地址,其中,该第一网关和该第一客户端可同属于同一终端设备,或者,该第一网关也可以是独立于该第一客户端所属终端设备的独立设备,在本申请实施例中,对第一网关和第一客户端所属设备之间的关系不做限定。在一个实施例中,该第一网关在确定出该第二客户端的访问地址后,将不再对继续转发该连接测试包,也就是说,该连接测试包仅从第一客户端到达该第一网关即停止,由于该第二网关未存储该第一客户端的访问地址,因此如果该第一网关将该连接测试包继续转发到第二网关,该第二网关将判定该来自第一客户端的连接测试包为陌生连接测试包,并将第一客户端的访问地址拉黑,所以,为了避免该第二网关拉黑第一客户端的访问地址,并使得该第一网关存储该第二客户端的访问地址,该第一网关可为 该连接测试包设置目标路由次数,以使得该连接测试包从该第一客户端出发,恰好到达第一网关即停止转发。
在一个实施例中,所述目标路由次数用于指示所述连接测试包从所述第一客户端出发,并到达所述第一网关经过的内网网关的个数,且每到达一个内网网关,所述目标路由次数则执行减一处理,当该目标路由次数执行减一处理,并到达0时,则停止转发连接数据包。如图3a所示,该第一客户端为如图3a中30标记的客户端,第一网关为如图3a中由34标记的网关,图3a中由31,32和33标记的网关则均为内网网关,那么该第一客户端30在为第一网关34发送连接测试包时,则可先确定需要经过的内网网关的个数,若该第一客户端30所需经过的内网网关的个数为3个,则该第一客户端为连接测试包所设置的目标路由次数则为4,使得该第一客户端30可将连接测试包恰好发送到第一网关34,该第一网关34在接收到该连接测试包后,该目标路由次数将减为0,则该第一网关在接收到该连接测试包后,基于该连接测试包的包头文件可确定出该第二网关的访问地址,并在存储该第二网关的访问地址后,直接丢弃该连接测试包。
在一个实施例中,第一网关在存储该第二客户端的访问地址后,如果接收到该第一客户端发送到第二客户端的连接数据包,其中,该连接数据包用于指示在第一客户端和第二客户端之间建立通信连接,该第一网关在接收到该第一客户端发送到第二客户端的连接数据包后,可先判断第二网关是否已存储该第一客户端的访问地址,其中,第一网关可通过获取该第二网关发送的第一地址存储通知消息,判断该第二网关是否已存储该第一客户端的访问地址。在一个实施例中,若该第一网关接收到该第二网关发送的第一地址存储通知消息,则可确定该第二网关已存储该第一客户端的访问地址,而如果该第一网关未接收到该第二网关发送的第一地址存储通知消息,则可确定该第二网关未存储该第一客户端的访问地址,其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的。如果该第一网关确定接收到该第二网关发送的第一地址存储通知消息,则可通过该第二网关将获取的连接数据包发送给第二客户端,以使得该第一客户端和该第二客户端基于该连接数据包建立通信连接。
在该第一客户端和该第二客户端基于该连接数据包建立通信连接时,该第一网关在通过第二网关将该连接数据包发送到第二客户端后,该第二客户端可在确定接收到该连接数据包后,向第一客户端发送确认接收到该连接数据包的确认消息,至此,该第一客户端和第二客户端完成通信连接。需要说明的是,也可由该第二网关发起第一客户端和第二客户端的通信连接的创建,即是在第二网关存储该第一客户端的访问地址后,从第一网关接收该第一网关已存储该第二客户端的访问地址的通知消息,并进一步将指示在第一客户端和第二客户端之间建立通信连接的连接数据包发送到第一客户端,从而使得第一客户端和第二客户端基于该连接数据包建立通信连接。
在一种可能的实现方式中,第一网关在存储了第二客户端的访问地址后,也可以像第二网关发送第二地址存储通知消息,所述第二地址存储通知消息用于标识所述第一网关在存储了所述第二客户端的访问地址。使得第二客户端需要建立与第一客户端之间的通信连接时,第二网关可以基于获取的第二地址存储通知消息明确第一网关是否成功保存了第二 客户端的访问地址,提高了第一客户端和第二客户端根据间的通信连接的建立成功率。
在本申请实施例中,第一网关可在确定需要在第一客户端和第二客户端之间建立通信连接时,接收该第一客户端发送的连接测试包,从而基于该连接测试的包头文件得到该第二客户端的访问地址,并存储该第二客户端的访问地址,进一步地,该第一网关可确定该第二网关也已存储第一客户端的访问地址时,将第一客户端发送到第二客户端的连接数据包,通过第二网关发送到第二客户端,以使得该第一客户端和该第二客户端之间可基于该连接数据包建立通信连接。由于该第一网关和第二网关中已预先存储了对方客户端的访问地址,因此,连接数据包可顺利通过该第一网关和第二网关进行转发,从而可在第一客户端和第二客户端之间建立通信连接,并由于该连接数据包被第一网关或第二网关丢弃的概率较低,也就可以提升在第一客户端和第二客户端之间建立通信连接的成功率。
在一个实施例中,将采用本申请实施例提出用于实现在第一客户端和第二客户端之间建立通信连接的数据处理方法,和相关技术的建立第一客户端和第二客户端之间通信连接的方法相比,如图3b所示,若采用相关技术建立第一客户端和第二客户端的通信连接,如图3b中由301标记的测试结果可知,使得该第一客户端和该第二客户端成功建立通信连接的概率仅为33%,而采用本申请实施例提出的方法成功建立第一客户端和第二客户端的通信连接的概率则为94%,由此可见,采用本申请实施例提出的数据处理方法,可有效提升第一客户端和第二客户端建立通信连接的成功率。此外,如图3c所示,本申请实施例提出的数据处理方法,还可应用在该第一客户端和第二客户端的网关均为动态NAT时,在该第一客户端和第二客户端之间建立通信连接,且成功建立通信连接的概率为99%,由此可见,采用本申请实施例提出的数据处理方法,可有效提升为第一客户端和第二客户端建立通信连接的成功率。
请参见图4,是本申请实施例提出的一种数据处理方法的示意流程图,该方法可应用在安装了上述第一客户端的终端设备中,如图4所示,该方法可包括:
S401,向第一网关发送连接测试包,所述连接测试包携带第二客户端的访问地址,以使所述第一网关根据所述连接测试包存储所述第二客户端的访问地址。
在一个实施例中,第一客户端在将连接测试包发送给第一网关时,可先通过代理服务器获取所述第二客户端的访问地址,所述第二客户端的访问地址是采用网络穿透协议确定并发送到所述代理服务器的,在获取到该第二客户端的访问地址后,该第一客户端则可将所述第二客户端的访问地址添加到连接测试包中,并向所述第一网关发送添加了所述第二客户端的访问地址的连接测试包,其中,该第一客户端属于所述第一私有网络,所述第二客户端属于所述第二私有网络,该第一私有网络设有所述第一网关,所述第二私有网络设有第二网关,即可以理解,该第一客户端通过该第一网关和公有网络进行通信连接,该第二客户端通过该第二网关和公有网络进行通信连接。由于第二客户端的访问地址是该第二客户端采用网络穿透协议确定的,将第二客户端的访问地址携带在连接测试包中提供给第一网关进行存储,为后续建立所述第一客户端和所述第二客户端根据间的通信连接打下了基础。
同样的,该第二客户端也在该第一客户端与第二客户端需要建立通信连接时,将包括了第一客户端的访问地址的连接测试包发送给第二网关,以使得该第二网关基于连接测试包确定存储该第一客户端的访问地址,从而使得该第一网关和第二网关均实现对对方客户端的访问地址的存储。
为了避免该第二网关拉黑第一客户端的访问地址,并使得该第一网关存储该第二客户端的访问地址,该第一网关可为该连接测试包设置目标路由次数,以使得该连接测试包从该第一客户端出发,恰好到达第一网关即停止转发。在一个实施例中,第一客户端在向第一网关发送连接测试包时,该第一客户端可先确定目标路由次数,所述目标路由次数用于指示所述连接测试包从所述第一客户端出发,并到达所述第一网关经过的内网网关的个数,在该第一客户端确定出该目标路由次数后,可将所述目标路由次数添加到所述连接测试包中,其中,在向第一网关发送连接测试包的过程中,所述连接测试包每到达一个内网网关,所述目标路由次数则被执行减一处理,在所述目标路由次数执行减一处理并取得目标值时到达所述第一网关,其中,该目标值例如可以是0。
任一数据包从所述第一客户端出发,并到达所述第一客户端的第一网关至少经过一个内网网关,该第一客户端在为该连接测试包设置目标路由次数时,可先为连接请求包设置初始路由次数,并根据所述初始路由次数将所述连接请求包发送到目标网关,其中,该连接请求包为一个数据包;进一步地,该第一客户端可从所述目标网关中获取所述目标网关的网关地址,并判断所述网关地址是否为所述第一客户端的访问地址;若确定所述网关地址为所述第一客户端的访问地址,则将所述初始路由次数作为所述目标路由次数。在一个实施例中,若第一客户端确定所述网关地址不是所述第一客户端的访问地址,则对所述初始路由次数执行加一处理;按照加一处理后的初始路由次数转发所述连接请求包,直至获取到所述第一客户端的访问地址,并确定获取到所述第一客户端的访问地址时执行的加一处理的目标次数;根据目标次数更新所述初始路由次数,并将更新后的初始路由次数作为所述目标路由次数,从而实现了准确确定目标路由次数的目的。
具体地,如图5所示,该第一客户端先为该连接请求包设置的路由次数用于指示该连接请求包的存活时间(TTL),若为该连接请求包设置的初始路由次数为1,即TTL=1,那从该第一客户端出发,该连接请求包仅能到达内网网关1,对应的,该第一客户端可从内网网关1中获取到该内网网关1的网关地址1,该网关地址1是该内网网关1确定接收到该连接请求包后反馈给第一客户端的,该第一客户端获取到该网关地址1后,可将该网关地址1和该第一客户端的访问地址进行匹配,由于该网关地址1和该第一客户端的访问地址不同,那么第一客户端确定在目标路由次数为1时,无法将连接请求包发送到连接公有网络的第一网关。进而对该初始路由次数执行加一处理,得到初始路由次数为2,即TTL=2,那么从该第一客户端出发,每经过一个内网网关,该初始路由次数(即TTL)将被进行减一处理,那么可知在TTL=2时,该第一客户端可将该连接请求包发送给内网网关2,并获取到由内网网关2反馈的网关地址2,由于该第一客户端确定该网关地址2依然不是该第一客户端的访问地址,则进一步对该初始路由次数进行加一处理,此时的初始路由次数为3,即TTL=3,那么从该第一客户端出发在TTL=3时,该第一客户端可将该连接请求包发送给第一网关,并获取到 由第一网关反馈的该第一网关的网关地址3,由于该第一网关的网关地址3为该第一客户端的访问地址,则TTL=3为目标次数,第一客户端确定到达第一客户端的第一网关的目标路由次数为3。
S402,检查是否已接收到所述第二网关发送的地址存储通知消息。
S403,当检查结果为是时,向所述第一网关发送针对所述第二客户端的连接数据包,以使所述第一网关通过所述第二网关将所述连接数据包发送至所述第二客户端,从而使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
其中,所述地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的。
在一个实施例中,该第一客户端将连接测试包发送给第一网关,以使该第一网关存储第二客户端的访问地址后,该第一客户端可通过是否接收到第二网关发送的地址存储通知消息,确定出该第二网关是否存储该第一客户端的访问地址,其中,所述地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的。如果该第一客户端确定已接收到该第二网关发送的地址存储通知消息,则可将需要发送给第二客户端的连接数据包发送给第一网关,以使得该第一网关将该连接数据包转发给第二网关,并最后使得第二客户端接收到该连接数据包,从而使得该第一客户端和该第二客户端基于该连接数据包建立通信连接。
在本申请实施例中,第一客户端在需要第一客户端和第二客户端之间建立通信连接时,可将携带有第二客户端的访问地址的连接测试包发送给第一网关,以使该第一网关从该连接测试包获取到该第二客户端的访问地址,并存储该第二客户端的访问地址,从而将第二客户端的访问地址存储到该第一网关中,进一步地,若第一客户端确定第二网关也已存储该第一客户端的访问地址,则可将连接数据包通过该第一网关和第二网关发送到第二客户端,以使得该连接数据包可顺利通过该第一网关和第二网关,并到达第二客户端,使得第一客户端和第二客户端实现基于该连接数据包建立通信连接,并提升了在第一客户端和第二客户端之间创建通信连接的成功率。
基于上述数据处理方法实施例的描述,本申请实施例还提出了一种数据处理装置,该数据处理装置可以是运行于上述第一网关中的一个计算机程序(包括程序代码)。该数据处理装置可用于执行如图2所述的数据处理方法,请参见图6,该数据处理装置包括:接收单元601,确定单元602,存储单元603和发送单元604。
接收单元601,用于接收第一客户端发送的连接测试包,所述连接测试包中携带第二客户端的访问地址;所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有第一网关,所述第二私有网络设有第二网关;
确定单元602,用于确定所述连接测试包携带的所述第二客户端的访问地址;
存储单元603,用于存储所述第二客户端的访问地址;
所述接收单元601还用于接收所述第一客户端向所述第二客户端发送的连接数据包;
所述确定单元602还用于检查是否已接收到所述第二网关发送的第一地址存储通知消 息,其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;
发送单元604,用于所述确定单元602确定已接收到第一地址存储通知消息时,通过所述第二网关将接收到的所述连接数据包发送至所述第二客户端,以使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
在一个实施例中,所述第二客户端的访问地址是采用网络穿透协议确定的;所述接收单元还用于在所述接收所述第一客户端发送的连接测试包之前,通过代理服务器获取所述第二客户端向所述第一客户端发送的所述第二客户端的访问地址。
在一个实施例中,所述第一网关和所述第二网关均为外网网关;
所述外网网关部署有网络地址转换协议,所述网络地址转换协议用于将客户端访问私有网络时的客户端地址转换为进行公有网络访问的访问地址;
其中,在所述第一客户端访问公有网络时,所述第一网关将所述第一客户端访问所述第一私有网络的客户端地址转换为所述第一客户端的访问地址;所述第二客户端访问所述公有网络时,所述第二客户端访问所述第二私有网络的客户端地址被所述第二网关转换为所述第二客户端的访问地址。
在一个实施例中,所述确定单元602,还用于确定所述第一网关中网络地址转换协议的第一协议类型,以及所述第二网关中网络地址转换协议的第二协议类型;
所述接收单元601,还用于若所述第一协议类型和所述第二协议类型均属于动态类型,则触发所述接收单元执行接收所述第一客户端发送的连接测试包。
在一个实施例中,所述连接测试包设置有目标路由次数,所述目标路由次数用于指示所述连接测试包从所述第一客户端达所述第一网关经过的内网网关的个数。
在本申请实施例中,接收单元601可在确定需要在第一客户端和第二客户端之间建立通信连接时,接收该第一客户端发送的连接测试包,从而该确定单元602基于该连接测试的包头文件得到该第二客户端的访问地址,使得存储单元603存储该第二客户端的访问地址,进一步地,确定单元602可确定该第二网关也已存储第一客户端的访问地址时,发送单元604将第一客户端发送到第二客户端的连接数据包,通过第二网关发送到第二客户端,以使得该第一客户端和该第二客户端之间可基于该连接数据包建立通信连接。由于该第一网关和第二网关中已预先存储了对方客户端的访问地址,因此,连接数据包可顺利通过该第一网关和第二网关进行转发,从而可在第一客户端和第二客户端之间建立通信连接,并由于该连接数据包被第一网关或第二网关丢弃的概率较低,也就可以提升在第一客户端和第二客户端之间建立通信连接的成功率。
基于上述数据处理方法实施例的描述,本申请实施例还提出了一种数据处理装置,该数据处理装置配置于前述终端设备中,可以是运行于上述第一客户端中的一个计算机程序(包括程序代码)。该数据处理装置可用于执行如图4所述的数据处理方法,请参见图7,该数据处理装置包括:发送单元701。
发送单元701,用于向第一网关发送连接测试包,所述连接测试包携带所述第二客户端的访问地址,以使所述第一网关根据所述连接测试包存储所述第二客户端的访问地址;第 一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有所述第一网关,所述第二私有网络设有第二网关;
确定单元702,用于检查是否已接收到所述第二网关发送的地址存储通知消息,其中,所述地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;
所述发送单元701,还用于在所述确定单元702确定已接收到所述地址存储通知消息时,向所述第一网关发送所述第二客户端的连接数据包,以使所述第一网关通过所述第二网关将所述连接数据包发送至所述第二客户端,从而使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
在一个实施例中,所述发送单元701,具体用于:
通过代理服务器获取所述第二客户端的访问地址,所述第二客户端的访问地址是采用网络穿透协议确定并发送到所述代理服务器的;
将所述第二客户端的访问地址添加到连接测试包中;
向所述第一网关发送添加了所述第二客户端的访问地址的所述连接测试包。
在一个实施例中,所述装置还包括:确定单元702和添加单元703。
确定单元702,用于确定目标路由次数,所述目标路由次数用于指示所述连接测试包从所述第一客户端出发,并到达所述第一网关经过的内网网关的个数;
添加单元703,用于将所述目标路由次数添加到所述连接测试包中,其中,在所述发送单元701向第一网关发送连接测试包的过程中,所述连接测试包每到达一个内网网关,所述目标路由次数则被执行减一处理,所述连接测试包在所述目标路由次数被执行减一处理后取得目标值时到达所述第一网关。
在一个实施例中,任一数据包从所述第一客户端到达所述第一客户端的第一网关至少经过一个内网网关,所述装置还包括:设置单元704和判断单元705。
设置单元704,用于为连接请求包设置初始路由次数;
所述发送单元701还用于根据所述初始路由次数将所述连接请求包发送到所述第一私有网络的目标网关,所述连接请求包为一个数据包;
判断单元705,用于判断从所述目标网关中获取的所述目标网关的网关地址是否为所述第一客户端的访问地址;
所述确定单元702,还用于若确定所述网关地址为所述第一客户端的访问地址,则将所述初始路由次数作为所述目标路由次数。
在一个实施例中,所述装置还包括:执行单元706和更新单元707。
所述执行单元706,用于若确定所述网关地址不是所述第一客户端的访问地址,则对所述初始路由次数执行加一处理;
所述发送单元701,还用于按照加一处理后的初始路由次数在所述第一私有网络中转发所述连接请求包,直至获取到所述第一客户端的访问地址;
所述确定单元702还用于确定获取到所述第一客户端的访问地址时执行的加一处理的目标次数;
更新单元707,用于根据目标次数更新所述初始路由次数,并将更新后的初始路由次数 作为所述目标路由次数。
在本申请实施例中,在需要第一客户端和第二客户端之间建立通信连接时,发送单元701可将携带有第二客户端的访问地址的连接测试包发送给第一网关,以使该第一网关从该连接测试包获取到该第二客户端的访问地址,并存储该第二客户端的访问地址,从而将第二客户端的访问地址存储到该第一网关中,进一步地,确定第二网关也已存储该第一客户端的访问地址,则发送单元701可将连接数据包通过该第一网关和第二网关发送到第二客户端,以使得该连接数据包可顺利通过该第一网关和第二网关,并到达第二客户端,使得第一客户端和第二客户端实现基于该连接数据包建立通信连接,并提升了在第一客户端和第二客户端之间创建通信连接的成功率。
请参见图8,是本申请实施例提供的一种网关设备的结构示意性框图,其中,该网关设备为上述的第一网关,其中,该网关设备可以是服务器,服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN、以及大数据和人工智能平台等基础云计算服务的云服务器。终端可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表等,但并不局限于此。或者,该网关设备也可以是终端设备。如图8所示的本实施例中的网关设备可包括:一个或多个处理器801;一个或多个输入设备802,一个或多个输出设备803和存储器804。上述处理器801、输入设备802、输出设备803和存储器804通过总线805连接。存储器804用于存储计算机程序,所述计算机程序包括程序指令,处理器801用于执行所述存储器804存储的程序指令。
所述存储器804可以包括易失性存储器(volatile memory),如随机存取存储器(random-access memory,RAM);存储器804也可以包括非易失性存储器(non-volatile memory),如快闪存储器(flash memory),固态硬盘(solid-state drive,SSD)等;存储器804还可以包括上述种类的存储器的组合。
所述处理器801可以是中央处理器(central processing unit,CPU)。所述处理器801还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)等。该PLD可以是现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)等。所述处理器801也可以为上述结构的组合。
本申请实施例中,所述存储器804用于存储计算机程序,所述计算机程序包括程序指令,处理器801用于执行存储器804存储的程序指令,用来实现上述如图2中相应方法的步骤。
在一个实施例中,所述处理器801被配置调用所述程序指令,用于执行:
接收所述第一客户端发送的连接测试包,所述连接测试包中携带所述第二客户端的访问地址;所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有第一网关,所述第二私有网络设有第二网关;
存储所述连接测试包携带的所述第二客户端的访问地址;
当接收到所述第一客户端发送至所述第二客户端的连接数据包时,若已接收到所述第二网关发送的第一地址存储通知消息,则通过所述第二网关将所述连接数据包发送至所述 第二客户端,以使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接;其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的。
请参见图9,是本申请实施例提供的一种终端设备的结构示意性框图,该终端设备为上述的第一客户端。如图9所示的本实施例中的终端设备可包括:一个或多个处理器901;一个或多个输入设备902,一个或多个输出设备903和存储器904。上述处理器901、输入设备902、输出设备903和存储器904通过总线905连接。存储器904用于存储计算机程序,所述计算机程序包括程序指令,处理器901用于执行所述存储器904存储的程序指令。
所述存储器904可以包括易失性存储器(volatile memory),如随机存取存储器(random-access memory,RAM);存储器904也可以包括非易失性存储器(non-volatile memory),如快闪存储器(flash memory),固态硬盘(solid-state drive,SSD)等;存储器904还可以包括上述种类的存储器的组合。
所述处理器901可以是中央处理器(central processing unit,CPU)。所述处理器901还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)等。该PLD可以是现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)等。所述处理器901也可以为上述结构的组合。
本申请实施例中,所述存储器904用于存储计算机程序,所述计算机程序包括程序指令,处理器901用于执行存储器904存储的程序指令,用来实现上述如图4中相应方法的步骤。
在一个实施例中,所述处理器901被配置调用所述程序指令,用于执行:
将连接测试包发送给第一网关,所述连接测试包携带所述第二客户端的访问地址,以使所述第一网关根据所述连接测试包存储所述第二客户端的访问地址;所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有所述第一网关,所述第二私有网络设有第二网关;
若已接收到所述第二网关发送的地址存储通知消息,则将发送至所述第二客户端的连接数据包发送给所述第一网关,以使所述第一网关通过所述第二网关将所述连接数据包发送至所述第二客户端,从而使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接;其中,所述地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的。
本申请实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机程序,该计算机程序存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机程序,处理器执行该计算机程序,使得该计算机设备执行上述如图2或图4所示的方法实施例。其中,所述的计算机可读存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
本申请实施例还提供了一种包括指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例提供的方法。
以上所揭露的仅为本申请的局部实施例而已,当然不能以此来限定本申请之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或局部流程,并依本申请权利要求所作的等同变化,仍属于发明所涵盖的范围。
Claims (17)
- 一种数据处理方法,所述方法由第一网关执行,所述方法包括:接收第一客户端发送的连接测试包,所述连接测试包中携带第二客户端的访问地址;所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有所述第一网关,所述第二私有网络设有第二网关;存储所述连接测试包携带的所述第二客户端的访问地址;接收所述第一客户端向所述第二客户端发送的连接数据包;检查是否已接收到所述第二网关发送的第一地址存储通知消息,其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;当检查结果为是时,通过所述第二网关将接收到的所述连接数据包发送至所述第二客户端,以使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
- 根据权利要求1所述的方法,所述第二客户端的访问地址是采用网络穿透协议确定的;在所述接收第一客户端发送的连接测试包之前,所述方法还包括:通过代理服务器获取所述第二客户端向所述第一客户端发送的所述第二客户端的访问地址。
- 根据权利要求1所述的方法,在所述存储所述连接测试包携带的所述第二客户端的访问地址之后,所述方法还包括:向所述第二网关发送第二地址存储通知消息,所述第二地址存储通知消息用于标识所述第一网关在存储了所述第二客户端的访问地址。
- 根据权利要求1所述的方法,所述第一网关和所述第二网关均为外网网关;所述外网网关部署有网络地址转换协议,所述网络地址转换协议用于将客户端访问私有网络时的客户端地址转换为进行公有网络访问的访问地址;其中,在所述第一客户端访问公有网络时,所述第一网关将所述第一客户端访问所述第一私有网络的客户端地址转换为所述第一客户端的访问地址;所述第二客户端访问所述公有网络时,所述第二客户端访问所述第二私有网络的客户端地址被所述第二网关转换为所述第二客户端的访问地址。
- 根据权利要求4所述的方法,在所述接收第一客户端发送的连接测试包之前,所述方法还包括:确定所述第一网关中网络地址转换协议的第一协议类型,以及所述第二网关中网络地址转换协议的第二协议类型;若所述第一协议类型和所述第二协议类型均属于动态类型,则触发执行所述接收第一客户端发送的连接测试包的步骤。
- 根据权利要求1所述的方法,所述连接测试包设置有目标路由次数,所述目标路由次数用于指示所述连接测试包从所述第一客户端到达所述第一网关经过的内网网关的个数。
- 一种数据处理方法,所述方法由终端设备执行,所述方法包括:向第一网关发送连接测试包,所述连接测试包携带第二客户端的访问地址,以使所述第一网关根据所述连接测试包存储所述第二客户端的访问地址;所述第一客户端属于第一 私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有所述第一网关,所述第二私有网络设有第二网关;检查是否已接收到所述第二网关发送的地址存储通知消息,其中,所述地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;当检查结果为是时,向所述第一网关发送针对所述第二客户端的连接数据包,以使所述第一网关通过所述第二网关将所述连接数据包发送至所述第二客户端,从而使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
- 根据权利要求7所述的方法,所述向第一网关发送连接测试包,包括:通过代理服务器获取所述第二客户端的访问地址,所述第二客户端的访问地址是采用网络穿透协议确定并发送到所述代理服务器的;将所述第二客户端的访问地址添加到连接测试包中;向所述第一网关发送添加了所述第二客户端的访问地址的所述连接测试包。
- 根据权利要求7所述的方法,所述方法还包括:确定目标路由次数,所述目标路由次数用于指示所述连接测试包从所述第一客户端出发,并到达所述第一网关经过的内网网关的个数;将所述目标路由次数添加到所述连接测试包中,其中,在向第一网关发送连接测试包的过程中,所述连接测试包每到达一个内网网关,所述目标路由次数则被执行减一处理,所述连接测试包在所述目标路由次数被执行减一处理后取得目标值时到达所述第一网关。
- 根据权利要求9所述的方法,任一数据包从所述第一客户端到达第一网关至少经过一个内网网关,所述确定目标路由次数,包括:为连接请求包设置初始路由次数;根据所述初始路由次数将所述连接请求包发送到所述第一私有网络的目标网关,所述连接请求包为一个数据包;判断从所述目标网关中获取的所述目标网关的网关地址是否为所述第一客户端的访问地址;若确定所述网关地址为所述第一客户端的访问地址,则将所述初始路由次数作为所述目标路由次数。
- 根据权利要求10所述的方法,所述方法还包括:若确定所述网关地址不是所述第一客户端的访问地址,则对所述初始路由次数执行加一处理;按照加一处理后的初始路由次数在所述第一私有网络中转发所述连接请求包,直至获取到所述第一客户端的访问地址;确定获取到所述第一客户端的访问地址时执行的加一处理的目标次数;根据所述目标次数更新所述初始路由次数,并将更新后的初始路由次数作为所述目标路由次数。
- 一种数据处理装置,所述装置包括:接收单元,用于接收第一客户端发送的连接测试包,所述连接测试包中携带第二客户 端的访问地址;所述第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有第一网关,所述第二私有网络设有第二网关;确定单元,用于确定所述连接测试包携带的所述第二客户端的访问地址;存储单元,用于存储所述第二客户端的访问地址;所述接收单元还用于接收所述第一客户端向所述第二客户端发送的连接数据包;所述确定单元还用于检查是否已接收到所述第二网关发送的第一地址存储通知消息,其中,所述第一地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;发送单元,用于当所述确定单元确定已接收到所述第一地址存储通知消息时,通过所述第二网关将接收到的所述连接数据包发送至所述第二客户端,以使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
- 一种数据处理装置,所述装置包括:发送单元,用于向第一网关发送连接测试包,所述连接测试包携带第二客户端的访问地址,以使所述第一网关根据所述连接测试包存储所述第二客户端的访问地址;第一客户端属于第一私有网络,所述第二客户端属于第二私有网络,所述第一私有网络设有所述第一网关,所述第二私有网络设有第二网关;确定单元,用于检查是否已接收到所述第二网关发送的地址存储通知消息,其中,所述地址存储通知消息是所述第二网关在存储了所述第一客户端的访问地址后发送的;所述发送单元,还用于在所述确定单元确定已接收到所述地址存储通知消息时,向所述第一网关发送针对所述第二客户端的连接数据包,以使所述第一网关通过所述第二网关将所述连接数据包发送至所述第二客户端,从而使得所述第一客户端和所述第二客户端根据所述连接数据包建立通信连接。
- 一种网关设备,包括处理器、输入设备、输出设备和存储器,所述处理器、所述输入设备、所述输出设备和所述存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行如权利要求1~6任一项所述的方法。
- 一种终端设备,包括处理器、输入设备、输出设备和存储器,所述处理器、所述输入设备、所述输出设备和所述存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行如权利要求7~11任一项所述的方法。
- 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括第一程序指令和第二程序指令,所述第一程序指令当被处理器执行时使所述处理器执行如权利要求1~6任一项所述的方法,所述第二程序指令当被处理器执行是使所述处理器执行如权利要求7~11任一项所述的方法。
- 一种包括指令的计算机程序产品,当其在计算机上运行时,使得所述计算机执行权利要求1~6任一项所述的方法,或者执行如权利要求7~11任一项所述的方法。
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP21890952.1A EP4181436B1 (en) | 2020-11-10 | 2021-10-26 | Data processing method and apparatus, related device and storage medium |
JP2023518856A JP7531697B2 (ja) | 2020-11-10 | 2021-10-26 | データ処理方法、装置、関連機器及び記憶媒体 |
US17/965,109 US20230031062A1 (en) | 2020-11-10 | 2022-10-13 | Data processing method and apparatus, related device, and storage medium |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011246040.6 | 2020-11-10 | ||
CN202011246040.6A CN112073540B (zh) | 2020-11-10 | 2020-11-10 | 数据处理方法、装置、相关设备及存储介质 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/965,109 Continuation US20230031062A1 (en) | 2020-11-10 | 2022-10-13 | Data processing method and apparatus, related device, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022100425A1 true WO2022100425A1 (zh) | 2022-05-19 |
Family
ID=73655054
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/126230 WO2022100425A1 (zh) | 2020-11-10 | 2021-10-26 | 数据处理方法、装置、相关设备及存储介质 |
Country Status (5)
Country | Link |
---|---|
US (1) | US20230031062A1 (zh) |
EP (1) | EP4181436B1 (zh) |
JP (1) | JP7531697B2 (zh) |
CN (1) | CN112073540B (zh) |
WO (1) | WO2022100425A1 (zh) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112073540B (zh) * | 2020-11-10 | 2021-02-12 | 腾讯科技(深圳)有限公司 | 数据处理方法、装置、相关设备及存储介质 |
US20220159029A1 (en) * | 2020-11-13 | 2022-05-19 | Cyberark Software Ltd. | Detection of security risks based on secretless connection data |
CN115514572A (zh) * | 2022-09-28 | 2022-12-23 | 泉州砾鹰石科技有限公司 | 一种提高webrtc p2p打洞成功效率的方法 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170208032A1 (en) * | 2016-01-19 | 2017-07-20 | Cisco Technology, Inc. | Method and apparatus for forwarding generic routing encapsulation packets at a network address translation gateway |
WO2018017011A1 (en) * | 2016-07-18 | 2018-01-25 | Sixscape Communications Pte. Ltd. | Apparatus for communication with a second apparatus and method of operation thereof |
CN109951562A (zh) * | 2019-03-29 | 2019-06-28 | 深圳市网心科技有限公司 | Nat穿透方法和系统、电子设备和存储介质 |
CN111193813A (zh) * | 2019-10-24 | 2020-05-22 | 腾讯科技(深圳)有限公司 | 确定nat类型的测试请求处理方法、装置和计算机设备 |
CN111314498A (zh) * | 2020-01-21 | 2020-06-19 | 山东汇贸电子口岸有限公司 | 网络地址转换方法和nat网关 |
CN112073540A (zh) * | 2020-11-10 | 2020-12-11 | 腾讯科技(深圳)有限公司 | 数据处理方法、装置、相关设备及存储介质 |
Family Cites Families (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7676579B2 (en) | 2002-05-13 | 2010-03-09 | Sony Computer Entertainment America Inc. | Peer to peer network communication |
WO2004063843A2 (en) * | 2003-01-15 | 2004-07-29 | Matsushita Electric Industrial Co., Ltd. | PEER-TO-PEER (P2P) CONNECTION DESPITE NETWORK ADDRESS TRANSLATOR (NATs) AT BOTH ENDS |
WO2007125530A2 (en) * | 2006-04-27 | 2007-11-08 | D.S.P. Group Ltd. | Routing path optimization between si p endpoints according to nat topology |
US8631155B2 (en) * | 2007-06-29 | 2014-01-14 | Microsoft Corporation | Network address translation traversals for peer-to-peer networks |
US9124598B2 (en) * | 2011-06-27 | 2015-09-01 | Kaseya Limited | Method and apparatus of establishing a connection between devices using cached connection information |
CN102497446B (zh) * | 2011-12-26 | 2015-04-15 | 杭州华三通信技术有限公司 | 一种穿越nat设备的业务流传输方法及装置 |
CN102685268B (zh) * | 2012-05-22 | 2015-02-18 | 北京邮电大学 | 一种VoIP中基于ICE协议的快速私网穿越方法 |
TWI527407B (zh) * | 2014-03-18 | 2016-03-21 | 國立交通大學 | 會談感知的網路位址轉換穿透方法 |
CN105282264B (zh) * | 2014-07-17 | 2019-01-25 | 中国电信股份有限公司 | 非对称nat环境下进行tcp通信的方法、终端、nps和系统 |
CN106534393B (zh) * | 2015-09-15 | 2019-09-03 | 中国电信股份有限公司 | 实现nat设备穿越的方法和系统 |
PL3703331T3 (pl) * | 2019-02-27 | 2021-08-23 | Ovh | Systemy i sposoby zarządzania siecią |
-
2020
- 2020-11-10 CN CN202011246040.6A patent/CN112073540B/zh active Active
-
2021
- 2021-10-26 EP EP21890952.1A patent/EP4181436B1/en active Active
- 2021-10-26 WO PCT/CN2021/126230 patent/WO2022100425A1/zh unknown
- 2021-10-26 JP JP2023518856A patent/JP7531697B2/ja active Active
-
2022
- 2022-10-13 US US17/965,109 patent/US20230031062A1/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170208032A1 (en) * | 2016-01-19 | 2017-07-20 | Cisco Technology, Inc. | Method and apparatus for forwarding generic routing encapsulation packets at a network address translation gateway |
WO2018017011A1 (en) * | 2016-07-18 | 2018-01-25 | Sixscape Communications Pte. Ltd. | Apparatus for communication with a second apparatus and method of operation thereof |
CN109951562A (zh) * | 2019-03-29 | 2019-06-28 | 深圳市网心科技有限公司 | Nat穿透方法和系统、电子设备和存储介质 |
CN111193813A (zh) * | 2019-10-24 | 2020-05-22 | 腾讯科技(深圳)有限公司 | 确定nat类型的测试请求处理方法、装置和计算机设备 |
CN111314498A (zh) * | 2020-01-21 | 2020-06-19 | 山东汇贸电子口岸有限公司 | 网络地址转换方法和nat网关 |
CN112073540A (zh) * | 2020-11-10 | 2020-12-11 | 腾讯科技(深圳)有限公司 | 数据处理方法、装置、相关设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
EP4181436B1 (en) | 2024-05-01 |
CN112073540A (zh) | 2020-12-11 |
CN112073540B (zh) | 2021-02-12 |
JP7531697B2 (ja) | 2024-08-09 |
US20230031062A1 (en) | 2023-02-02 |
JP2023542398A (ja) | 2023-10-06 |
EP4181436C0 (en) | 2024-05-01 |
EP4181436A1 (en) | 2023-05-17 |
EP4181436A4 (en) | 2023-05-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022100425A1 (zh) | 数据处理方法、装置、相关设备及存储介质 | |
US10630730B2 (en) | NAT traversal for media conferencing | |
US10110714B2 (en) | Methods for exchanging network management messages using UDP over HTTP protocol | |
KR101263783B1 (ko) | 릴레이 서버를 이용한 데이터 전송 시스템 및 방법 | |
CN109412946B (zh) | 一种确定回源路径的方法、装置、服务器及可读存储介质 | |
EP1892887B1 (en) | Communication method between communication devices and communication apparatus | |
US20080215669A1 (en) | System and Method for Peer-to-Peer Connection of Clients Behind Symmetric Firewalls | |
US20110219123A1 (en) | Network firewall and nat traversal for tcp and related protocols | |
JP2018528679A (ja) | 負荷平衡システムにおいて接続を確立するデバイス及び方法 | |
US10530644B2 (en) | Techniques for establishing a communication connection between two network entities via different network flows | |
US20090147795A1 (en) | TCP Traversal Through Network Address Translators (NATS) | |
US10367893B1 (en) | Method and apparatus of performing peer-to-peer communication establishment | |
CN112073545B (zh) | 使用dns来传送服务器设备的mp-tcp能力 | |
JP2016541048A (ja) | サービスプロキシを使用してデータを転送する方法、デバイスおよびシステム | |
JP3999785B2 (ja) | 通信方法 | |
WO2024021714A1 (zh) | 一种网络地址转换nat穿越的方法、设备和系统 | |
US20190141009A1 (en) | Session moderator for turn-pattern tcp-packet relay with websocket instantiation | |
JP6293902B2 (ja) | ブラウザ発信プロシージャのためのモバイルデバイスベースのプロキシ | |
WO2024045857A1 (zh) | 数据传输的方法和装置 | |
JP6930585B2 (ja) | 中継装置、ネットワークシステムおよびネットワーク制御方法 | |
EP3629528A1 (en) | Method and apparatus for forwarding packets from a first network to a second network | |
CN114466008A (zh) | 一种云边通信系统、方法、装置、电子设备及存储介质 | |
CN112118183A (zh) | 一种报文转发方法 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
ENP | Entry into the national phase |
Ref document number: 2021890952 Country of ref document: EP Effective date: 20230209 |
|
ENP | Entry into the national phase |
Ref document number: 2023518856 Country of ref document: JP Kind code of ref document: A |
|
NENP | Non-entry into the national phase |
Ref country code: DE |