WO2023061370A1 - 基于中继集群的通信 - Google Patents

基于中继集群的通信 Download PDF

Info

Publication number
WO2023061370A1
WO2023061370A1 PCT/CN2022/124647 CN2022124647W WO2023061370A1 WO 2023061370 A1 WO2023061370 A1 WO 2023061370A1 CN 2022124647 W CN2022124647 W CN 2022124647W WO 2023061370 A1 WO2023061370 A1 WO 2023061370A1
Authority
WO
WIPO (PCT)
Prior art keywords
relay
server
encrypted
field
routing information
Prior art date
Application number
PCT/CN2022/124647
Other languages
English (en)
French (fr)
Inventor
曾柯
陈勇
张洪全
孔令涛
肖涵
秦晓康
杨斌
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2023061370A1 publication Critical patent/WO2023061370A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/54Store-and-forward switching systems 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • H04L61/2589NAT traversal over a relay server, e.g. traversal using relay for network address translation [TURN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1042Peer-to-peer [P2P] networks using topology management mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming

Definitions

  • One or more embodiments of this specification relate to network communication technologies, and in particular to a relay cluster-based communication method and device.
  • the relay server is a server set between two clients to share some operations of the main server, so as to reduce the frequency of reading and writing of the main server and improve the response speed of the main server.
  • two clients that are required to communicate connect to the same relay server.
  • a p2p (Peer to Peer) network scenario two communication clients need to connect to the same relay server based on the TURN (Traversal Using Relays around NAT) protocol, so that the TURN relay server forwards and processes the two Communication data between clients.
  • TURN Traffic Using Relays around NAT
  • One or more embodiments of this specification describe a communication method and device based on a relay cluster, which can provide relay services through multiple relay servers in the relay cluster to meet service requirements.
  • a relay cluster-based communication method includes a load balancing server and at least two relay servers; the communication method is applied to the load balancing server, including: receiving the Relay application message; comprise transaction identification (transaction ID) in this relay application message; Described transaction ID comprises mode field and route information field; According to the value of mode field in the relay application message and the value of route information field Value, obtain the routing information of the first relay server among at least two relay servers; send the relay allocation message carrying the routing information of the first relay server to the client, so that the client The relay channel is established based on the routing information of the relay server.
  • transaction ID transaction ID
  • Described transaction ID comprises mode field and route information field
  • a communication method based on a relay cluster includes a load balancing server and at least two relay servers; the at least two relay servers include a first relay server; the communication The method is applied to the client, including: sending a relay application message to the load balancing server; the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field; so that the load balance
  • the server obtains the routing information of the first relay server according to the value of the mode field and the value of the routing information field in the relay application message; obtains the routing information of the first relay server from the relay distribution message sent by the load balancing server Information; establish a relay channel according to the routing information of the first relay server.
  • a relay cluster-based communication method includes a load balancing server and at least two relay servers; the communication method is applied to the first of the at least two relay servers
  • the relay server includes: receiving the relay application message sent by the load balancing server; sending its own routing information to the load balancing server; enabling the client to establish a relay according to the routing information of the first relay server forwarded by the load balancing server aisle.
  • a communication device based on a relay cluster includes a load balancing server and at least two relay servers; the device is applied to a load balancing server, and includes: a client interaction module configured to Receiving the relay application message sent by the client; the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field; and will carry the routing information of the first relay server
  • the relay allocation message sent to the client so that the client establishes a relay channel according to the routing information of the first relay server; the relay transaction processing module is configured to be based on the value of the mode field in the relay application message and the value of the routing information field, to acquire the routing information of the first relay server among the at least two relay servers.
  • a communication device based on a relay cluster includes a load balancing server and at least two relay servers; the at least two relay servers include a first relay server; the device Applied to the client, including: a relay channel application module configured to send a relay application message to the load balancing server; the relay application message includes a transaction ID; the transaction ID includes a mode field and a route Information field; so that the load balancing server obtains the routing information of the first relay server according to the value of the mode field in the relay application message and the value of the routing information field; the relay channel establishment module is configured to send from the load balancing server Obtain the routing information of the first relay server from the relay allocation message; and establish a relay channel according to the routing information of the first relay server.
  • a communication device based on a relay cluster includes a load balancing server and at least two relay servers; the device is applied to the first relay in the at least two relay servers
  • the server includes: an information sending and receiving module configured to receive a relay application message sent by the load balancing server; a relay channel processing module configured to send the routing information of the first relay server to the load balancing server; so that the client A relay channel is established according to the routing information of the first relay server forwarded by the load balancing server.
  • a computing device including a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, it implements the method described in any embodiment of this specification. method.
  • a relay cluster is established, so that the load balancing server in the relay cluster can be used to distribute the different relay requirements of different clients to at least two relays according to the principle of load sharing server, so as to meet the demand for relay tasks.
  • FIG. 1 is a schematic diagram of communication based on a relay server in a p2p network scenario in the prior art.
  • FIG. 2 is a schematic diagram of a system architecture to which an embodiment of this specification is applied.
  • Fig. 3 shows a flow chart of implementing a communication method based on a relay cluster at a load balancing server in an embodiment of the present specification.
  • Fig. 4 shows a flow chart of implementing a relay cluster-based communication method at a client in an embodiment of the present specification.
  • Fig. 5 shows a flow chart of implementing a relay cluster-based communication method at a first relay server in an embodiment of the present specification.
  • FIG. 6 is a schematic diagram of another system architecture to which an embodiment of this specification is applied.
  • Fig. 7 is a flowchart of establishing a relay channel in an embodiment of the present specification.
  • Fig. 8 is a schematic structural diagram of a device applied to a load balancing server in an embodiment of the present specification.
  • Fig. 9 is a schematic structural diagram of a device applied to a client in an embodiment of the present specification.
  • Fig. 10 is a schematic structural diagram of a device applied to a first relay server in an embodiment of this specification.
  • the system architecture mainly includes clients at both ends that need to communicate (for example, client A1 needs to communicate with client A2, client B1 needs to communicate with client B2, and client C1 needs to communicate with client B2).
  • Client C2 communicates, client D1 needs to communicate with client D2), relay cluster.
  • the relay cluster includes at least one load balancing server and at least two relay servers.
  • Each device interacts through the network.
  • the network may include various connection types, such as wires, wireless communication links, or fiber optic cables.
  • the system applied in the embodiment of the present invention as shown in Figure 2 has set up a relay cluster, so that the load balancing server in the relay cluster can be used to perform load balancing processing, and the different relay requirements of different clients can be allocated to at least two Relay server, so as to meet the demand for relay tasks surge.
  • the routing information of the assigned relay server in the message sent by the client it can be ensured that the clients at both ends of the communication are connected to the same relay server, which meets the specific requirements of the business.
  • the format of each message sent by the client to the relay cluster is redefined, and the message carries the routing information of the relay server serving the client.
  • an implementation manner of redefining the message format to carry the routing information of the relay server is: carrying a newly defined transaction ID (transaction ID) in each message sent by the client.
  • the transaction ID is a "routable" transaction ID. That is, the transaction ID can carry routing information.
  • the newly defined routable transaction ID it can be ensured that two clients that communicate with each other are connected to the same relay server, and the same relay server performs the relay processing of the two clients to meet business requirements.
  • the routable transaction ID includes at least a mode field, and the value of the mode field reflects the allocation of relay servers in different stages of the business.
  • the routable transaction ID may also include a routing information field, and the value of the routing information field reflects the address information of the relay server allocated in different stages of the business.
  • routable transaction ID For example, the structure of a routable transaction ID can be defined as follows:
  • Mode-bit is a mode field
  • Routing-info is a routing information field, and its value may include at least one of the following three methods.
  • the value of the mode field is: a value representing an arbitrary mode.
  • the arbitrary mode means: the message of the client can be sent to the default service port of any relay server in the relay cluster (such as the TURN cluster).
  • the routing information field may not be included.
  • the routing information field can also be included in the routable transaction ID, and its value can be a random character string.
  • Mode 2 The value of the mode field (Mode-bit) is: a value representing a specific server mode.
  • the specific server mode means: the client's message needs to be sent to the default service port of the specified relay server in the relay cluster (such as TURN).
  • the routing information field (Routing-info) is included in the routable transaction ID, and its value is: the relay server designated by the client is recorded as the information of the intranet IP address of the first relay server .
  • Mode 3 the value of the mode field (Mode-bit): a value representing a specific address mode.
  • the specific address mode indicates that the client's message needs to be sent to the designated port of the designated relay server in the relay cluster (such as TURN).
  • the routing information field (Routing-info) is included in the routable transaction ID, and its value is: the information of the intranet IP address of the first relay server allocated to the client and the information of the first relay server Information about the first port of the server.
  • Random-bit is an optional parameter, usually a random string.
  • a communication method based on a relay cluster is implemented at the load balancing server.
  • Fig. 3 shows a flow chart of implementing a communication method based on a relay cluster at a load balancing server in an embodiment of the present specification.
  • the subject of execution of the method may be a load balancing server. It can be understood that the method can also be executed by any device, device, platform, or device cluster that has computing and processing capabilities. Referring to Fig. 3, the method includes the following steps.
  • Step 301 Receive a relay application message from the client; the relay application message includes a transaction ID; the transaction ID includes a mode field and a routing information field.
  • Step 303 Obtain the routing information of the first relay server among the at least two relay servers according to the value of the mode field and the value of the routing information field in the relay application message.
  • Step 305 Send the relay allocation message carrying the routing information of the first relay server to the client, so that the client establishes a relay channel according to the routing information of the first relay server.
  • Embodiment 1 In Embodiment 1, the client in the steps shown in FIG. 3 is the initiator of establishing the relay channel, that is, the first client.
  • the load balancing server receives the relay application message sent by the first client; the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field.
  • step 301 the load balancing server has not assigned a relay server to serve the first client, so the relay application message sent by the first client does not contain information about the designated relay server.
  • the value of the mode field in the transaction ID represents any mode
  • the value of the routing information field in the transaction ID is a random string.
  • the load balancing server obtains the routing information of the first relay server among the at least two relay servers according to the value of the mode field and the value of the routing information field in the relay application message.
  • step 303 includes: step 3031A: the load balancing server parses the relay application message sent by the first client; step 3032A: after analyzing the relay application message When the value of the mode field represents any mode and the value of the routing information field is a random character string, select a relay server from at least two relay servers according to the load balancing principle, and record it as the first relay server; step 3033A: set The relay application message is sent to the default service port of the first relay server; in the embodiment of this specification, the client only needs to directly interact with the load balancing server in the relay cluster without interacting with the relay server in the relay cluster.
  • the server interacts, so the client only needs to obtain the public IP address of the load balancing server without the public IP address of the relay server. Therefore, corresponding to step 3033A, after receiving the relay application message from the first client, the first relay server only needs to indicate to the load balancing server the routing information from the load balancing server to the first relay server, and There is no need to specify routing information from the client to the first relay server. Therefore, the routing information of the first relay server is the routing information in the intranet composed of the relay cluster, and the routing information may include the intranet IP address of the first relay server in the intranet composed of the relay cluster and the intranet IP address of the first relay server.
  • the relay port allocated by a relay server to the session of the first client is recorded as the information of the first port.
  • the transaction ID of each message sent by the client should carry routing information, that is to say, the routing information of the first relay server will be transmitted on the public network. Therefore, in order to improve security, in one embodiment of this specification, the routing information of the first relay server transmitted everywhere may further be encrypted information, such as specifically: the encrypted intranet of the first relay server The IP address and the encrypted first port information. In this way, although each client and the routing device of the network can obtain the routing information of the first relay server, they cannot obtain the specific content of the routing information of the first relay server because each client and routing device does not have a decryption key.
  • the first relay server after the first relay server receives the relay application message, it first encrypts the information of the internal network IP address and the first port respectively, and then encrypts the encrypted internal network IP address and the encrypted The information of the first port is sent to the load balancing server.
  • the first relay server may use a symmetric encryption algorithm such as AES-128-ECB algorithm, CHACHA20-128-ECB or SM4-128-ECB to perform encryption.
  • AES-128-ECB algorithm as an example, the first relay server specifies a 16-byte key and a string of 16-byte data IV, and then uses the AES-128-ECB algorithm and key to encrypt the IV to generate A mask, which will be configured to the load balancing server as a decryption key.
  • the first relay server performs an exclusive-or (xor) operation on the intranet IP address and port information of the local machine in the relay cluster respectively with the mask to obtain encrypted first port information (Encoded -Port) and the encrypted intranet IP address (Encoded-Address).
  • xor exclusive-or
  • Step 3034A Receive the routing information of the first relay server sent by the first relay server.
  • step 305 the load balancing server sends the relay distribution packet carrying the routing information of the first relay server to the first client, so that the first client establishes a trunk channel.
  • the load balancing server may send the relay allocation message carrying the encrypted intranet IP address of the first relay server and the encrypted first port information to the first client.
  • the message format of the relay distribution message is modified, and the encrypted relay address (ENCRYPTED-RELAY-ADDRESS) is set in the relay distribution message, and the ENCRYPTED-RELAY-ADDRESS is used to Carry the encrypted intranet IP address of the first relay server and the encrypted first port information.
  • Encoded-Port is the encrypted port field, which is used to carry the encrypted first port information
  • Encoded-Address is the encrypted address field, which is used to carry the encrypted first relay server’s intranet IP address
  • Attribute-Type It is an attribute type field, and the security routing information is represented by the value of this field, which can be an optional field
  • Reserve-bit is a reserved field for subsequent expansion, and it can be an optional field.
  • the encrypted address field Encoded-Address carries the encrypted intranet IP address of the first relay server
  • the encrypted port field Encoded-Port carries the encrypted first port Information
  • the first client obtains the routing information of the first relay server therefrom.
  • the first client synchronizes the routing information of the first relay server to the second client that needs to communicate with it through the signaling server.
  • the second client also needs to send a relay application message to the load balancing server, so as to trigger the load balancing server to execute the process of establishing a relay channel for the second client (refer to the description of Embodiment 2).
  • the establishment of the relay channel from the first client to the second client is completed. Afterwards, the relay channel can be used to transmit data packets between the first client and the second client.
  • each message sent by the client includes a data message, carrying a newly defined transaction ID (transaction ID), and the transaction ID includes at least a mode field and a routing information field.
  • the load balancing server uses the transaction ID in the data message to send the data message to the first relay server.
  • Embodiment 1 may further include: Step 307: the load balancing server receives the data message sent by the client through the relay channel; the data message includes the mode field in the transaction ID and Routing information field; Step 309: Send the data packet to the first relay server according to the value of the mode field and the value of the routing information field in the data packet, so that the first relay server performs relay processing.
  • the value of the mode field represents a specific address mode
  • the routing information field includes an encrypted address field and an encrypted port field
  • the value of the encrypted address field is the encrypted first relay Intranet IP address of the server
  • the value of the encrypted port field is the encrypted information of the first port.
  • the process of step 309 includes: respectively decrypting the encrypted address field and the encrypted port field in the data message according to the pre-acquired decryption key; Afterwards, according to the decrypted information of the intranet IP address of the first relay server and the first port, the data packet is sent to the first port of the first relay server.
  • the decryption key used by the load balancing server may be configured to the load balancing server when the relay cluster is established.
  • the load balancing server can use the decryption key, that is, the above mask and the values of the Encoded-Port and Encoded-Address fields in the data packet to perform XOR respectively, so as to decrypt the intranet IP address of the first relay server and the IP address of the first port. information.
  • the data message involved in the above step 307 to step 309 may be a data message sent by the first client as the initiator of the establishment of the relay channel, or the second client as the initiator of the establishment of the relay channel Data packets sent from the terminal.
  • the above-mentioned embodiment 1 describes that the load balancing server performs the process of establishing a relay channel as shown in FIG. Message processing.
  • the initiated party (denoted as the second client) that establishes the relay channel also needs to send a relay application message to the load balancing server, and the load balancing server will
  • the file is processed as shown in FIG. 3 . Combining with the structure of the newly defined transaction ID above, the processing is described through Embodiment 2.
  • Embodiment 2 In Embodiment 2, the client in the steps shown in FIG. 3 is the initiated party for establishing the relay channel, that is, the second client.
  • the load balancing server receives the relay application message sent by the second client; the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field.
  • transaction ID transaction ID
  • the transaction ID includes a mode field and a routing information field.
  • the load balancing server obtains the routing information of the first relay server among the at least two relay servers according to the value of the mode field and the value of the routing information field in the relay application message.
  • the relay application message sent by the second client will include the transaction ID.
  • the load balancing server has assigned the first relay server to the session between the first client and the second client, so that the second client and the first client correspond to the same relay cluster
  • the first relay server needs to be specified in the relay application message sent by the second client. Therefore, in the relay application message, the value of the mode field in the transaction ID represents a specific server mode, and the routing information field includes an encrypted address field, and the value of the encrypted address field is the encrypted content of the first relay server. Network IP address.
  • step 303 includes the following steps.
  • Step 3031B The load balancing server parses the relay application message sent by the second client.
  • Step 3032B The load balancing server decrypts the encrypted address field in the relay application message according to the pre-obtained decryption key, and obtains the intranet IP address of the first relay server.
  • Step 3033B After parsing out that the value of the mode field in the relay application message represents a specific server mode, the load balancing server sends the relay application message to the first relay server according to the intranet IP address obtained through decryption. Default service port.
  • step 3033B after the load balancing server parses out that the value of the mode field in the transaction ID represents a specific server mode, it will use the pre-acquired decryption key, that is, the above-mentioned mask to decrypt the value of the routing information field (for example, use mask and Encoded-Address XOR), so as to obtain the intranet IP address of the first relay server, then it can be determined that the message has designated the first relay server. Therefore, according to the decrypted intranet IP address of the first relay server, the relay application message is sent to the default service port of the first relay server.
  • the pre-acquired decryption key that is, the above-mentioned mask to decrypt the value of the routing information field (for example, use mask and Encoded-Address XOR)
  • the first relay server may send the encrypted intranet IP address and the encrypted first port information to the load balancing server.
  • Step 3034B The load balancing server receives the routing information of the first relay server sent by the first relay server.
  • the load balancing server sends the relay assignment message carrying the routing information of the first relay server to the second client, so that the second client can establish a relay distribution packet based on the routing information of the first relay server. following channel.
  • the load balancing server may be a relay distribution report that will carry the encrypted routing information of the first relay server (for example, including the encrypted first relay server's intranet IP address and the encrypted first port information).
  • the text is sent to the second client, which can be carried by the encrypted relay address parameter (ENCRYPTED-RELAY-ADDRESS) as mentioned above in the relay allocation message.
  • ENCRYPTED-RELAY-ADDRESS the encrypted relay address parameter
  • the second client obtains the routing information of the first relay server therefrom.
  • the second client synchronizes the routing information of the first relay server to the first client that needs to communicate with it through the signaling server.
  • the first client and the second client communicating with each other have obtained the routing information of the first relay server. Thereafter, the first client and the second client respectively initiate a link verification process to the load balancing server, and after the verification is passed, the relay channel between the first client and the second client is successfully established. Afterwards, the relay channel can be used to transmit data packets between the first client and the second client.
  • step 307 and step 309 The process of the load balancing server processing the data packets between the first client and the second client has been described in the above-mentioned embodiment 1 through the relevant description of step 307 and step 309 .
  • the above describes the method for realizing the communication of the client based on the relay cluster in the load balancing server of the relay cluster.
  • a communication method based on the relay cluster is implemented at the client side.
  • Fig. 4 shows a flow chart of implementing a relay cluster-based communication method at a client in an embodiment of the present specification.
  • the subject of execution of this method may be a client. It can be understood that the method can also be executed by any device, device, platform, or device cluster that has computing and processing capabilities. Referring to Fig.
  • the method includes: Step 401: the client sends a relay application message to the load balancing server; the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field ; so that the load balancing server obtains the routing information of the first relay server according to the value of the mode field in the relay application message and the value of the routing information field; Step 403: the client sends the relay distribution message from the load balancing server In this article, the routing information of the first relay server is obtained; Step 405: the client establishes a relay channel according to the routing information of the first relay server.
  • Embodiment 3 corresponds to embodiment 1.
  • the execution subject of the steps shown in FIG. 4 is the initiator of establishing the relay channel, that is, the first client.
  • step 401 the first client sends a relay application message to the load balancing server by using the pre-acquired public network IP address of the load balancing server.
  • the value of the mode field represents an arbitrary mode
  • the value of the routing information field is a random character string.
  • the first client obtains the routing information of the first relay server from the relay assignment message sent by the load balancing server.
  • the routing information of the first relay server may be encrypted routing information, including the encrypted intranet IP address of the first relay server and the encrypted address of the first port in the first relay server. information.
  • the relay allocation message includes an encrypted relay address (ENCRYPTED-RELAY-ADDRESS); the ENCRYPTED-RELAY-ADDRESS includes an encrypted address field and an encrypted port field; the present embodiment 4
  • An implementation process of step 403 includes: the first client obtains the encrypted intranet IP address of the first relay server from the encrypted address field of the relay distribution message, and obtains the encrypted port address of the relay distribution message from the encrypted port field of the relay distribution message. Obtain the encrypted information of the first port in .
  • step 405 the first client establishes a relay channel according to the routing information of the first relay server.
  • the first client will synchronize the routing information of the first relay server to the second client through the signaling server.
  • the first client receives the routing information of the first relay server synchronized by the second client through the signaling server, it will initiate a link verification process to the load balancing server. After the verification is passed, the relay channel is established success.
  • the first client sends the data message to the load balancing server through the relay channel, so that the load balancing server sends the data message to the The data packet is forwarded to the first relay server.
  • the routing information field includes an encrypted address field and an encrypted port field; the first client sends the data message
  • the specific process sent to the load balancing server may include: setting the value of the mode field in the data message to represent a specific address mode, and setting the value of the encrypted address field in the data message to the encrypted internal network IP address of the first relay server , and setting the value of the encrypted port field in the data message to the encrypted first port information, and then sending the data message to the load balancing server.
  • the initiator who establishes the relay channel that is, the second client, needs to use the process shown in FIG. 4 to establish the relay channel.
  • the processing is described through Embodiment 4.
  • Embodiment 4 This embodiment 4 corresponds to embodiment 2.
  • the execution subject of the steps shown in FIG. 4 is the initiated party that establishes the relay channel, that is, the second client.
  • step 401 the second client sends a relay application message to the load balancing server by using the pre-acquired public network IP address of the load balancing server.
  • the second client may execute the processing of step 401 after receiving the routing information of the first relay server synchronized by the first client through the signaling server.
  • the value of the mode field in the transaction ID represents a specific server mode
  • the routing information field includes an encrypted address field
  • the encrypted address is the encrypted intranet IP address of the first relay server.
  • step 403 the second client obtains the routing information of the first relay server from the relay assignment message sent by the load balancing server.
  • the routing information of the first relay server may be encrypted routing information, including the encrypted intranet IP address of the first relay server and the encrypted address of the first port in the first relay server. information.
  • the relay allocation message includes an encrypted relay address (ENCRYPTED-RELAY-ADDRESS); the ENCRYPTED-RELAY-ADDRESS includes an encrypted address field and an encrypted port field; the present embodiment 4
  • An implementation process of step 403 includes: the second client obtains the encrypted intranet IP address of the first relay server from the encrypted address field of the relay distribution message, and obtains the encrypted port address of the relay distribution message from the encrypted port field of the relay distribution message. Obtain the encrypted information of the first port in .
  • step 405 the second client establishes a relay channel according to the routing information of the first relay server.
  • the second client will synchronize the routing information of the first relay server to the first client through the signaling server. Afterwards, the second client will initiate a link verification process to the load balancing server, and after the verification is passed, the relay channel is established successfully.
  • the second client sends the data message to the load balancing server through the relay channel, so that the load balancing server sends the data message to the The data packet is forwarded to the first relay server.
  • the routing information field includes an encrypted address field and an encrypted port field; the second client sends the data message
  • the specific process of sending to the load balancing server may include: setting the value of the mode field in the data message to represent a specific address mode, setting the value of the encrypted address field in the data message to the encrypted first relay server's intranet IP address , and setting the value of the encrypted port field in the data message to the encrypted first port information, and then sending the data message to the load balancing server.
  • a communication method based on the relay cluster is implemented in a relay server of the relay cluster.
  • Fig. 5 shows a flow chart of implementing a communication method based on a relay cluster at a relay server in an embodiment of the present specification.
  • the subject of execution of the method may be a relay server, which is described as a first relay server. It can be understood that the method can also be executed by any device, device, platform, or device cluster that has computing and processing capabilities.
  • the method includes: step 501: the first relay server receives the relay application message sent by the load balancing server; step 503: the first relay server sends its own routing information to the load balancing server; so that The client establishes a relay channel according to the routing information of the first relay server forwarded by the load balancing server.
  • the relay application message can be sent by the initiator who establishes the relay channel, that is, the first client through the load balancing server, or it can be sent by the initiated party who establishes the relay channel That is, the second client sends it through the load balancing server.
  • the first relay server receives the relay application message of the first client/second client through a default service port.
  • the routing information of the first relay server in step 503 includes the encrypted intranet IP address of the first relay server and the encrypted first port information.
  • an implementation process of step 503 includes: encrypting the intranet IP address of the first relay server, encrypting the first port
  • the encrypted information is encrypted; the encrypted intranet IP address is carried in the encrypted address field of the encrypted relay address (ENCRYPTED-RELAY-ADDRESS) included in the relay distribution message, and the encrypted first port information is carried in the ENCRYPTED - the encrypted port field of the RELAY-ADDRESS, and then send the relay allocation message to the load balancing server, so that the load balancing server obtains the routing information of the first relay server.
  • the first relay server receives the data message of the first client/second client from the load balancing server through the first port, and performs relay processing on the data message.
  • a relay cluster-based Structural diagram of the communication system includes the following steps.
  • step 1 the first client sends the relay request message in any of the above embodiments to the load balancing server.
  • step 2 the load balancing server returns the relay assignment message in any one of the above embodiments to the first client.
  • step 3 the first client synchronizes the routing information of the first relay server to the second client through the signaling server.
  • step 4 the second client sends the relay application message in any of the above embodiments to the load balancing server.
  • step 5 the load balancing server returns the relay assignment message in any one of the above embodiments to the second client.
  • step 6 the second client synchronizes the routing information of the first relay server to the first client through the signaling server.
  • step 7 the first client initiates a link verification process to the load balancing server.
  • the first client when verifying, the first client will use the transaction ID to carry the routing information of the first relay server, thereby performing verification.
  • step 8 the second client initiates a link verification process to the load balancing server.
  • the second client when verifying, the second client will use the transaction ID to carry the routing information of the first relay server to perform verification.
  • step 9 after the link verification is passed, the relay channel is established successfully.
  • a communication device based on a relay cluster includes a load balancing server and at least two relay servers; referring to FIG. 8, the device is applied to a load balancing server, Including: a client interaction module 801 configured to receive a relay application message sent by the client; the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field; and Send the relay assignment message carrying the routing information of the first relay server to the client, so that the client establishes a relay channel according to the routing information of the first relay server; the relay transaction processing module 802 is configured to The value of the mode field and the value of the routing information field in the relay application message obtains the routing information of the first relay server among the at least two relay servers.
  • a client interaction module 801 configured to receive a relay application message sent by the client
  • the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field;
  • Send the relay assignment message carrying the routing information of the first relay server to
  • the routing information of the first relay server includes the encrypted intranet IP address of the first relay server and the encrypted first relay server Information about the first port in the server; wherein, the intranet IP address is the IP address of the first relay server in the intranet formed by the relay cluster; the first port is the first port allocated for the client The relay port on the relay server.
  • the above-mentioned device set in the balancing server may include at least one of the following embodiments: Embodiment A: In the relay application message, the value of the mode field represents any mode; the value of the routing information field The value is a random string; correspondingly, the relay transaction processing module 802 is configured to execute: when parsing out that the value of the mode field in the relay application message represents any mode and the value of the routing information field is a random string, Select the first relay server from at least two relay servers according to the load balancing principle; send the relay application message to the default service port of the first relay server; and receive the route sent by the first relay server information.
  • Embodiment A In the relay application message, the value of the mode field represents any mode; the value of the routing information field The value is a random string; correspondingly, the relay transaction processing module 802 is configured to execute: when parsing out that the value of the mode field in the relay application message represents any mode and the value of the routing information field is a random string, Select the first relay server
  • Embodiment B In the relay application message, the value of the mode field represents a specific server mode, and the value of the encrypted address field is the encrypted intranet IP address of the first relay server; correspondingly, the relay transaction processing module 802 It is configured to execute: decrypt the encrypted address field in the relay application message according to the pre-acquired decryption key to obtain the intranet IP address of the first relay server; After the value of the mode field represents the specific server mode, according to the obtained intranet IP address, the relay application message is sent to the default service port of the first relay server; and the routing information sent by the first relay server is received. information.
  • Embodiment C the relay transaction processing module 802 is further configured to perform: receiving a data message sent by the client through the relay channel; the data message includes the mode field and the routing information field in the transaction ID; According to the value of the mode field and the value of the routing information field in the data message, the data message is sent to the first relay server.
  • Embodiment D Based on the above embodiment C, in the data message, the value of the mode field represents a specific address mode, and the routing information field includes an encrypted address field and an encrypted port field; wherein, the value of the encrypted address field is the encrypted first The intranet IP address of the relay server; the value of the encrypted port field is the information of the encrypted first port; the relay transaction processing module 802 is configured to execute: according to the pre-acquired decryption key, encrypt the encrypted data in the data message The address field and the encrypted port field are respectively decrypted; and after parsing the value of the mode field in the data message to represent a specific address mode, according to the decrypted first relay server's intranet IP address and the information of the first port, the The data packet is sent to the first port of the first relay server.
  • a communication device based on a relay cluster includes a load balancing server and at least two relay servers; referring to FIG. 9, the device is applied to a client, including:
  • the relay channel application module 901 is configured to send a relay application message to the load balancing server; the relay application message includes a transaction ID (transaction ID); the transaction ID includes a mode field and a routing information field; so that the load
  • the balance server obtains the routing information of the first relay server according to the value of the mode field in the relay application message and the value of the routing information field;
  • the relay channel establishment module 902 is configured as a relay distribution report sent from the load balancing server
  • the routing information of the first relay server is acquired; and the relay channel is established according to the routing information of the first relay server.
  • the routing information of the first relay server includes the encrypted intranet IP address of the first relay server and the encrypted information of the first port of the first relay server; wherein , the intranet IP address is the IP address of the first relay server in the intranet formed by the relay cluster; the first port is a relay port on the first relay server allocated for the client.
  • the relay distribution message includes an encrypted relay address (ENCRYPTED-RELAY-ADDRESS); the ENCRYPTED-RELAY-ADDRESS includes an encrypted address field and an encrypted port field; the relay The channel establishment module 902 is configured to execute: obtain the encrypted intranet IP address of the first relay server from the encrypted address field of the relay allocation message, and obtain the encrypted IP address of the first relay server from the encrypted port field of the relay allocation message. The encrypted information of the first port.
  • the relay channel application module 901 is configured to execute: setting the value of the mode field in the relay application message to represent any mode, and set the value of the routing information field in the relay application message to a random character string, and then send the relay application message to the load balancing server.
  • the routing information field includes an encrypted address field
  • the relay channel application module 901 is configured to execute: setting the The value of the mode field in the relay application message represents a specific server mode, and the value of the encrypted address field in the relay application message is set to the encrypted intranet IP address of the first relay server, and then the relay application The message is sent to the load balancing server.
  • the device may further include: a data processing module configured to send a data packet to a load balancing server through a relay channel, so that the The load balancing server forwards the data message to the first relay server according to the value of the mode field in the transaction ID included in the data message and the value of the routing information field.
  • a data processing module configured to send a data packet to a load balancing server through a relay channel, so that the The load balancing server forwards the data message to the first relay server according to the value of the mode field in the transaction ID included in the data message and the value of the routing information field.
  • the routing information field in the transaction ID includes an encrypted address field and an encrypted port field;
  • the data processing module is configured to perform: setting the value of the mode field in the data message to represent a specific address mode, Set the value of the encrypted address field in the data message to the intranet IP address of the first relay server after encryption, and set the value of the encrypted port field in the data message to the encrypted first port information, and then set The data packet is sent to the load balancing server.
  • a communication device based on a relay cluster includes a load balancing server and at least two relay servers; the device is applied to the at least two relay servers
  • the first relay server includes: an information transceiving module 1001 configured to receive a relay application message sent by a load balancing server; a relay channel processing module 1002 configured to convert the routing information of the first relay server sent to the load balancing server; so that the client establishes a relay channel according to the routing information of the first relay server forwarded by the load balancing server.
  • the relay channel processing module 1002 is configured to execute: encrypt the intranet IP address of the first relay server, encrypt the information of the first port; encrypt the encrypted
  • the intranet IP address is carried in the encrypted address field of the encrypted relay address (ENCRYPTED-RELAY-ADDRESS) included in the relay distribution message, and the encrypted first port information is carried in the encrypted port field of ENCRYPTED-RELAY-ADDRESS, Then send the relay allocation message to the load balancing server, so that the load balancing server obtains the above routing information of the first relay server.
  • each message is a message based on the TURN protocol
  • the relay cluster is a relay cluster established based on the TURN protocol.
  • An embodiment of the present specification provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed in a computer, the computer is instructed to execute the method in any one of the embodiments in the specification.
  • An embodiment of this specification provides a computing device, including a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, the implementation of any one of the embodiments in the specification is implemented. method.
  • the structure shown in the embodiment of the present specification does not constitute a specific limitation on the device of the embodiment of the present specification.
  • the above-mentioned apparatus may include more or less components than those shown in the illustrations, or combine certain components, or separate certain components, or arrange different components.
  • the illustrated components may be realized in hardware, software, or a combination of software and hardware.
  • each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments.
  • the description is relatively simple, and for relevant parts, please refer to part of the description of the method embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本说明书实施例提供了基于中继集群的通信方法和装置。该中继集群包括负载均衡服务器以及至少两个中继服务器。该通信方法包括:接收客户端发来的中继申请报文;该中继申请报文中包括事务标识;所述事务标识包括模式字段以及路由信息字段;根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息;将携带第一中继服务器的路由信息的中继分配报文发送给客户端,以使客户端根据该第一中继服务器的路由信息建立中继通道。本说明书能够通过中继集群中的多个中继服务器提供中继服务,满足业务需求。

Description

基于中继集群的通信 技术领域
本说明书一个或多个实施例涉及网络通信技术,尤其涉及基于中继集群的通信方法和装置。
背景技术
中继服务器是设置在两个客户端之间的服务器,用以分担主服务器的部分操作,以减少主服务器的读写频率,提高主服务器的响应速度。在一些应用场景下,要求进行通信的两个客户端连接到同一个中继服务器。比如,在p2p(Peer to Peer)网络场景中,通信的两个客户端要连接到同一个基于TURN(Traversal Using Relays around NAT)协议的中继服务器,以便由该TURN中继服务器转发处理两个客户端之间的通信数据。
当需要中继的用户量剧增时,单台中继服务器将无法满足业务需求。
发明内容
本说明书一个或多个实施例描述了基于中继集群的通信方法和装置,能够通过中继集群中的多个中继服务器提供中继服务,满足业务需求。
根据第一方面,提供了一种基于中继集群的通信方法,该中继集群包括负载均衡服务器以及至少两个中继服务器;该通信方法应用于负载均衡服务器,包括:接收客户端发来的中继申请报文;该中继申请报文中包括事务标识(transaction ID);所述transaction ID包括模式字段以及路由信息字段;根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息;将携带第一中继服务器的路由信息的中继分配报文发送给客户端,以使客户端根据该第一中继服务器的路由信息建立中继通道。
根据第二方面,提供了一种基于中继集群的通信方法,该中继集群包括负载均衡服务器以及至少两个中继服务器;该至少两个中继服务器中包括第一中继服务器;该通信方法应用于客户端,包括:向负载均衡服务器发送中继申请报文;该中继申请报文中包括事务标识(transaction ID);所述transaction ID包括模式字段以及路由信息字段;以使负载均衡服务器根据该中继申请报文中模式字段的值以及路由信息字段的值获取第一中继服务器的路由信息;从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息;根据第一中继服务器的路由信息,建立中继通道。
根据第三方面,提供了一种基于中继集群的通信方法,该中继集群包括负载均衡服务器以及至少两个中继服务器;该通信方法应用于该至少两个中继服务器中的第一中继服务器,包括:接收负载均衡服务器发来的中继申请报文;将自身的路由信息发送给负载均衡服务器;以使客户端根据负载均衡服务器转发的第一中继服务器的路由信息建立 中继通道。
根据第四方面,提供了一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;该装置应用于负载均衡服务器,包括:客户端交互模块,配置为接收客户端发来的中继申请报文;该中继申请报文中包括事务标识(transaction ID);所述transaction ID包括模式字段以及路由信息字段;以及将携带第一中继服务器的路由信息的中继分配报文发送给客户端,以使客户端根据该第一中继服务器的路由信息建立中继通道;中继事务处理模块,配置为根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息。
根据第五方面,提供了一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;该至少两个中继服务器中包括第一中继服务器;该装置应用于客户端,包括:中继通道申请模块,配置为向负载均衡服务器发送中继申请报文;该中继申请报文中包括事务标识(transaction ID);所述transaction ID包括模式字段以及路由信息字段;以使负载均衡服务器根据该中继申请报文中模式字段的值以及路由信息字段的值获取第一中继服务器的路由信息;中继通道建立模块,配置为从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息;以及根据第一中继服务器的路由信息,建立中继通道。
根据第六方面,提供了一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;该装置应用于该至少两个中继服务器中的第一中继服务器,包括:信息收发模块,配置为接收负载均衡服务器发来的中继申请报文;中继通道处理模块,配置为将第一中继服务器的路由信息发送给负载均衡服务器;以使客户端根据负载均衡服务器转发的第一中继服务器的路由信息建立中继通道。
根据第七方面,提供了一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现本说明书任一实施例所述的方法。
本说明书实施例提供的方法及装置中,组建了中继集群,这样,就可以利用中继集群中的负载均衡服务器将不同客户端的不同中继需求按照负载分担的原则分配到至少两个中继服务器上,从而满足中继任务剧增的需求。
附图说明
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本说明书的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是现有技术中在p2p网络场景中基于中继服务器进行通信的示意图。
图2是本说明书一个实施例所应用到的系统架构的示意图。
图3示出了本说明书一个实施例中在负载均衡服务器处实现基于中继集群的通信方法的流程图。
图4示出了本说明书一个实施例中在客户端处实现基于中继集群的通信方法的流程图。
图5示出了本说明书一个实施例中在第一中继服务器处实现基于中继集群的通信方法的流程图。
图6是本说明书一个实施例所应用到的另一种系统架构的示意图。
图7是本说明书一个实施例中建立中继通道的流程图。
图8是本说明书一个实施例中应用于负载均衡服务器的装置结构示意图。
图9是本说明书一个实施例中应用于客户端的装置的结构示意图。
图10是本说明书一个实施例中应用于第一中继服务器的装置结构示意图。
具体实施方式
如前所述,在一些应用场景下,要求进行通信的两个客户端连接到同一个中继服务器。比如,参见图1,在p2p网络场景中,因为通信的两个客户端要连接到同一个TURN(Traversal Using Relays around NAT)中继服务器,这样,就会出现大量客户端连接到同一个中继服务器,由该同一个中继服务器进行大量中继处理的情况。比如图1中,需要通信的客户端A1与客户端A2、客户端B1与客户端B2、客户端C1与客户端C2、客户端D1与客户端D2均需要连接到TURN中继服务器1,这样就导致TURN中继服务器1的负荷过重。
下面结合附图,对本说明书提供的方案进行描述。
为了方便对本说明书的理解,首先对本说明书所应用的系统架构进行描述。如图2中所示,该系统架构主要包括需要进行通信的两端的客户端(比如,客户端A1需要与客户端A2进行通信,客户端B1需要与客户端B2进行通信,客户端C1需要与客户端C2进行通信,客户端D1需要与客户端D2进行通信)、中继集群。该中继集群中包括至少一个负载均衡服务器以及至少两个中继服务器。各个设备通过网络交互。其中,网络可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等。
如图2所示的本发明实施例应用的系统,组建了中继集群,这样,就可以利用中继集群中的负载均衡服务器进行负载均衡处理,将不同客户端的不同中继需求分配到至少两个中继服务器上,从而满足中继任务剧增的需求。同时,利用在客户端发送的报文中携带被分配的中继服务器的路由信息的方式,可以保证通信的两端客户端连接到同一个中继服务器上,满足了业务的特定要求。
在本说明书的实施例中,对于客户端发给中继集群的各个报文的格式进行了重新定 义,在该报文中携带为客户端服务的中继服务器的路由信息。
在本说明书一个实施例中,对报文格式重新定义以便携带中继服务器的路由信息的一种实现方式为:在客户端发送的各个报文中携带新定义的事务标识(transaction ID)。该transaction ID是一种“可路由的”transaction ID。即该transaction ID可以携带路由信息。通过新定义的可路由的transaction ID,可以保证相互通信的两个客户端连接到同一个中继服务器上,由同一个中继服务器进行该两个客户端的中继处理,满足业务要求。
可路由的transaction ID中至少包括模式字段,通过该模式字段的值来体现业务不同阶段中对中继服务器的分配情况。
可路由的transaction ID中还可以包括路由信息字段,通过该路由信息字段的值来体现业务不同阶段中分配的中继服务器的地址信息。
比如,可路由的transaction ID的结构体可以定义为如下形式:
Figure PCTCN2022124647-appb-000001
Mode-bit为模式字段,Routing-info为路由信息字段,其取值可以包括如下3种方式中的至少一种。
方式1、模式字段(Mode-bit)的取值为:表征任意模式的取值。该任意模式表示:客户端的报文可以被发往中继集群(比如TURN集群)中任意中继服务器的默认服务端口。在该任意模式下,因为还未指定为客户端服务的第一中继服务器,因此可以不包括路由信息字段。当然,在该任意模式下,可路由的transaction ID中也可以包括路由信息字段(Routing-info),其取值可以为一个随机字符串。
方式2、模式字段(Mode-bit)的取值为:表征特定服务器模式的取值。特定服务器模式表示:客户端的报文需要被发往中继集群(如TURN)中指定中继服务器的默认服务端口。在该特定服务器模式下,可路由的transaction ID中包括路由信息字段(Routing-info),其取值为:为客户端指定的中继服务器记为第一中继服务器的内网IP地址的信息。
方式3、模式字段(Mode-bit)的取值为:表征特定地址模式的取值。特定地址模式表示:客户端的报文需要被发往中继集群(如TURN)中指定中继服务器的指定端口。在该特定地址模式下,可路由的transaction ID中包括路由信息字段(Routing-info),其取值为:为客户端分配的第一中继服务器的内网IP地址的信息以及第一中继服务器的第一端口的信息。
可路由的transaction ID的结构体中,Random-bit为可选的参数,通常为一个随机字符串。
下面结合上述在报文中新定义的transaction ID,来分别说明本发明实施例在每一种设备中实现基于中继集群的通信方法的过程。
一、在负载均衡服务器处实现基于中继集群的通信方法。
图3示出了本说明书一个实施例中在负载均衡服务器处实现基于中继集群的通信方法的流程图。该方法的执行主体可以为负载均衡服务器。可以理解,该方法也可以通过任何具有计算、处理能力的装置、设备、平台、设备集群来执行。参见图3,该方法包括以下步骤。
步骤301:接收客户端发来的中继申请报文;该中继申请报文中包括事务标识(transaction ID);该transaction ID包括模式字段以及路由信息字段。
步骤303:根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息。
步骤305:将携带第一中继服务器的路由信息的中继分配报文发送给客户端,以使客户端根据该第一中继服务器的路由信息建立中继通道。
相互通信的两个客户端需要建立中继通道。在中继通道建立流程的初始阶段,建立中继通道的发起方(记为第一客户端)需要向负载均衡服务器发送中继申请报文,负载均衡服务器会根据第一客户端发来的中继申请文件进行图3所示的处理。结合上述新定义的transaction ID的结构,通过实施例1来说明该处理。
实施例1:在实施例1中,图3所示步骤中的客户端为建立中继通道的发起方,即第一客户端。
首先,在步骤301中负载均衡服务器接收第一客户端发来的中继申请报文;该中继申请报文中包括事务标识(transaction ID);该transaction ID包括模式字段以及路由信息字段。
执行到步骤301,负载均衡服务器还没有给第一客户端分配为其服务的中继服务器,因此第一客户端发来的中继申请报文中没有指定的中继服务器的信息。在该中继申请报文中,transaction ID中的模式字段的值表征任意模式,transaction ID中的路由信息字段的值为随机字符串。
接下来,在步骤303中负载均衡服务器根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息。
在本发明实施例1的一种实现方式中,步骤303包括:步骤3031A:负载均衡服务器对第一客户端发来的中继申请报文进行解析;步骤3032A:在解析出中继申请报文中模式字段的值表征任意模式且路由信息字段的值为随机字符串时,按照负载均衡原则从 至少两个中继服务器中选择一个中继服务器,记为第一中继服务器;步骤3033A:将中继申请报文发送到第一中继服务器的默认服务端口;在本说明书实施例中,客户端只需要直接与中继集群中的负载均衡服务器交互,而无需与中继集群中的中继服务器交互,因此,客户端只需要获取负载均衡服务器的公网IP地址即可,而无需中继服务器的公网IP地址。因此,对应步骤3033A,第一中继服务器在接收到第一客户端的中继申请报文后,只需要向负载均衡服务器指明从负载均衡服务器到该第一中继服务器的路由信息即可,而无需指明从客户端到第一中继服务器的路由信息。因此,第一中继服务器的路由信息是在中继集群组成的内网中的路由信息,该路由信息可以包括第一中继服务器在中继集群组成的内网中的内网IP地址以及第一中继服务器为第一客户端的会话分配的中继端口记为第一端口的信息。
进一步地,如前所述,在客户端发出的各个报文的transaction ID中要携带路由信息,也就是说,第一中继服务器的路由信息会在公网上进行传输。因此,为了提高安全性,在本说明书一个实施例中,各处传输的第一中继服务器的路由信息进一步可以是加密后的信息,比如具体为:加密后的第一中继服务器的内网IP地址以及加密后的第一端口的信息。这样,各个客户端及网络的路由设备虽然能够得到第一中继服务器的路由信息,但是由于各个客户端及路由设备没有解密密钥,也无法得到第一中继服务器的路由信息的具体内容。相应地对应于步骤3033A,第一中继服务器接收到中继申请报文后,首先将内网IP地址以及第一端口的信息分别进行加密,再把加密后的内网IP地址以及加密后的第一端口的信息发送给负载均衡服务器。
其中,第一中继服务器可以采用对称加密算法如AES-128-ECB算法、CHACHA20-128-ECB或者SM4-128-ECB等进行加密。以采用AES-128-ECB算法为例,第一中继服务器指定一个16字节的key,以及一串16字节的数据IV,然后使用AES-128-ECB算法以及key对IV进行加密,生成一个mask,该mask作为解密密钥会配置给负载均衡服务器。步骤3037中,第一中继服务器将本机在中继集群中的内网IP地址和端口信息分别与该mask进行异或(xor)操作,即可得到加密后的第一端口的信息(Encoded-Port)和加密后的内网IP地址(Encoded-Address)。
步骤3034A:接收第一中继服务器发来的第一中继服务器的路由信息。
接下来,在步骤305中负载均衡服务器将携带第一中继服务器的路由信息的中继分配报文发送给第一客户端,以使第一客户端根据该第一中继服务器的路由信息建立中继通道。
负载均衡服务器可以是将携带有加密后的第一中继服务器的内网IP地址以及加密后的第一端口的信息的中继分配报文发送给第一客户端。
在本说明书一个实施例中,对中继分配报文的报文格式进行了修改,在中继分配报文中设置加密中继地址(ENCRYPTED-RELAY-ADDRESS),通过该ENCRYPTED-RELAY-ADDRESS来携带加密后的第一中继服务器的内网IP地址以及加 密后的第一端口的信息。
比如,ENCRYPTED-RELAY-ADDRESS的结构体格式为:
Figure PCTCN2022124647-appb-000002
其中:Encoded-Port为加密端口字段,用于携带加密后的第一端口的信息;Encoded–Address为加密地址字段,用于携带加密后的第一中继服务器的内网IP地址;Attribute-Type为属性类型字段,通过该字段的值表征安全路由信息,其可以为可选字段;Reserve-bit为保留字段,用于后续扩展使用,其可以为可选字段。
因此,在本步骤305的中继分配报文中,加密地址字段Encoded–Address携带有加密后的第一中继服务器的内网IP地址,加密端口字段Encoded-Port携带有加密后的第一端口的信息。
此后,第一客户端收到中继分配报文后,从中获取第一中继服务器的路由信息。在一些应用场景中,比如基于TURN协议实现的中继通道的建立过程中,第一客户端通过信令服务器将该第一中继服务器的路由信息同步给需要与其进行通信的第二客户端。第二客户端则也需要向负载均衡服务器发送中继申请报文,以便触发负载均衡服务器针对第二客户端执行建立中继通道的过程(可以参见实施例2的描述)。
在第一客户端及第二客户端都获取了第一中继服务器的路由信息之后,则完成了在第一客户端至第二客户端的中继通道的建立。此后,则可以利用该中继通道传输第一客户端与第二客户端之间的数据报文。
如前所述,客户端发送的各个报文其中包括数据报文,携带有新定义的事务标识(transaction ID),transaction ID中至少包括模式字段以及路由信息字段。负载均衡服务器利用数据报文中的transaction ID将该数据报文发送给第一中继服务器。相应地,在上述步骤305之后,实施例1还可以包括:步骤307:负载均衡服务器接收客户端通过中继通道发来的数据报文;该数据报文包括所述transaction ID中的模式字段以及路由信息字段;步骤309:根据数据报文中的模式字段的值以及路由信息字段的值,将数据报文发送至第一中继服务器,以使第一中继服务器进行中继处理。
在本说明书一个实施例中,在数据报文中,模式字段的值表征特定地址模式,路由信息字段包括加密地址字段和加密端口字段;其中,加密地址字段的值为加密后的第一中继服务器的内网IP地址;加密端口字段的值为加密后的第一端口的信息。相应地,步骤309的过程包括:根据预先获取的解密密钥,对数据报文中的加密地址字段、加密 端口字段分别进行解密;以及在解析出数据报文中模式字段的值表征特定地址模式后,根据解密出的第一中继服务器的内网IP地址以及第一端口的信息,将该数据报文发送到第一中继服务器的第一端口。
负载均衡服务器使用的解密密钥可以是在中继集群建群时,配置给负载均衡服务器的。负载均衡服务器可以使用解密密钥即上述mask与数据报文中的Encoded-Port以及Encoded-Address字段的值分别进行异或,从而解密出第一中继服务器的内网IP地址以及第一端口的信息。
上述步骤307至步骤309中涉及的数据报文可以是作为建立中继通道的发起方的第一客户端发来的数据报文,也可以是作为建立中继通道的被发起方的第二客户端发来的数据报文。
上述实施例1描述了负载均衡服务器根据第一客户端发来的中继申请文件进行图3所示的建立中继通道的处理,以及后续对第一客户端/第二客户端发来的数据报文的处理。
在一些实施例中,建立中继通道的被发起方(记为第二客户端)也需要向负载均衡服务器发送中继申请报文,负载均衡服务器会根据第二客户端发来的中继申请文件进行图3所示的处理。结合上述新定义的transaction ID的结构,通过实施例2来说明该处理。
实施例2:在实施例2中,图3所示步骤中的客户端为建立中继通道的被发起方,即第二客户端。
在步骤301中负载均衡服务器接收第二客户端发来的中继申请报文;该中继申请报文中包括事务标识(transaction ID);该transaction ID包括模式字段以及路由信息字段。
接下来,在步骤303中负载均衡服务器根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息。
如前所述,第二客户端发出的中继申请报文中会包括transaction ID。执行到本步骤303时,负载均衡服务器已经为第一客户端与第二客户端的会话分配了第一中继服务器,为了使得第二客户端与第一客户端对应到中继集群中的同一个中继服务器,第二客户端发出的中继申请报文中需要指定第一中继服务器。因此,在该中继申请报文中,transaction ID中的模式字段的值表征特定服务器模式,路由信息字段中包括加密地址字段,该加密地址字段的值为加密后的第一中继服务器的内网IP地址。
在本发明实施例2的一种实现方式中,步骤303的具体实现过程包括以下步骤。
步骤3031B:负载均衡服务器对第二客户端发来的中继申请报文进行解析。
步骤3032B:负载均衡服务器根据预先获取的解密密钥,对中继申请报文中的加密地址字段进行解密,获得第一中继服务器的内网IP地址。
步骤3033B:负载均衡服务器在解析出该中继申请报文中模式字段的值表征特定服务器模式后,根据解密获得的该内网IP地址,将中继申请报文发送到第一中继服务器 的默认服务端口。
在步骤3033B中,当负载均衡服务器解析出transaction ID中模式字段的值表征特定服务器模式后,会使用预先获取的解密密钥即上述的mask对路由信息字段的值进行解密(比如,使用mask与Encoded-Address进行异或),从而得到第一中继服务器的内网IP地址,则可以确定该报文已经指定第一中继服务器。因此,会根据解密出的第一中继服务器的内网IP地址,将中继申请报文发送到第一中继服务器的默认服务端口。
第一中继服务器在接收到第二客户端的中继申请报文后,可以将加密后的内网IP地址以及加密后的第一端口的信息发给负载均衡服务器。
步骤3034B:负载均衡服务器接收第一中继服务器发来的第一中继服务器的路由信息。
接下来在步骤305中负载均衡服务器将携带第一中继服务器的路由信息的中继分配报文发送给第二客户端,以使第二客户端根据该第一中继服务器的路由信息建立中继通道。
负载均衡服务器可以是将携带有加密后的第一中继服务器的路由信息(比如包括加密后的第一中继服务器的内网IP地址以及加密后的第一端口的信息)的中继分配报文发送给第二客户端,具体可以通过中继分配报文中如前所述的加密中继地址参数(ENCRYPTED-RELAY-ADDRESS)来携带,具体实现原理及过程可以参见实施例1中对步骤305的说明。
此后,第二客户端收到中继分配报文后,从中获取第一中继服务器的路由信息。在一些应用场景中,比如基于TURN协议实现的中继通道的建立过程中,第二客户端通过信令服务器将该第一中继服务器的路由信息同步给需要与其进行通信的第一客户端。
至此,相互通信的第一客户端及第二客户端都获取了第一中继服务器的路由信息。此后,第一客户端与第二客户端分别向负载均衡服务器发起链接校验流程,校验通过后,第一客户端与第二客户端之间的中继通道建立成功。此后,则可以利用该中继通道传输第一客户端与第二客户端之间的数据报文。
负载均衡服务器处理第一客户端与第二客户端之间的数据报文的过程已经在上述实施例1中通过步骤307及步骤309的相关描述进行了说明。
以上说明了在中继集群的负载均衡服务器中实现客户端基于中继集群进行通信的方法。
二、在客户端处实现基于中继集群的通信方法。
图4示出了本说明书一个实施例中在客户端处实现基于中继集群的通信方法的流程图。该方法的执行主体可以为客户端。可以理解,该方法也可以通过任何具有计算、处理能力的装置、设备、平台、设备集群来执行。参见图4,该方法包括:步骤401:客户端向负载均衡服务器发送中继申请报文;该中继申请报文中包括事务标识(transaction  ID);所述transaction ID包括模式字段以及路由信息字段;以使负载均衡服务器根据该中继申请报文中模式字段的值以及路由信息字段的值获取第一中继服务器的路由信息;步骤403:客户端从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息;步骤405:客户端根据第一中继服务器的路由信息,建立中继通道。
如前所述,相互通信的两个客户端需要建立中继通道。在中继通道建立流程的初始阶段,建立中继通道的发起方即第一客户端需要利用上述图4所示流程建立中继通道。结合前述新定义的transaction ID的结构,通过实施例3来说明该处理。
实施例3:该实施例3对应于实施例1。在实施例3中,图4所示步骤的执行主体为建立中继通道的发起方,即第一客户端。
首先,在步骤401中第一客户端利用预先获取的负载均衡服务器的公网IP地址,向负载均衡服务器发送中继申请报文。
结合上述实施例1中对步骤301的说明,在本步骤401中,在中继申请报文中,模式字段的值表征任意模式,路由信息字段的值为随机字符串。
接下来步骤403中,第一客户端从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息。
在实施例3中,第一中继服务器的路由信息可以为加密后的路由信息,包括加密后的第一中继服务器的内网IP地址以及加密后的第一中继服务器中第一端口的信息。
对应上述实施例1中对步骤305的说明,中继分配报文中包括加密中继地址(ENCRYPTED-RELAY-ADDRESS);ENCRYPTED-RELAY-ADDRESS中包括加密地址字段以及加密端口字段;本实施例4的步骤403的一种实现过程包括:第一客户端从中继分配报文的加密地址字段中得到加密后的第一中继服务器的内网IP地址,从该中继分配报文的加密端口字段中得到加密后的第一端口的信息。
接下来步骤405中,第一客户端根据第一中继服务器的路由信息,建立中继通道。
具体地,第一客户端会将第一中继服务器的路由信息通过信令服务器同步给第二客户端。当第一客户端接收到第二客户端通过信令服务器同步来的第一中继服务器的路由信息后,则会向负载均衡服务器发起链接校验流程,在校验通过后,中继通道建立成功。
之后,第一客户端通过中继通道,将数据报文发送给负载均衡服务器,以使该负载均衡服务器根据该数据报文包括的transaction ID中的模式字段的值以及路由信息字段的值将该数据报文转发给第一中继服务器。
如前所述,对应于实施例1中的步骤307至步骤309的相关描述,在数据报文的transaction ID中,路由信息字段包括加密地址字段和加密端口字段;第一客户端将数据报文发送给负载均衡服务器的具体过程可以包括:设置数据报文中模式字段的值表征特定地址模式,设置该数据报文中加密地址字段的值为加密后的第一中继服务器的内网IP地址,以及设置该数据报文中加密端口字段的值为加密后的第一端口的信息,然后将该 数据报文发送给负载均衡服务器。
在中继通道建立流程中,建立中继通道的被发起方即第二客户端需要利用上述图4所示流程建立中继通道。结合前述新定义的transaction ID的结构,通过实施例4来说明该处理。
实施例4:该实施例4对应于实施例2。在实施例4中,图4所示步骤的执行主体为建立中继通道的被发起方,即第二客户端。
首先,在步骤401中第二客户端利用预先获取的负载均衡服务器的公网IP地址,向负载均衡服务器发送中继申请报文。
这里,第二客户端可以是在接收到第一客户端通过信令服务器同步来的第一中继服务器的路由信息之后,执行本步骤401的处理。
参见上述实施例2中对步骤303的说明,第二客户端发出的中继申请报文中,transaction ID中的模式字段的值表征特定服务器模式,路由信息字段中包括加密地址字段,该加密地址字段的值为加密后的第一中继服务器的内网IP地址。
接下来,在步骤403中第二客户端从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息。
在实施例4中,第一中继服务器的路由信息可以为加密后的路由信息,包括加密后的第一中继服务器的内网IP地址以及加密后的第一中继服务器中第一端口的信息。
对应上述实施例2中对步骤305的说明,中继分配报文中包括加密中继地址(ENCRYPTED-RELAY-ADDRESS);ENCRYPTED-RELAY-ADDRESS中包括加密地址字段以及加密端口字段;本实施例4的步骤403的一种实现过程包括:第二客户端从中继分配报文的加密地址字段中得到加密后的第一中继服务器的内网IP地址,从该中继分配报文的加密端口字段中得到加密后的第一端口的信息。
接下来步骤405中,第二客户端根据第一中继服务器的路由信息,建立中继通道。
具体地,第二客户端会将第一中继服务器的路由信息通过信令服务器同步给第一客户端。之后,第二客户端会向负载均衡服务器发起链接校验流程,在校验通过后,中继通道建立成功。
之后,第二客户端通过中继通道,将数据报文发送给负载均衡服务器,以使该负载均衡服务器根据该数据报文包括的transaction ID中的模式字段的值以及路由信息字段的值将该数据报文转发给第一中继服务器。
如前所述,对应于实施例1中的步骤307至步骤309的相关描述,在数据报文的transaction ID中,路由信息字段包括加密地址字段和加密端口字段;第二客户端将数据报文发送给负载均衡服务器的具体过程可以包括:设置数据报文中模式字段的值表征特定地址模式,设置该数据报文中加密地址字段的值为加密后的第一中继服务器的内网IP 地址,以及设置该数据报文中加密端口字段的值为加密后的第一端口的信息,然后将该数据报文发送给负载均衡服务器。
三、在中继集群的一个中继服务器中实现基于处继集群的通信方法。
图5示出了本说明书一个实施例中在中继服务器处实现基于中继集群的通信方法的流程图。该方法的执行主体可以为中继服务器,以第一中继服务器进行描述。可以理解,该方法也可以通过任何具有计算、处理能力的装置、设备、平台、设备集群来执行。参见图5,该方法包括:步骤501:第一中继服务器接收负载均衡服务器发来的中继申请报文;步骤503:第一中继服务器将自身的路由信息发送给负载均衡服务器;以使客户端根据负载均衡服务器转发的第一中继服务器的路由信息建立中继通道。
在上述图5所示的过程中,中继申请报文可以是由建立中继通道的发起方即第一客户端通过负载均衡服务器发来的,也可以是由建立中继通道的被发起方即第二客户端通过负载均衡服务器发来的。
在步骤501中,第一中继服务器通过默认服务端口接收第一客户端/第二客户端的中继申请报文。
在本说明书一个实施例中,步骤503中的第一中继服务器的路由信息包括加密后的第一中继服务器的内网IP地址以及加密后的第一端口的信息。
结合上述新定义的ENCRYPTED-RELAY-ADDRESS以及上述实施例1至实施例4中的说明,步骤503的一种实现过程包括:对第一中继服务器的内网IP地址进行加密,对第一端口的信息进行加密;将加密后的内网IP地址携带在中继分配报文包括的加密中继地址(ENCRYPTED-RELAY-ADDRESS)的加密地址字段,将加密后的第一端口的信息携带在ENCRYPTED-RELAY-ADDRESS的加密端口字段,然后将该中继分配报文发送给负载均衡服务器,以使得负载均衡服务器获得第一中继服务器的路由信息。
此后,第一中继服务器通过第一端口接收到负载均衡服务器发来的第一客户端/第二客户端的数据报文,对该数据报文进行中继处理。
在本发明一个实施例中,结合上述第一、二、三点中对负载均衡服务器、客户端及中继服务器的处理的相关描述,可以得到如图6所示的一种基于中继集群的通信系统的结构图。参见图6、图7,利用中继集群建立中继通道的过程包括以下步骤。
在步骤1中,第一客户端向负载均衡服务器发送上述任一实施例中的中继申请报文。
在步骤2中,负载均衡服务器向第一客户端返回上述任一实施例中的中继分配报文。
在步骤3中,第一客户端将第一中继服务器的路由信息通过信令服务器同步给第二客户端。
在步骤4中,第二客户端向负载均衡服务器发送上述任一实施例中的中继申请报文。
在步骤5中,负载均衡服务器向第二客户端返回上述任一实施例中的中继分配报文。
在步骤6中,第二客户端将第一中继服务器的路由信息通过信令服务器同步给第一客户端。
在步骤7中,第一客户端向负载均衡服务器发起链接校验流程。
这里,在校验时,第一客户端会利用transaction ID携带第一中继服务器的路由信息,从而进行校验。
在步骤8中,第二客户端向负载均衡服务器发起链接校验流程。
这里,在校验时,第二客户端会利用transaction ID携带第一中继服务器的路由信息,从而进行校验。
在步骤9中,链接校验通过后,中继通道建立成功。
在本说明书的一个实施例中,还提出了一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;参见图8,该装置应用于负载均衡服务器,包括:客户端交互模块801,配置为接收客户端发来的中继申请报文;该中继申请报文中包括事务标识(transaction ID);所述transaction ID包括模式字段以及路由信息字段;以及将携带第一中继服务器的路由信息的中继分配报文发送给客户端,以使客户端根据该第一中继服务器的路由信息建立中继通道;中继事务处理模块802,配置为根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息。
在本说明书中,应用于负责均衡服务器中的上述装置的一个实施例中,第一中继服务器的路由信息包括加密后的第一中继服务器的内网IP地址以及加密后的第一中继服务器中第一端口的信息;其中,该内网IP地址是第一中继服务器在所述中继集群组成的内网中的IP地址;该第一端口是为所述客户端分配的第一中继服务器上的中继端口。
基于前述的transaction ID,设置在负责均衡服务器中的上述装置可以包括如下实施例中的至少一种:实施例A:在中继申请报文中,模式字段的值表征任意模式;路由信息字段的值为随机字符串;相应地,中继事务处理模块802被配置为执行:在解析出所述中继申请报文中模式字段的值表征任意模式且路由信息字段的值为随机字符串时,按照负载均衡原则从至少两个中继服务器中选择第一中继服务器;将中继申请报文发送到第一中继服务器的默认服务端口;以及接收第一中继服务器发来的所述路由信息。
实施例B:在中继申请报文中,模式字段的值表征特定服务器模式,加密地址字段的值为加密后的第一中继服务器的内网IP地址;相应地,中继事务处理模块802被配置为执行:根据预先获取的解密密钥,对中继申请报文中的加密地址字段进行解密,获得第一中继服务器的内网IP地址;在解析出所述中继申请报文中模式字段的值表征特定服务器模式后,根据获得的该内网IP地址,将中继申请报文发送到第一中继服务器的默认服务端口;以及接收第一中继服务器发来的所述路由信息。
实施例C:中继事务处理模块802进一步被配置为执行:接收客户端通过所述中继 通道发来的数据报文;该数据报文包括所述transaction ID中的模式字段以及路由信息字段;根据数据报文中的模式字段的值以及路由信息字段的值,将数据报文发送至第一中继服务器。
实施例D:基于上述实施例C,在数据报文中,模式字段的值表征特定地址模式,路由信息字段包括加密地址字段和加密端口字段;其中,加密地址字段的值为加密后的第一中继服务器的内网IP地址;加密端口字段的值为加密后的第一端口的信息;中继事务处理模块802被配置为执行:根据预先获取的解密密钥,对数据报文中的加密地址字段、加密端口字段分别进行解密;以及在解析出数据报文中模式字段的值表征特定地址模式后,根据解密出的第一中继服务器的内网IP地址以及第一端口的信息,将该数据报文发送到第一中继服务器的第一端口。
在本说明书一个实施例中,还提出了一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;参见图9,该装置应用于客户端,包括:中继通道申请模块901,配置为向负载均衡服务器发送中继申请报文;该中继申请报文中包括事务标识(transaction ID);所述transaction ID包括模式字段以及路由信息字段;以使负载均衡服务器根据该中继申请报文中模式字段的值以及路由信息字段的值获取第一中继服务器的路由信息;中继通道建立模块902,配置为从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息;以及根据第一中继服务器的路由信息,建立中继通道。
在图9所示装置的实施例中,第一中继服务器的路由信息包括加密后的第一中继服务器的内网IP地址以及加密后的第一中继服务器的第一端口的信息;其中,该内网IP地址是第一中继服务器在所述中继集群组成的内网中的IP地址;该第一端口是为所述客户端分配的第一中继服务器上的中继端口。
在实现图9所示装置的实施例中,中继分配报文中包括加密中继地址(ENCRYPTED-RELAY-ADDRESS);所述ENCRYPTED-RELAY-ADDRESS中包括加密地址字段以及加密端口字段;中继通道建立模块902被配置为执行:从所述中继分配报文的加密地址字段中得到加密后的第一中继服务器的内网IP地址,从该中继分配报文的加密端口字段中得到加密后的第一端口的信息。
当上述图9所示的装置应用于建立中继通道的发起方即第一客户端时,中继通道申请模块901被配置为执行:设置所述中继申请报文中模式字段的值表征任意模式,并设置该中继申请报文中路由信息字段的值为随机字符串,然后将该中继申请报文发送给负载均衡服务器。
当上述图9所示的装置应用于建立中继通道的被发起方即第二客户端时,所述路由信息字段中包括加密地址字段;中继通道申请模块901被配置为执行:设置所述中继申请报文中模式字段的值表征特定服务器模式,并设置该中继申请报文中加密地址字段的值为加密后的第一中继服务器的内网IP地址,然后将该中继申请报文发送给负载均衡 服务器。
无论上述图9所示的装置应用于第一客户端还是第二客户端,该装置都可以进一步包括:数据处理模块,配置为通过中继通道将数据报文发送给负载均衡服务器,以使该负载均衡服务器根据该数据报文包括的transaction ID中的模式字段的值以及路由信息字段的值将该数据报文转发给第一中继服务器。
当图9所示装置包括数据处理模块时,transaction ID中的路由信息字段包括加密地址字段和加密端口字段;数据处理模块被配置为执行:设置数据报文中模式字段的值表征特定地址模式,设置该数据报文中加密地址字段的值为加密后的第一中继服务器的内网IP地址,以及设置该数据报文中加密端口字段的值为加密后的第一端口的信息,然后将该数据报文发送给负载均衡服务器。
在本说明书一个实施例中,还提出了一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;该装置应用于该至少两个中继服务器中的第一中继服务器,参见图10,包括:信息收发模块1001,配置为接收负载均衡服务器发来的中继申请报文;中继通道处理模块1002,配置为将第一中继服务器的路由信息发送给负载均衡服务器;以使客户端根据负载均衡服务器转发的第一中继服务器的路由信息建立中继通道。
在图10所示装置的一个实施例中,中继通道处理模块1002被配置为执行:对第一中继服务器的内网IP地址进行加密,对第一端口的信息进行加密;将加密后的内网IP地址携带在中继分配报文包括的加密中继地址(ENCRYPTED-RELAY-ADDRESS)的加密地址字段,将加密后的第一端口的信息携带在ENCRYPTED-RELAY-ADDRESS的加密端口字段,然后将该中继分配报文发送给负载均衡服务器,以使得负载均衡服务器获得第一中继服务器的上述路由信息。
在本说明书的各个实施例中,可以是基于TURN协议的通信方法,也就是说,各个报文为基于TURN协议的报文,中继集群为基于TURN协议建立的中继集群。
本说明书一个实施例提供了一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行说明书中任一个实施例中的方法。
本说明书一个实施例提供了一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现执行说明书中任一个实施例中的方法。
可以理解的是,本说明书实施例示意的结构并不构成对本说明书实施例的装置的具体限定。在说明书的另一些实施例中,上述装置可以包括比图示更多或者更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件、软件或者软件和硬件的组合来实现。
上述装置、系统内的各模块之间的信息交互、执行过程等内容,由于与本说明书方 法实施例基于同一构思,具体内容可参见本说明书方法实施例中的叙述,此处不再赘述。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。

Claims (25)

  1. 一种基于中继集群的通信方法,该中继集群包括负载均衡服务器以及至少两个中继服务器;该通信方法包括:
    接收客户端发来的中继申请报文;该中继申请报文中包括事务标识;所述事务标识包括模式字段以及路由信息字段;
    根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息;
    将携带第一中继服务器的路由信息的中继分配报文发送给客户端,以使客户端根据该第一中继服务器的路由信息建立中继通道。
  2. 根据权利要求1所述的方法,其中,
    所述第一中继服务器的路由信息包括加密后的第一中继服务器的内网IP地址以及加密后的第一端口的信息;
    其中,该内网IP地址是第一中继服务器在所述中继集群组成的内网中的IP地址;该第一端口是为所述客户端分配的第一中继服务器上的中继端口。
  3. 根据权利要求2所述的方法,其中,所述中继分配报文中包括加密中继地址;
    所述加密中继地址中包括加密地址字段以及加密端口字段;
    在所述中继分配报文中,加密地址字段用于携带加密后的第一中继服务器的内网IP地址,加密端口字段用于携带加密后的第一端口的信息。
  4. 根据权利要求3所述的方法,其中,所述加密中继地址中进一步包括:属性类型字段和/或预留字段;
    在所述中继分配报文中,所述属性类型字段的值表征安全路由信息。
  5. 根据权利要求1所述的方法,其中,所述客户端为建立中继通道的发起方;
    在所述中继申请报文中,所述模式字段的值表征任意模式;所述路由信息字段的值为随机字符串;
    所述获取所述至少两个中继服务器中的第一中继服务器的路由信息,包括:
    在解析出所述中继申请报文中模式字段的值表征任意模式且路由信息字段的值为随机字符串时,按照负载均衡原则从至少两个中继服务器中选择第一中继服务器;
    将中继申请报文发送到第一中继服务器的默认服务端口;以及
    接收第一中继服务器发来的所述路由信息。
  6. 根据权利要求1所述的方法,其中,所述客户端为建立中继通道的被发起方;
    在所述中继申请报文中,模式字段的值表征特定服务器模式,路由信息字段中包括加密地址字段,该加密地址字段的值为加密后的第一中继服务器的内网IP地址;
    所述获取所述至少两个中继服务器中的第一中继服务器的路由信息,包括:
    根据预先获取的解密密钥,对中继申请报文中的加密地址字段进行解密,获得第一中继服务器的内网IP地址;
    在解析出所述中继申请报文中模式字段的值表征特定服务器模式后,根据获得的该内网IP地址,将中继申请报文发送到第一中继服务器的默认服务端口;以及
    接收第一中继服务器发来的所述路由信息。
  7. 根据权利要求1所述的方法,该方法进一步包括:
    接收客户端通过所述中继通道发来的数据报文;该数据报文包括所述事务标识中的模式字段以及路由信息字段;
    根据数据报文中的模式字段的值以及路由信息字段的值,将数据报文发送至第一中继服务器。
  8. 根据权利要求7所述的方法,
    在所述数据报文中,模式字段的值表征特定地址模式,路由信息字段包括加密地址字段和加密端口字段;其中,加密地址字段的值为加密后的第一中继服务器的内网IP地址;加密端口字段的值为加密后的第一端口的信息;
    所述将数据报文发送至第一中继服务器,包括:
    根据预先获取的解密密钥,对数据报文中的加密地址字段、加密端口字段分别进行解密;以及
    在解析出数据报文中模式字段的值表征特定地址模式后,根据解密出的第一中继服务器的内网IP地址以及第一端口的信息,将该数据报文发送到第一中继服务器的第一端口。
  9. 根据权利要求1至8中任一所述的方法,其中,各报文为基于TURN(Traversal Using Relays around NAT)协议的报文。
  10. 一种基于中继集群的通信方法,该中继集群包括负载均衡服务器以及至少两个中继服务器;该至少两个中继服务器中包括第一中继服务器;该通信方法包括:
    向负载均衡服务器发送中继申请报文;该中继申请报文中包括事务标识;所述事务标识包括模式字段以及路由信息字段;以使负载均衡服务器根据该中继申请报文中模式字段的值以及路由信息字段的值获取第一中继服务器的路由信息;
    从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息;
    根据第一中继服务器的路由信息,建立中继通道。
  11. 根据权利要求10所述的方法,其中,所述第一中继服务器的路由信息包括加密后的第一中继服务器的内网IP地址以及加密后的第一中继服务器的第一端口的信息;
    其中,该内网IP地址是第一中继服务器在所述中继集群组成的内网中的IP地址;该第一端口是为所述客户端分配的第一中继服务器上的中继端口。
  12. 根据权利要求11所述的方法,其中,所述中继分配报文中包括加密中继地址;
    所述加密中继地址中包括加密地址字段以及加密端口字段;
    所述获取第一中继服务器的路由信息,包括:
    从所述中继分配报文的加密地址字段中得到加密后的第一中继服务器的内网IP地址,从该中继分配报文的加密端口字段中得到加密后的第一端口的信息。
  13. 根据权利要求10所述的方法,其中,所述客户端为建立中继通道的发起方;
    所述向负载均衡服务器发送中继申请报文,包括:
    设置所述中继申请报文中模式字段的值表征任意模式,并设置该中继申请报文中路 由信息字段的值为随机字符串,然后将该中继申请报文发送给负载均衡服务器。
  14. 根据权利要求10所述的方法,其中,所述客户端为建立中继通道的被发起方;所述路由信息字段中包括加密地址字段;
    所述向负载均衡服务器发送中继申请报文,包括:
    设置所述中继申请报文中模式字段的值表征特定服务器模式,并设置该中继申请报文中加密地址字段的值为加密后的第一中继服务器的内网IP地址,然后将该中继申请报文发送给负载均衡服务器。
  15. 根据权利要求10所述的方法,在建立中继通道之后,进一步包括:
    通过中继通道,将数据报文发送给负载均衡服务器,以使该负载均衡服务器根据该数据报文包括的事务标识中的模式字段的值以及路由信息字段的值将该数据报文转发给第一中继服务器。
  16. 根据权利要求15所述的方法,所述路由信息字段包括加密地址字段和加密端口字段;所述将数据报文发送给负载均衡服务器,包括:
    设置所述数据报文中模式字段的值表征特定地址模式,
    设置该数据报文中加密地址字段的值为加密后的第一中继服务器的内网IP地址,
    设置该数据报文中加密端口字段的值为加密后的第一端口的信息,然后
    将该数据报文发送给负载均衡服务器。
  17. 根据权利要求10至16中任一所述的方法,其中,各报文为基于TURN(Traversal Using Relays around NAT)协议的报文。
  18. 一种基于中继集群的通信方法,该中继集群包括负载均衡服务器以及至少两个中继服务器;该通信方法包括:
    接收负载均衡服务器发来的中继申请报文;
    将自身的路由信息发送给负载均衡服务器;以使客户端根据负载均衡服务器转发的第一中继服务器的路由信息建立中继通道。
  19. 根据权利要求18所述的方法,其中,第一中继服务器的路由信息包括加密后的第一中继服务器的内网IP地址以及加密后的第一端口的信息;
    其中,该内网IP地址是第一中继服务器在所述中继集群组成的内网中的IP地址;该第一端口是为所述客户端分配的第一中继服务器上的中继端口。
  20. 根据权利要求19所述的方法,其中,所述将自身的路由信息发送给负载均衡服务器,包括:
    对第一中继服务器的内网IP地址进行加密,对第一端口的信息进行加密;
    将加密后的内网IP地址携带在中继分配报文包括的加密中继地址的加密地址字段,将加密后的第一端口的信息携带在加密中继地址的加密端口字段,然后将该中继分配报文发送给负载均衡服务器。
  21. 根据权利要求18至20中任一所述的方法,其中,各报文为基于TURN(Traversal Using Relays around NAT)协议的报文。
  22. 一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个 中继服务器;该通信装置应用于负载均衡服务器,并包括:
    客户端交互模块,配置为接收客户端发来的中继申请报文;该中继申请报文中包括事务标识;所述事务标识包括模式字段以及路由信息字段;以及将携带第一中继服务器的路由信息的中继分配报文发送给客户端,以使客户端根据该第一中继服务器的路由信息建立中继通道;
    中继事务处理模块,配置为根据中继申请报文中的模式字段的值以及路由信息字段的值,获取至少两个中继服务器中的第一中继服务器的路由信息。
  23. 一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;该至少两个中继服务器中包括第一中继服务器;该通信装置包括:
    中继通道申请模块,配置为向负载均衡服务器发送中继申请报文;该中继申请报文中包括事务标识;所述事务标识包括模式字段以及路由信息字段;以使负载均衡服务器根据该中继申请报文中模式字段的值以及路由信息字段的值获取第一中继服务器的路由信息;
    中继通道建立模块,配置为从负载均衡服务器发来的中继分配报文中获取第一中继服务器的路由信息;以及根据第一中继服务器的路由信息,建立中继通道。
  24. 一种基于中继集群的通信装置,该中继集群包括负载均衡服务器以及至少两个中继服务器;该通信装置包括:
    信息收发模块,配置为接收负载均衡服务器发来的中继申请报文;
    中继通道处理模块,配置为将第一中继服务器的路由信息发送给负载均衡服务器;以使客户端根据负载均衡服务器转发的第一中继服务器的路由信息建立中继通道。
  25. 一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现权利要求1-21中任一项所述的方法。
PCT/CN2022/124647 2021-10-12 2022-10-11 基于中继集群的通信 WO2023061370A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111187242.2A CN115967717A (zh) 2021-10-12 2021-10-12 基于中继集群的通信方法和装置
CN202111187242.2 2021-10-12

Publications (1)

Publication Number Publication Date
WO2023061370A1 true WO2023061370A1 (zh) 2023-04-20

Family

ID=85903543

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/124647 WO2023061370A1 (zh) 2021-10-12 2022-10-11 基于中继集群的通信

Country Status (2)

Country Link
CN (1) CN115967717A (zh)
WO (1) WO2023061370A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414799A (zh) * 2013-07-31 2013-11-27 华为技术有限公司 中继地址互通方法和终端及系统
US20200081746A1 (en) * 2018-09-07 2020-03-12 International Business Machines Corporation Load leveler
CN111935314A (zh) * 2020-09-25 2020-11-13 支付宝(杭州)信息技术有限公司 区块链系统、消息传输方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4520840B2 (ja) * 2004-12-02 2010-08-11 株式会社日立製作所 暗号化通信の中継方法、ゲートウェイサーバ装置、暗号化通信のプログラムおよび暗号化通信のプログラム記憶媒体
US9830593B2 (en) * 2014-04-26 2017-11-28 Ss8 Networks, Inc. Cryptographic currency user directory data and enhanced peer-verification ledger synthesis through multi-modal cryptographic key-address mapping
CN110098858A (zh) * 2018-01-30 2019-08-06 电信科学技术研究院有限公司 一种中继工作模式配置方法及终端
CN113297603A (zh) * 2021-06-18 2021-08-24 中国农业银行股份有限公司 数据处理方法、装置、设备、存储介质和程序产品

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414799A (zh) * 2013-07-31 2013-11-27 华为技术有限公司 中继地址互通方法和终端及系统
US20200081746A1 (en) * 2018-09-07 2020-03-12 International Business Machines Corporation Load leveler
CN111935314A (zh) * 2020-09-25 2020-11-13 支付宝(杭州)信息技术有限公司 区块链系统、消息传输方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
KANEKO YUDAI; ASAKA TAKUYA: "DHT Clustering for Load Balancing Considering Blockchain Data Size", 2018 SIXTH INTERNATIONAL SYMPOSIUM ON COMPUTING AND NETWORKING WORKSHOPS (CANDARW), IEEE, 27 November 2018 (2018-11-27), pages 71 - 74, XP033479215, DOI: 10.1109/CANDARW.2018.00022 *

Also Published As

Publication number Publication date
CN115967717A (zh) 2023-04-14

Similar Documents

Publication Publication Date Title
US11038682B2 (en) Communication method, apparatus and system, electronic device, and computer readable storage medium
US11303431B2 (en) Method and system for performing SSL handshake
CN110581763B (zh) 一种量子密钥服务区块链网络系统
US9565167B2 (en) Load balancing internet protocol security tunnels
US8327129B2 (en) Method, apparatus and system for internet key exchange negotiation
US8990569B2 (en) Secure communication session setup
US10142119B2 (en) Communication method and apparatus using changing destination and return destination ID's
US9350711B2 (en) Data transmission method, system, and apparatus
US11539747B2 (en) Secure communication session resumption in a service function chain
CN102833253A (zh) 建立客户端与服务器安全连接的方法及服务器
JPH07107083A (ja) 暗号通信システム
CN111212429A (zh) 一种移动终端的安全接入系统及方法
CN107426339A (zh) 一种数据连接通道的接入方法、装置及系统
CN115174267B (zh) 一种tls协议协商方法、设备及介质
KR20180130203A (ko) 사물인터넷 디바이스 인증 장치 및 방법
WO2024001035A1 (zh) 基于区块链中继通信网络系统的消息传输方法及装置
CN111343083B (zh) 即时通信方法、装置、电子设备及可读存储介质
CN113726795A (zh) 报文转发方法、装置、电子设备及可读存储介质
CN114142995B (zh) 面向区块链中继通信网络的密钥安全分发方法及装置
CN111901335A (zh) 基于中台的区块链数据传输管理方法及系统
WO2023061370A1 (zh) 基于中继集群的通信
US10554633B2 (en) Enhanced packet formating for security inter-computing system communication
CN114629678B (zh) 一种基于tls的内网穿透方法及装置
CN110995730B (zh) 数据传输方法、装置、代理服务器和代理服务器集群
CN113422753A (zh) 数据处理方法、装置、电子设备及计算机存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22880307

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18573556

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE