Method and device for determining network address translation type and electronic equipment

The client sends detection messages to multiple servers at the same time and analyzes the responses to quickly determine the network address translation type, which solves the problem of low detection efficiency in the existing technology and achieves efficient NAT type identification.

CN118764461AActive Publication Date: 2024-10-11SHUXING TECH (BEIJING) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410968280.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-10-11
Estimated Expiration
2044-07-18

AI Technical Summary

Technical Problem

Existing NAT detection technology is time-consuming and inefficient, requiring the client to send detection messages multiple times to determine the network address translation type.

Method used

The client sends detection messages to the first server and the second server at the same time, and determines the network address translation type according to the received response message, including full cone type, symmetric type, IP address restriction cone type and port restriction cone type.

Benefits of technology

Improves the efficiency of network address translation detection and reduces detection time and waste of system resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764461A_ABST
    Figure CN118764461A_ABST
Patent Text Reader

Abstract

The invention provides a network address translation type determination method and device and electronic equipment, and the method comprises the steps: transmitting a first detection message to a first server based on the address information of the first server, and transmitting a second detection message to a second server based on the address information of the second server; and on the basis of the received response message, determining a conversion type adopted when the network address conversion is performed on the client by the network where the client is located. According to the invention, the conversion type adopted when the network address conversion is carried out on the client by the network where the client is located can be quickly determined, and the network address conversion detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of network address translation, and in particular to a method, device and electronic device for determining a network address translation type. Background Art

[0002] With the rapid development of the Internet, the exhaustion of IPv4 address space has become one of the key factors restricting network expansion. NAT (Network Address Translation) technology has emerged as a mitigation strategy. It allows multiple private IP addresses to share one or a small number of public IP addresses to access the Internet, effectively alleviating the problem of IPv4 address shortage. NAT devices modify the source or destination IP address of data packets, allowing devices on the internal network to communicate with the external network, while hiding the specific structure of the internal network and enhancing network security.

[0003] When executing some network services on the client, different execution strategies need to be adopted according to the conversion type of the network the client is in. Most existing NAT detection technologies rely on specific protocols and require the client to send detection messages to the server multiple times, which is time-consuming and inefficient. Summary of the invention

[0004] The present application provides a method for determining a network address translation type, which is applied to a client, wherein the client is pre-configured with address information of a first server and a second server for determining the network address translation type; the method comprises:

[0005] Sending a first detection message to the first server based on the address information of the first server, and sending a second detection message to the second server based on the address information of the second server; wherein the first detection message is used to instruct the first server to return a first response message and a second response message to the client respectively through the first IP address and the second IP address of the first server; the second detection message is used to instruct the second server to return a third response message and a fourth response message to the client respectively through the first port and the second port of the second server; the response message includes a public IP address and port number obtained by performing network address conversion on the private IP address and port number of the client;

[0006] Receiving response messages returned by the first server and the second server; wherein the received response messages include at least part of the first response message, the second response message, the third response message, and the fourth response message;

[0007] Based on the received response message, determine the conversion type adopted by the network where the client is located when performing network address translation on the client.

[0008] Optionally, the determining, based on the received response message, a conversion type adopted by the network where the client is located when performing network address conversion on the client includes:

[0009] If the client receives the first response message and the second response message, and the public IP address and the port number included in the first response message and the second response message are different from the private IP address and the port number of the client, it is determined that the conversion type adopted by the network where the client is located when performing network address translation on the client is a full cone type;

[0010] If the client receives the first response message and the third response message, and the public IP address and port number included in the first response message are different from the public IP address and port number included in the third response message, it is determined that the conversion type adopted by the network where the client is located when performing network address conversion on the client is symmetric;

[0011] If the client receives the third response message and the fourth response message at the same time, it is determined that the conversion type adopted by the network where the client is located when performing network address translation on the client is IP address restricted cone;

[0012] If the client receives the third response message but does not receive the fourth response message, it is determined that the conversion type adopted by the network where the client is located when performing network address conversion on the client is port restricted cone.

[0013] Optionally, before determining, based on the received response message, a conversion type adopted by the network where the client is located when performing network address conversion on the client, the method further includes:

[0014] Determine whether the client receives response messages returned by the first server and the second server;

[0015] If no response message is received from the first server and the second server, a prompt is output to the user indicating that the network address translation device blocks the communication between the client and the server.

[0016] Optionally, the determining, based on the received response message, a conversion type adopted by the network where the client is located when performing network address conversion on the client includes:

[0017] If the public IP address and port number included in any response message received by the client are the same as the private IP address and port number of the client, a prompt is output to the user indicating that the private IP address of the client has not been subjected to network address translation.

[0018] Optionally, the client runs a custom protocol for determining a network address translation type;

[0019] The sending of a detection message to the server comprises:

[0020] Send a detection message to the server based on the running custom protocol.

[0021] Optionally, the client and the server perform network communication via a specified User Datagram Protocol UDP port;

[0022] Send a detection message to the server, including:

[0023] Send a detection message to the server via the specified UDP port.

[0024] Optionally, the custom protocol is a custom protocol that uses a type-length-value TLV encoding structure as a message structure.

[0025] Optionally, the method further includes:

[0026] In response to determining the conversion type used by the network where the client is located when performing network address translation on the client, uploading the conversion type to the scheduling server, so that the scheduling server allocates a corresponding service node when the client executes a target service based on the conversion type;

[0027] The target service is executed based on the service node allocated by the scheduling server.

[0028] Optionally, the target service includes a video-on-demand service; the client obtains the video-on-demand resource by accessing a content delivery network (CDN); and the service node includes a CDN node;

[0029] The scheduling server allocates a corresponding service node when the client executes the target service based on the conversion type, including:

[0030] The scheduling server determines a CDN node in the CDN network that supports establishing a connection with the client based on the conversion type;

[0031] Executing the target service based on the service node assigned by the scheduling server includes:

[0032] A connection is established between the client and the CDN node, and on-demand resources on the on-demand server are played on demand based on the connection.

[0033] Optionally, the CDN network is a P2P content distribution network PCDN network; and the connection includes a P2P connection.

[0034] The present application also provides a device for determining a network address translation type, which is applied to a client, and the client is pre-configured with address information of a first server and a second server for determining a network address translation type; the device comprises:

[0035] A detection message sending unit, used to send a first detection message to the first server based on the address information of the first server, and to send a second detection message to the second server based on the address information of the second server; wherein the first detection message is used to instruct the first server to return a first response message and a second response message to the client respectively through the first IP address and the second IP address of the first server; the second detection message is used to instruct the second server to return a third response message and a fourth response message to the client respectively through the first port and the second port of the second server; the response message includes a public IP address and port number obtained by performing network address conversion on the private IP address and port number of the client;

[0036] a response message receiving unit, configured to receive response messages returned by the first server and the second server; wherein the received response messages include at least part of the first response message, the second response message, the third response message, and the fourth response message;

[0037] The conversion type detection unit is used to determine, based on the received response message, the conversion type adopted by the network where the client is located when performing network address translation on the client.

[0038] The present application also provides an electronic device, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus;

[0039] The memory stores machine-readable instructions, and the processor executes the above method by calling the machine-readable instructions.

[0040] The present application also provides a computer-readable storage medium, which stores machine-readable instructions. When the machine-readable instructions are called and executed by a processor, the above method is implemented.

[0041] The present application also provides a computer program product, and when the computer program is executed by a processor, the above method is implemented.

[0042] In the scheme recorded in the above embodiment, the client sends a detection message to the first server and the second server respectively, and instructs the first server to return a response message through a different IP address and the second server to return a response message through a different port. Therefore, it is only necessary to send a detection message to each of the two servers once, and based on the response message of the returned server, the conversion type adopted by the network where the client is located when performing network address conversion on the client can be quickly determined, thereby improving the efficiency of network address conversion detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 It is a flowchart of a method for determining a network address translation type in the prior art provided by an exemplary embodiment.

[0044] Figure 2 The network architecture diagram of a method for determining a network address translation type is shown in an exemplary embodiment.

[0045] Figure 3 The present invention is a flowchart of a method for determining a network address translation type according to an exemplary embodiment.

[0046] Figure 4 It is a flowchart of another method for determining a network address translation type provided by an exemplary embodiment.

[0047] Figure 5 It is a timing diagram of a method for determining a network address translation type provided by an exemplary embodiment.

[0048] Figure 6 It is a timing diagram of another method for determining a network address translation type provided by an exemplary embodiment.

[0049] Figure 7 It is a hardware structure diagram of an electronic device where a network address translation type determination device is located, provided by an exemplary embodiment.

[0050] Figure 8 It is a block diagram of a device for determining a network address translation type provided by an exemplary embodiment. DETAILED DESCRIPTION

[0051] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0052] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0053] In order to facilitate the explanation of the method for determining the network address translation type provided in the present application, the method for determining the network address translation type in the prior art is briefly described below.

[0054] In the prior art, the STUN (Session Traversal Utilities for NAT) protocol can usually be used, and the client interacts with the STUN server multiple times to determine the conversion type adopted when the network where the client is located performs NAT conversion on the client.

[0055] See also Figure 1 , Figure 1 It is a flowchart of a method for determining a network address translation type in the prior art provided by an exemplary embodiment.

[0056] Step 102: The client may send a detection message to the STUN server. The detection message may specifically include the private IP address and port number of the client.

[0057] In practical applications, the detection message may specifically be a Binding Request. Binding Request is a basic message type in the STUN protocol. By sending a Binding Request to the STUN server, the client can obtain the public IP address and port number after the client's private IP address is converted through NAT.

[0058] In step 104, the client may determine whether a first response message returned by the first server is received.

[0059] Step 106: If the client does not receive the first response message returned by the first server, it means that the NAT device blocks the communication between the client and the server.

[0060] Step 108: If the client receives the first response message returned by the first server, it can further determine whether the public IP address in the first response message is the same as the private IP address of the client.

[0061] Step 110: If the public IP address in the first response message is the same as the private IP address of the client, it means that the private IP address of the client has not been translated by NAT.

[0062] Step 112: If the public IP address in the first response message is not the same as the private IP address of the client, the client can send a second detection message to the first server again, and let the first server replace another IP address to reply to the second response message.

[0063] Step 114: The client determines whether it has received a second response message returned by the first server.

[0064] Step 116: If the client receives the second response message returned by the first server, it means that after the client sends a request to the external address, the NAT device allows any external address to send a response to the client, so the conversion type is full cone type.

[0065] Step 118: If the client does not receive the second response message returned by the first server, the client may send a third detection message to the second server, so that the second server returns a third response message.

[0066] Step 120: The client determines whether a third response message returned by the second server is received.

[0067] Step 122: If the client determines that it has not received the third response message returned by the second server, it indicates that the NAT device has blocked the communication between the client and the server.

[0068] Step 124: If the client receives the third response message returned by the second server, it can further determine whether the public IP address and port number in the first response message are the same as the public IP address and port number in the third response message.

[0069] Step 126: If the public IP address and port number in the first response message are different from the public IP address and port number in the third response message, it means that the NAT device will create a separate mapping entry for each independent communication pair, so the conversion type is symmetric.

[0070] Step 128, if the public IP address and port number in the first response message are the same as the public IP address and port number in the third response message, the client sends a detection message to the second server and causes the second server to change another port to reply to the fourth response message.

[0071] Step 130: The client determines whether a fourth response message returned by the second server is received.

[0072] Step 132, if the client receives the fourth response message returned by the second server, it means that after the client sends a request to the external address, the NAT device allows any port with the same IP address as the request to send a response to the client, so the conversion type is IP address restricted cone.

[0073] In step 134, if the fourth response message returned by the second server is not received, it means that after the client sends a request to the external address, the NAT device only allows the external address with the same IP address and port as the request to send a response to the client, so the conversion type is port restriction cone.

[0074] In the prior art, if it is necessary to detect the conversion type used by the network where the client is located when performing NAT conversion on the client, the client needs to send four different requests to the first server and the second server respectively, which is time-consuming and wastes system resources.

[0075] In view of this, the present application proposes a technical solution of sending a detection message to the first server and the second server at the same time, and determining the conversion type adopted by the network where the client is located when performing NAT conversion on the client based on the response messages received from the first server and the second server.

[0076] See also Figure 2 , Figure 2 This is a network architecture diagram of a method for determining a network address translation type provided by an exemplary embodiment.

[0077] Figure 2 The system includes a client, a NAT device, a first server and a second server. The client is located in the intranet and needs to communicate with the first server and the second server outside. The NAT device is responsible for converting the private IP address of the client in the intranet into a public IP address so that the client can communicate with the server in the external network. The first server and the second server are used to communicate with the client and determine the type of conversion used when the network where the client is located performs NAT conversion on the client.

[0078] See also Figure 3 , Figure 3This is a flowchart of a method for determining a network address translation type provided by an exemplary embodiment. The method may include the following steps:

[0079] Step 302: Send a first detection message to the first server based on the address information of the first server, and send a second detection message to the second server based on the address information of the second server; wherein the first detection message is used to instruct the first server to return a first response message and a second response message to the client via the first IP address and the second IP address of the first server, respectively; the second detection message is used to instruct the second server to return a third response message and a fourth response message to the client via the first port and the second port of the second server, respectively; the response message includes a public IP address and port number obtained by performing network address conversion on the private IP address and port number of the client.

[0080] In this specification, the client may send a first detection message to a first server and send a second detection message to a second server based on pre-configured address information.

[0081] The first detection message and the second detection message at least include the private IP address and port number of the client, and the first detection message also instructs the first server to return a first response message and a second response message to the client through the first IP address and the second IP address of the first server, respectively. The second detection message is used to instruct the second server to return a third response message and a fourth response message to the client through the first port and the second port of the second server, respectively.

[0082] In actual applications, the server may be deployed on a host with multiple public IP addresses, or as part of a distributed system, each response may come from a different physical server or a different interface of the same server. Therefore, the server can reply to the client response message through different IP addresses and different ports.

[0083] The first IP address may be the IP address of the server used by the client to initiate the detection message, and the second IP address may be another IP address of the server. Similarly, the first port may be the port number of the server used by the client to initiate the detection message, and the second port may be its port number on the server.

[0084] For example, suppose the private IP address of the client is 192.168.1.100 and the port number is 45678; the public IP address after NAT conversion of the private IP address of the client is 203.0.113.42 and the port number is 56789. The IP address and port number of the first server are 52.209.143.78:12345, and the IP address and port number of the second server are 139.59.128.67:23456.

[0085] The client may send a first detection message to the first server based on the IP address and port number 52.209.143.78:12345 of the first server, wherein the first detection message includes the private IP address and port number of the client, 192.168.1.100:45678.

[0086] After the client sends the first detection message, it will first pass through the NAT device. The NAT device will create a new mapping entry to map the private IP address and port in the first detection message to a public IP address and port, that is, 192.168.1.100:45678 to 203.0.113.42:56789, so that the client can communicate with external devices.

[0087] It should be noted that the NAT device will create different mapping entries according to different translation types, so it is necessary to subsequently determine the translation type based on the response message received by the client.

[0088] Further, the NAT device forwards the first detection message to the first server. After receiving the first detection message, the first server generates a first response message and a second response message, wherein the first response message and the second response message both contain the public IP address and port number of the client in the first detection message forwarded by the NAT device.

[0089] Further, the first server can use the IP address and port number of the server used by the client to initiate the detection message, that is, 52.209.143.78:12345, to return a first response message to the client. At the same time, the first server can also use other IP addresses on the server, such as 52.209.143.79:12345, to return a second response message to the client.

[0090] Similarly, the client can also send a second detection message to the second server based on the IP address and port number of the second server 139.59.128.67:23456, wherein the second detection message also includes the client's private IP address and port number, 192.168.1.100:45678.

[0091] After the client sends the second detection message, it will first pass through the NAT device. The NAT device will create a new mapping entry to map the private IP address and port in the second detection message to a public IP address and port, that is, 192.168.1.100:45678 to 203.0.113.42:56789, so that the client can communicate with external devices.

[0092] It should be noted that the NAT device will create different mapping entries according to different translation types, so it is necessary to subsequently determine the translation type based on the response message received by the client.

[0093] Further, the NAT device forwards the second detection message to the second server. After receiving the first detection message, the first server generates a third response message and a fourth response message, wherein the third response message and the fourth response message both contain the public IP address and port number of the client in the first detection message forwarded by the NAT device.

[0094] Further, the second server can use the IP address and port number of the server used by the client to initiate the detection message, that is, 139.59.128.67:23456, to return a third response message to the client. At the same time, the second server can also use other ports on the server, such as 139.59.128.67:23457, to return a fourth response message to the client.

[0095] Step 304: Receive response messages returned by the first server and the second server; wherein the received response messages include at least part of the first response message, the second response message, the third response message and the fourth response message.

[0096] After the first server and the second server generate a response message, the response message will be sent to the NAT device, which will then forward it to the client.

[0097] Based on the different conversion types used when the network in which the client is located performs NAT conversion on the client, the client may receive different response messages, that is, it may receive at least part of the first response message, the second response message, the third response message and the fourth response message.

[0098] Step 306: Based on the received response message, determine the conversion type used by the network where the client is located when performing NAT conversion on the client.

[0099] After receiving at least part of the first response message, the second response message, the third response message and the fourth response message, the client can directly determine the conversion type adopted by the network where the client is located when performing NAT conversion on the client based on the reception status of the response messages and the private IP address and port number of the client contained in the response messages.

[0100] Specifically, if the client receives the first response message and the second response message at the same time, and the public IP address and port number contained in the first response message and the second response message are different from the private IP address and port number of the client, then the conversion type can be a full cone type.

[0101] Among them, full cone means that after the client sends a request to any external address, the NAT device will create a mapping relationship and allow any external address and port to send data to the mapped public IP and port number.

[0102] For example, suppose the private IP address of the client is 192.168.1.100 and the port number is 45678; the public IP address after NAT conversion of the private IP address of the client is 203.0.113.42 and the port number is 56789. The IP address and port number of the first server are 52.209.143.78:12345, and the IP address and port number of the second server are 139.59.128.67:23456.

[0103] The client may send a first detection message to the first server based on the IP address and port number 52.209.143.78:12345 of the first server, wherein the first detection message includes the private IP address and port number of the client, 192.168.1.100:45678.

[0104] At the same time, the client sends a second detection message to the second server based on the IP address and port number 139.59.128.67:23456 of the second server, wherein the second detection message also includes the private IP address and port number of the client, 192.168.1.100:45678.

[0105] After the client sends the first detection message, it will first pass through the NAT device. The NAT device will create a mapping entry to map the private IP address and port in the first detection message to a public IP address and port, that is, 192.168.1.100:45678 to 203.0.113.42:56789.

[0106] Since the translation type is full cone NAT, other external addresses can also send data to the public IP address and port number if this mapping entry exists.

[0107] After receiving the first detection message, the first server can use the IP address and port number of the server used by the client to initiate the detection message, that is, 52.209.143.78:12345, to return a first response message to the client. At the same time, the first server can also use other IP addresses on the server, such as 52.209.143.79:12345, to return a second response message to the client.

[0108] Since it is a full cone NAT, any external address can send data to the public IP address and port number, so the client can receive the first response message and the second response message.

[0109] After receiving the first response message and the second response message, it can be further determined whether the public IP address and port number in the first response message and the second response message are consistent with the private IP address and port number of the client. If they are consistent, it means that the private IP address of the client has not been converted by the conversion type address. If they are inconsistent, it can be determined that the conversion type is a full cone type.

[0110] Further, if the client receives the first response message and the third response message, and the public IP address and port number contained in the first response message are different from the public IP address and port number contained in the third response message, it is determined that the conversion type used by the network where the client is located when performing NAT conversion on the client is symmetric.

[0111] Symmetric means that the NAT device will create a separate mapping entry for each independent communication pair. This means that even if the private IP address and port of the client request are the same, the different destination IP addresses will cause the NAT device to assign different public IP addresses and ports, thus forming two different mapping entries.

[0112] For example, assume that the private IP address of the client is 192.168.1.100 and the port number is 45678. The IP address and port number of the first server are 52.209.143.78:12345, and the IP address and port number of the second server are 139.59.128.67:23456.

[0113] The client may send a first detection message to the first server based on the IP address and port number 52.209.143.78:12345 of the first server, wherein the first detection message includes the private IP address and port number of the client, 192.168.1.100:45678.

[0114] At the same time, the client sends a second detection message to the second server based on the IP address and port number 139.59.128.67:23456 of the second server, wherein the second detection message also includes the private IP address and port number of the client, 192.168.1.100:45678.

[0115] After the client sends the first detection message, it will first pass through the NAT device, which will create a mapping entry to map the private IP address and port in the first detection message to a public IP address and port, that is, 192.168.1.100:45678 to 203.0.113.42:56789. This mapping entry is specially established for the client to access the first server.

[0116] Since the conversion type is symmetric NAT, after the client sends the second detection message, the NAT device will create another mapping entry to map the private IP address and port in the first detection message to a public IP address and port, that is, 192.168.1.100:45678 to 204.0.113.42:56789. This mapping entry is specially established for the client to access the second server.

[0117] After receiving the first detection message, the first server may return a first response message to the client using the IP address and port number of the server used by the client to initiate the detection message, that is, 52.209.143.78:12345.

[0118] After receiving the second detection message, the second server may return a third response message to the client using the IP address and port number of the server used by the client to initiate the detection message, that is, 139.59.128.67:23456.

[0119] Because it is a symmetric NAT, each independent communication has a different mapping entry. Therefore, the client will receive the first response message and the third response message.

[0120] When the first response message and the third response message are received, it can be further determined whether the public IP addresses and port numbers in the first response message and the third response message are consistent.

[0121] Because it is a symmetric NAT, and because the NAT device has established different mapping entries, the public IP address and port number contained in the first response message should be 203.0.113.42:56789, and the public IP address and port number contained in the second response message should be 204.0.113.42:56789. It can be seen that the public IP address and port number in the first response message and the third response message are not consistent.

[0122] Therefore, if the client receives the first response message and the third response message, and the public IP address and port number contained in the first response message are different from the public IP address and port number contained in the third response message, it can be determined that the conversion type used by the network where the client is located when performing NAT conversion on the client is symmetric.

[0123] Further, if the client receives the third response message and the fourth response message at the same time, it can be determined that the target conversion type is the IP address restriction cone type.

[0124] Among them, under the address-restricted cone NAT, once the internal client sends data to a specific external IP address through the NAT device, the NAT device will allow data packets from any port of that IP address to enter. As long as the source IP address of the external response is consistent with the target IP address previously requested by the client, no matter how the port number of the response changes, the response can successfully pass through NAT and be received by the client.

[0125] For example, assume that the private IP address of the client is 192.168.1.100 and the port number is 45678. The IP address and port number of the second server are 139.59.128.67:23456.

[0126] The client sends a second detection message to the second server based on the IP address and port number of the second server, 139.59.128.67:23456, wherein the second detection message also includes the private IP address and port number of the client, 192.168.1.100:45678.

[0127] After the client sends the second detection message, it will first pass through the NAT device, which will create a mapping entry to map the private IP address and port in the first detection message to a public IP address and port, that is, 192.168.1.100:45678 to 203.0.113.42:56789. Since the conversion type is IP address restricted cone, this mapping entry will allow any IP address of 139.59.128.67 to return a response to the client.

[0128] After receiving the second detection message, the second server can use the IP address and port number of the server used by the client to initiate the detection message, that is, 139.59.128.67:23456, to return a third response message to the client. At the same time, the second server can also use other ports on the server, such as 139.59.128.67:23457, to return a fourth response message to the client.

[0129] Because it is an IP address restricted cone NAT, the client initiates a request to the second server's IP address 139.59.128.67 through the NAT device. The NAT device allows any data packet from the IP address 139.59.128.67. Therefore, although the port number changes, the client can still receive all response messages returned by the IP address 139.59.128.67.

[0130] Therefore, if the client receives the third response message and the fourth response message, it can be determined that the conversion type adopted by the network where the client is located when performing NAT conversion on the client is the IP address restricted cone type.

[0131] Further, if the client receives the third response message and does not receive the fourth response message at the same time, it is determined that the target conversion type is the port restriction cone type.

[0132] Among them, the port restriction cone further restricts the entry conditions of external data packets based on the address restriction cone. Under the port restriction NAT, not only the source IP address of the external data packet is required to match the target IP address previously requested by the client, but also the source port number is required to be consistent with the port number used when the client requested. Therefore, only when the source IP address and port of the external response are exactly the same as the target IP address and port number previously requested by the client, can the response pass through NAT and be received by the client.

[0133] For example, assume that the private IP address of the client is 192.168.1.100 and the port number is 45678. The IP address and port number of the second server are 139.59.128.67:23456.

[0134] The client sends a second detection message to the second server based on the IP address and port number of the second server, 139.59.128.67:23456, wherein the second detection message also includes the private IP address and port number of the client, 192.168.1.100:45678.

[0135] After the client sends the second detection message, it will first pass through the NAT device, which will create a mapping entry to map the private IP address and port in the first detection message to a public IP address and port, that is, 192.168.1.100:45678 to 203.0.113.42:56789. Since the conversion type is port restricted cone, this mapping entry will only reply to the external address with IP address 139.59.128.67 and port number 23456.

[0136] After receiving the second detection message, the second server can use the IP address and port number of the server used by the client to initiate the detection message, that is, 139.59.128.67:23456, to return a third response message to the client. At the same time, the second server can also use other ports on the server, such as 139.59.128.67:23457, to return a fourth response message to the client.

[0137] Because it is a port restricted cone NAT, the client sends a request to the second server's IP address and port number 139.59.128.67:23456 through the NAT device, and the NAT device will only receive data packets from the IP address and port number 139.59.128.67:23456. Therefore, although the second server uses 139.59.128.67:23457 to return the fourth response message to the client, the client cannot receive the fourth response message.

[0138] Therefore, if the client receives the third response message but does not receive the fourth response message, it can be determined that the conversion type adopted by the network where the client is located when performing NAT conversion on the client is the port restriction cone type.

[0139] In summary, by determining the response message of the returned server and the content contained in the response message, the conversion type adopted by the network where the client is located when performing NAT conversion on the client can be quickly determined, thereby improving the efficiency of NAT detection.

[0140] In one implementation, it may be determined whether the client receives response messages returned by the first server and the second server.

[0141] If the client does not receive any response messages returned by the first server and the second server, it means that the NAT device may block the communication between the client and the server for various reasons. For example, the port mapping or port forwarding may not be configured correctly on the NAT device. For another example, the mapping relationship assigned by the NAT device times out. For another example, the NAT device may limit the number of simultaneously active connections, and new connection requests exceeding this limit will be rejected.

[0142] Therefore, a prompt that the NAT device blocks the communication between the client and the server can be output to the user, so that the user can solve the corresponding problem and then detect the conversion type adopted when the network where the client is located performs NAT conversion on the client.

[0143] In one embodiment, if the public IP address and port number included in any response message received by the client are the same as the private IP address and port number of the client, it means that the private IP address of the client has not been translated by NAT. Therefore, a prompt indicating that the private IP address of the client has not been translated by NAT can also be output to the user.

[0144] See also Figure 4 , Figure 4 It is a flowchart of another method for determining a network address translation type provided by an exemplary embodiment.

[0145] In step 402, the client may send a first detection message to the first server so that the first server returns a first response message and a second response message. At the same time, the client may send a second detection message to the second server so that the second server returns a third response message and a fourth response message.

[0146] In step 404, the client can determine in real time whether any response message has been received.

[0147] Step 406: If the client does not receive any response message, it means that the NAT device blocks the communication between the client and the server, and a prompt indicating that the NAT device blocks the communication between the client and the server may be output to the user.

[0148] Step 408: After receiving any response message, the client can determine whether the public IP address in the response message is the same as the private IP address of the client.

[0149] Step 410: If the public IP address in any response message is the same as the private IP address of the client, it means that the private IP address of the client has not been translated by NAT, and a prompt indicating that the private IP address of the client has not been translated by NAT can be output to the user.

[0150] In step 412, the client may further determine whether the first response message and the second response message returned by the first server are received at the same time.

[0151] Step 414: If the client receives both the first response message and the second response message returned by the first server, it means that any external address can reply to the client, so the conversion type is full cone type.

[0152] In step 416, the client may further determine whether the first response message returned by the first server and the third response message returned by the second server are received at the same time, and the public IP address in the first response message is different from the public IP address in the third response message.

[0153] Step 418, if the client receives the first response message returned by the first server and the third response message returned by the second server at the same time, and the public IP address in the first response message is different from the public IP address in the third response message, it means that the NAT device will establish a separate mapping entry for each independent communication pair, so the conversion type is symmetric.

[0154] In step 420, the client may further determine whether the third response message and the fourth response message returned by the second server are received at the same time.

[0155] Step 422, if the client receives the third response message and the fourth response message returned by the second server at the same time, it means that the client can receive the response regardless of how the port changes when the IP address remains unchanged, so the conversion type is IP address restricted cone.

[0156] Step 424: If the client only receives the third response message returned by the second server, but does not receive the fourth response message, it means that when the server replies, the client can receive the response only when the IP address and port number are exactly the same as those in the client request. Therefore, the conversion type is port restriction cone.

[0157] See also Figure 5 , Figure 5 It is a timing diagram of a method for determining a network address translation type provided by an exemplary embodiment.

[0158] Step 502: The client may send a first detection message to the first server.

[0159] Step 504: The client may send a second detection message to the second server.

[0160] It should be noted that, in actual applications, there is no particular order in which the client sends the first detection message and the second detection message to the first server and the second server respectively. Figure 5 This is just an exemplary case. In actual application, the client can send the first detection message and the second detection message to the first server and the second server respectively at the same time.

[0161] Step 506: The first server returns a first response message and a second response message.

[0162] Step 508: The second server returns a third response message and a fourth response message.

[0163] In step 510, the client can determine the network address translation type based on the response message returned by the server. The specific determination method will not be repeated here.

[0164] In one embodiment, the client runs a custom protocol specifically designed to detect the type of transition.

[0165] According to the specification of the custom protocol, the client can construct a detection message corresponding to the custom protocol, wherein the detection message can specifically include the client's private IP address and port, and an identifier and data for indicating that the server replies to the response message, etc.

[0166] Using this custom protocol, the client can send a detection message to the first server and the second server, and the server can reply with a corresponding response message according to the corresponding requirements of the protocol. Furthermore, the client can determine the conversion type adopted by the network where the client is located when performing NAT conversion on the client by the content of the response message and whether the response message can be received.

[0167] In one embodiment, the custom protocol is a custom protocol that uses a TLV encoding structure as a message structure. Among them, TLV is a flexible data encapsulation method that can be widely used in various protocols. It usually consists of three parts: Type: a field used to identify the type of data that follows. This allows the protocol to be easily expanded, because new data items can be introduced by simply defining new type values ​​without modifying existing codes or reordering all messages. Length: specifies the byte length of the following Value field, so that the recipient can accurately parse each value. Value: The actual data content carried, its length is determined by the Length field.

[0168] By adopting the TLV encoding structure as the message structure, it is more concise and easier to parse than the STUN protocol, thereby saving bandwidth and computing resources, and thus achieving NAT detection more efficiently.

[0169] In one embodiment, the communication between the client and the server is completed through the UDP protocol, and the UDP port used is clearly specified. The client can send a detection message to the server through the specified UDP port.

[0170] In one embodiment, after determining the conversion type used by the network where the client is located when performing NAT conversion on the client, the conversion type can be uploaded to the scheduling server, so that the scheduling server can allocate the corresponding service node when the client executes the target service based on the conversion type;

[0171] Furthermore, the client may execute the target service based on the service node assigned by the scheduling server.

[0172] Specifically, if the conversion type of the service node is full cone, for the client, the scheduling server can usually allocate any node, and the client can establish a connection with the service node without special processing.

[0173] If the conversion type of the service node is symmetric, since the NAT device assigns a new public IP address and port to each external connection request, it is necessary to rely on a third-party relay server for relaying to help the client establish a connection with the service node.

[0174] If the conversion type of the service node is IP address restricted cone, if the client needs to establish a connection with the service node, it may need to use a third-party relay server or a pre-established channel to assist in completing the connection establishment.

[0175] If the conversion type of the business node is port restriction cone, since the port restriction cone has strict restrictions on the ports of inbound connections, it is also necessary to use existing protocols to discover the client's public network mapping information and use a third-party relay server to assist in establishing the connection.

[0176] In one implementation, the target business involves a VOD service, and the client obtains VOD resources through a CDN (Content Delivery Network).

[0177] The scheduled server can usually intelligently select or allocate a CDN node that can effectively establish a connection. The client can establish a connection with the selected CDN node and obtain the corresponding on-demand resources.

[0178] Once a stable connection is established between the client and the CDN node, the CDN node will act as an intermediary to obtain content from the on-demand server according to the client's on-demand request. The CDN node can optimize the content transmission path based on factors such as network conditions and geographical location to ensure efficient and low-latency resource distribution.

[0179] In one implementation, the CDN network may be a PCDN (Peer-to-Peer Content Delivery Network) network.

[0180] In the PCDN network, each terminal device participating in the P2P network can serve as a CDN node. For example, the user's personal computer, smartphone, smart TV or any other hardware device that can run the corresponding software. These devices are interconnected through the network to form a distributed network, jointly responsible for the storage and distribution of content.

[0181] When one of the users requests on-demand resources, such as watching a video or other media content, the user can act as a CDN node in the PCDN network and obtain data from other CDN nodes that have already downloaded part of the content, rather than downloading it directly from the central server, thereby reducing the load on the central server and improving transmission speed and efficiency.

[0182] In a PCDN network, when a CDN node requests a VOD resource, the scheduling server can allocate other CDN nodes that have downloaded some VOD resources to the node, and establish a P2P connection between the two CDN nodes to obtain the VOD resource.

[0183] Since different CDN nodes have different NAT types, the difficulty of establishing a P2P connection is also different. Therefore, the scheduling server can intelligently select appropriate nodes for allocation, thereby maximizing the success rate of P2P connections. For example, when the conversion type is full cone and address restricted cone, it is easier to directly establish a P2P connection because these types of NAT allow external communications to previously established connections. However, when the conversion type is port restricted cone and symmetric, more complex strategies are required, such as using STUN / TURN servers for NAT penetration, or relying on existing direct channels for relaying to ensure the feasibility of P2P connections. When allocating nodes, the scheduling server can give priority to CDN nodes with conversion types of full cone and address restricted cone, thereby maximizing the success rate of P2P connections and ensuring the efficiency and quality of content transmission, while also reducing unnecessary relay traffic and reducing network costs.

[0184] See also Figure 6 , Figure 6 It is a timing diagram of a method for determining a network address translation type provided by an exemplary embodiment.

[0185] Step 602: The client may send a first detection message to the first server.

[0186] Step 604: The client may send a second detection message to the second server.

[0187] It should be noted that, in actual applications, there is no particular order in which the client sends the first detection message and the second detection message to the first server and the second server respectively. Figure 5 This is just an exemplary case. In actual application, the client can send the first detection message and the second detection message to the first server and the second server respectively at the same time.

[0188] Step 606: The first server returns a first response message and a second response message.

[0189] Step 608: The second server returns a third response message and a fourth response message.

[0190] In step 610, the client can determine the network address translation type based on the response message returned by the server. The specific determination method will not be repeated here.

[0191] Step 612, with Figure 5 The difference is that after the client determines the network address translation type, it can further upload the translation type to the scheduling server, so that the scheduling server can allocate the corresponding CDN node when the client requests on-demand resources.

[0192] Step 614: The client, as a CDN node, may request on-demand resources.

[0193] In step 616, the scheduling server may allocate a CDN node to the client based on the previously acquired conversion type of each CDN node.

[0194] In step 618, the client may establish a P2P connection with the CDN node assigned by the scheduling server, and obtain the on-demand resource based on the established P2P connection.

[0195] In the scheme recorded in the above embodiment, the client sends a detection message to the first server and the second server respectively, and instructs the first server to return a response message through a different IP address and the second server to return a response message through a different port. Therefore, it is only necessary to send a detection message to each of the two servers once, and based on the response message of the returned server, the conversion type adopted by the network where the client is located when performing network address conversion on the client can be quickly determined, thereby improving the efficiency of network address conversion detection.

[0196] See also Figure 7 , Figure 7 It is a hardware structure diagram of an electronic device where a device for determining a network address translation type is located, shown in an exemplary embodiment. At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and of course may also include hardware required for other services. One or more embodiments of this specification can be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0197] See also Figure 8 , Figure 8 is a block diagram of a device for determining a network address translation type according to an exemplary embodiment. The device for determining a network address translation type can be applied to Figure 7 In the electronic device shown in the figure, the technical solution of this specification is implemented. Among them, the above-mentioned network address translation type determination device may include:

[0198] A detection message sending unit 802 is used to send a first detection message to the first server based on the address information of the first server, and to send a second detection message to the second server based on the address information of the second server; wherein the first detection message is used to instruct the first server to return a first response message and a second response message to the client through the first IP address and the second IP address of the first server respectively; the second detection message is used to instruct the second server to return a third response message and a fourth response message to the client through the first port and the second port of the second server respectively; the response message includes a public IP address and a port number obtained by performing a network conversion on the private IP address and the port number of the client;

[0199] A response message receiving unit 604 is used to receive response messages returned by the first server and the second server; wherein the received response messages include at least part of the first response message, the second response message, the third response message and the fourth response message;

[0200] The conversion type detection unit 606 is used to determine, based on the received response message, the conversion type adopted by the network where the client is located when performing network address translation on the client.

[0201] In this embodiment, the conversion type detection unit is further used to determine that the conversion type adopted by the network where the client is located when performing network address translation on the client is a full cone type if the client receives the first response message and the second response message, and the public IP address and the port number included in the first response message and the second response message are different from the private IP address and the port number of the client;

[0202] If the client receives the first response message and the third response message, and the public IP address and the port number included in the first response message are different from the public IP address and the port number included in the third response message, it is determined that the conversion type adopted by the network where the client is located when performing network address translation on the client is symmetric;

[0203] If the client receives the third response message and the fourth response message at the same time, it is determined that the conversion type adopted by the network where the client is located when performing network address translation on the client is IP address restricted cone;

[0204] If the client receives the third response message but does not receive the fourth response message, it is determined that the conversion type adopted by the network where the client is located when performing network address translation on the client is port restricted cone.

[0205] In this embodiment, the device further includes a blocking prompt unit, which is used to determine whether the client has received a response message returned by the first server and the second server;

[0206] If no response message is received from the first server and the second server, a prompt is output to the user indicating that the network address translation device blocks the communication between the client and the server.

[0207] In this embodiment, the conversion type detection unit is further used to output a prompt to the user that the private IP address of the client has not undergone network address translation if the public IP address and port number contained in any response message received by the client are the same as the private IP address and port number of the client.

[0208] In this embodiment, the client runs a custom protocol for determining the type of network address translation;

[0209] The detection message sending unit is used to send a detection message to the server based on the running custom protocol.

[0210] In this embodiment, the client and the server communicate over the network via a specified UDP port;

[0211] The detection message sending unit is used to send a detection message to the server through a designated UDP port.

[0212] In this embodiment, the custom protocol is a custom protocol that uses a TLV encoding structure as a message structure.

[0213] In this embodiment, the device further includes:

[0214] a service execution unit, configured to, in response to determining a conversion type adopted by the network where the client is located when performing network address translation on the client, upload the conversion type to a scheduling server, so that the scheduling server allocates a corresponding service node when the client executes a target service based on the conversion type;

[0215] The target service is executed based on the service node allocated by the scheduling server.

[0216] In this embodiment, the target service includes a video-on-demand service; the client obtains the video-on-demand resource by accessing a content delivery network CDN network; the service node includes a CDN node;

[0217] The scheduling server determines a CDN node in the CDN network that supports establishing a connection with the client based on the conversion type;

[0218] The service execution unit is further used to establish a connection between the client and the CDN node, and to play on-demand resources on the on-demand server based on the connection.

[0219] In this embodiment, the CDN network is a PCDN network; and the connection includes a P2P connection.

[0220] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0221] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.

[0222] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0223] This specification also provides an embodiment of a computer-readable storage medium. The computer-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by a processor, the method for determining the network address translation type provided in any embodiment of this specification can be implemented.

[0224] The computer-readable storage medium provided in the embodiments of this specification may specifically include, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical fiber card. That is, the readable storage medium includes a readable medium that can store or transmit information.

[0225] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0226] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0227] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0228] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0229] This specification also provides an embodiment of a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0230] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0231] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0232] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0233] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0234] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A method for determining a network address translation type, characterized in that: Applied to a client, the client is pre-configured with address information of a first server and a second server for determining a network address translation type; the method comprises: Sending a first detection message to the first server based on the address information of the first server, and sending a second detection message to the second server based on the address information of the second server; wherein the first detection message is used to instruct the first server to return a first response message and a second response message to the client respectively through the first IP address and the second IP address of the first server; the second detection message is used to instruct the second server to return a third response message and a fourth response message to the client respectively through the first port and the second port of the second server; the response message includes a public IP address and port number obtained by performing network address conversion on the private IP address and port number of the client; Receiving response messages returned by the first server and the second server; wherein the received response messages include at least part of the first response message, the second response message, the third response message, and the fourth response message; Based on the received response message, determine the conversion type adopted by the network where the client is located when performing network address translation on the client.

2. The method according to claim 1, characterized in that The determining, based on the received response message, a conversion type adopted by the network where the client is located when performing network address conversion on the client includes: If the client receives the first response message and the second response message, and the public IP address and the port number included in the first response message and the second response message are different from the private IP address and the port number of the client, it is determined that the conversion type adopted by the network where the client is located when performing network address translation on the client is a full cone type; If the client receives the first response message and the third response message, and the public IP address and port number included in the first response message are different from the public IP address and port number included in the third response message, it is determined that the conversion type adopted by the network where the client is located when performing network address conversion on the client is symmetric; If the client receives the third response message and the fourth response message at the same time, it is determined that the conversion type adopted by the network where the client is located when performing network address translation on the client is IP address restricted cone; If the client receives the third response message but does not receive the fourth response message, it is determined that the conversion type adopted by the network where the client is located when performing network address conversion on the client is port restricted cone.

3. The method according to claim 1, characterized in that Before determining, based on the received response message, the conversion type adopted by the network where the client is located when performing network address conversion on the client, the method further includes: Determine whether the client receives response messages returned by the first server and the second server; If no response message is received from the first server and the second server, a prompt is output to the user indicating that the network address translation device blocks the communication between the client and the server.

4. The method according to claim 1, characterized in that: The determining, based on the received response message, a conversion type adopted by the network where the client is located when performing network address conversion on the client includes: If the public IP address and port number included in any response message received by the client are the same as the private IP address and port number of the client, a prompt is output to the user indicating that the private IP address of the client has not been subjected to network address translation.

5. The method according to claim 1, characterized in that The client runs a custom protocol for determining a network address translation type; The sending of a detection message to the server comprises: Send a detection message to the server based on the running custom protocol.

6. The method according to claim 5, characterized in that The client and the server communicate over a network via a specified User Datagram Protocol (UDP) port; Send a detection message to the server, including: Send a detection message to the server via the specified UDP port.

7. The method according to claim 5, characterized in that The custom protocol is a custom protocol that uses a type-length-value TLV encoding structure as a message structure.

8. The method according to claim 1, characterized in that: The method further comprises: In response to determining the conversion type used by the network where the client is located when performing network address translation on the client, uploading the conversion type to the scheduling server, so that the scheduling server allocates a corresponding service node when the client executes a target service based on the conversion type; The target service is executed based on the service node allocated by the scheduling server.

9. The method according to claim 8, characterized in that The target service includes a video-on-demand service; the client obtains video-on-demand resources by accessing a content delivery network (CDN); the service node includes a CDN node; The scheduling server allocates a corresponding service node when the client executes the target service based on the conversion type, including: The scheduling server determines a CDN node in the CDN network that supports establishing a connection with the client based on the conversion type; Executing the target service based on the service node assigned by the scheduling server includes: A connection is established between the client and the CDN node, and on-demand resources on the on-demand server are played on demand based on the connection.

10. The method according to claim 9, characterized in that The CDN network is a P2P content distribution network PCDN network; and the connection includes a P2P connection.

11. A device for determining a network address translation type, characterized in that: Applied to a client, the client is pre-configured with address information of a first server and a second server for determining a network address translation type; the device comprises: A detection message sending unit, used to send a first detection message to the first server based on the address information of the first server, and to send a second detection message to the second server based on the address information of the second server; wherein the first detection message is used to instruct the first server to return a first response message and a second response message to the client through the first IP address and the second IP address of the first server respectively; the second detection message is used to instruct the second server to return a third response message and a fourth response message to the client through the first port and the second port of the second server respectively; the response message includes a public IP address and port number obtained by performing network address conversion on the private IP address and port number of the client; a response message receiving unit, configured to receive response messages returned by the first server and the second server; wherein the received response messages include at least part of the first response message, the second response message, the third response message, and the fourth response message; The conversion type detection unit is used to determine, based on the received response message, the conversion type adopted by the network where the client is located when performing network address translation on the client.

12. An electronic device, characterized in that: It includes a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus; The memory stores machine-readable instructions, and the processor executes the method according to any one of claims 1 to 10 by calling the machine-readable instructions.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by the processor, the method according to any one of claims 1 to 10 is implemented.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Method and system for judging type of network address translation equipment

    CN101651721A

  • NAT type determination method, device and system and storage medium

    CN111935333A

  • Network address translation type detection method and system and electronic equipment

    CN115766654A

  • NAT (Network Address Translation) type detection method and device and electronic equipment

    CN117527655A

  • Techniques to manage a relay server and a network address translator

    US20090316708A1