Communication connection establishment method, device, electronic device and storage medium
By introducing checkSSLHandler processor and dynamically loading SSLHandler processor in server nodes, the problem of node transformation in the microservice framework is solved, multi-protocol support for ports is realized, and network communication efficiency and security are improved.
Patent Information
- Application Number
- CN202110721858.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2041-06-28
AI Technical Summary
In the microservice framework in the prior art, it is difficult to support both secure transmission protocol and non-secure transmission protocol in the transformation of server nodes and client nodes, resulting in the normal development of network communications being affected.
Introduce a checkSSLHandler processor in the server node, dynamically load the SSLHandler processor, and decide whether to establish a communication connection with a secure transmission protocol based on the type of request packets, and support multiple protocol types.
One port of the server node supports both secure transmission protocol and non-secure transmission protocol, reducing the difficulty of transformation and resource waste, and improving the efficiency and security of network communication.
Smart Images

Figure CN115604336B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a method, device, electronic device and storage medium for establishing a communication connection. Background Art
[0002] The microservice framework is used to implement communication between microservices. Common microservice frameworks include Spring Cloud and Dubbo.
[0003] Early versions of microservices frameworks typically used plaintext network transmission protocols (referred to as plaintext transmission protocols) to implement inter-microservice communication. Later versions of microservices frameworks can implement inter-microservice communication not only through plaintext network transmission protocols but also through secure transmission protocols.
[0004] In some microservice frameworks, there's only one port for establishing communication connections, and this port only supports the secure transport protocol after it's enabled. Therefore, if different nodes in a communication system use different versions, this can affect inter-node communication connections.
[0005] In order to avoid this problem, in the prior art, it is generally necessary to synchronously transform all server nodes (server) and client nodes (client) in the communication system so that all nodes support the secure transmission protocol.
[0006] However, given the complexity of actual applications, it is very difficult to complete the transformation of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications and affect the efficiency of updates and iterations. Summary of the Invention
[0007] In view of the problems existing in the prior art, the present invention provides a method, device, electronic device and storage medium for establishing a communication connection.
[0008] The present invention provides a method for establishing a communication connection, which is applied to a server node and includes:
[0009] Receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node;
[0010] Invoking a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol;
[0011] In a case where the protocol type corresponding to the first request message is the secure transmission protocol, a second processor is called to process the first request message to establish a communication connection based on the secure transmission protocol.
[0012] According to a method for establishing a communication connection provided by the present invention, calling a first processor to parse the first request message and determining a protocol type corresponding to the first request message includes:
[0013] Invoking a first processor to extract header information from the first request message;
[0014] In a case where the header information is a handshake request of a secure transmission protocol, it is determined that the protocol type corresponding to the first request message is a secure transmission protocol.
[0015] According to a method for establishing a communication connection provided by the present invention, calling a second processor to process the first request message to establish a communication connection based on the secure transmission protocol includes:
[0016] loading and activating the second processor;
[0017] The second processor is called to execute a handshake process of a secure transmission protocol according to the first request message to establish a communication connection based on the secure transmission protocol.
[0018] According to a method for establishing a communication connection provided by the present invention, after establishing the communication connection based on the secure transmission protocol, the method further includes at least one of the following:
[0019] Invoking the second processor to receive a data packet from the client node and decrypt the data packet; invoking the third processor to decode and perform service processing on the decrypted data packet;
[0020] The third processor is called to encode the data packet to be sent; the second processor is called to encrypt the encoded data packet, and then the encrypted data packet is sent to the client node.
[0021] According to a method for establishing a communication connection provided by the present invention, the calling of the first processor to parse the first request message and determine the protocol type corresponding to the first request message further includes:
[0022] In a case where the header information is a service processing request, it is determined that the protocol type corresponding to the first request message is a non-secure transmission protocol.
[0023] According to a method for establishing a communication connection provided by the present invention, the method further includes:
[0024] In a case where the protocol type corresponding to the first request message is the non-secure transmission protocol, a third processor is called to decode and process the first request message.
[0025] According to a method for establishing a communication connection provided by the present invention, the secure transmission protocol is the SSL protocol; accordingly,
[0026] The second processor is SSLHandler.
[0027] According to a method for establishing a communication connection provided by the present invention, after calling the first processor to parse the first request message and determining the protocol type corresponding to the first request message, the method further includes:
[0028] Uninstall the first processor.
[0029] According to a method for establishing a communication connection provided by the present invention, before receiving the first request message from the client node, the method further includes:
[0030] Starting and initializing the server node; wherein, initializing the server node includes: loading and activating the first processor.
[0031] The present invention also provides a communication connection establishment device, comprising:
[0032] A message receiving module, configured to receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node;
[0033] a protocol type determination module, configured to call a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol;
[0034] The communication connection establishing module is used to call the second processor to process the first request message when the protocol type corresponding to the first request message is the secure transmission protocol, so as to establish a communication connection based on the secure transmission protocol.
[0035] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the communication connection establishment method as described above when executing the program.
[0036] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the communication connection establishment method as described above.
[0037] The communication connection establishment method, device, electronic device and storage medium provided by the present invention can realize that a port of the server node supports both secure transmission protocols and non-secure transmission protocols by modifying the server node, thereby overcoming the problem in the prior art of having great difficulties in completing the modification of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 This is a schematic diagram of a server node that complies with Dubbo 2.7.5 in the prior art;
[0040] Figure 2 This is a schematic diagram of a client node that complies with Dubbo 2.7.5 in the prior art;
[0041] Figure 3 is a flow chart of the communication connection establishment method provided by the present invention;
[0042] Figure 4 is a schematic diagram of a modified server node in one embodiment of the present invention;
[0043] Figure 5 Schematic diagram of the processing flow of a server node in one embodiment of the present invention;
[0044] Figure 6 This is a schematic diagram of the processing link after the server node receives dubbo protocol data in one embodiment of the present invention;
[0045] Figure 7 This is a schematic diagram of the processing link after the server node receives the SSL Client Hello handshake request in one embodiment of the present invention;
[0046] Figure 8 is a schematic diagram of a communication connection establishment device provided by the present invention;
[0047] Figure 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0048] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0049] To facilitate understanding, the microservice framework Dubbo involved in the present invention is first introduced.
[0050] Dubbo is widely used in business system development for communication between microservices. In versions prior to Dubbo 2.7.5, microservices communicated in plaintext, exposing the risk of message eavesdropping, tampering, and forgery. Starting with Dubbo 2.7.5, SSL communication is supported. This is achieved by adding an SSLHandler module to Dubbo's underlying communication layer (based on Netty). This module encrypts and decrypts messages, enabling SSL communication.
[0051] Figure 1 This is a schematic diagram of a server node that complies with Dubbo 2.7.5 in the prior art, as shown in FIG. Figure 1 As shown in the figure, NettyServer includes nettyServerHandler, EncoderHandler, and DecoderHandler. The server node adds the SSLHandler module on the server side based on the Netty Server. Figure 2 This is a schematic diagram of a client node that complies with Dubbo 2.7.5 in the prior art, as shown in FIG. Figure 2 As shown in the figure, Netty Client includes nettyClientHandler, EncoderHandler, and DecoderHandler. The client node adds the client-side SSLHandler module based on Netty Client.
[0052] When a connection is established between the server node and the client node through the TCP three-way handshake, the SSLHandler module is loaded, and the SSLHandler module completes the SSL handshake and establishes an encrypted channel. After the encrypted channel is established, the SSLHandler module encrypts and decrypts the data entering and leaving the node to complete the SSL communication.
[0053] In Dubbo, both server and client nodes communicate through port 20880. Before SSL is enabled, this port can support non-SSL communication. However, after the secure transport protocol is enabled, it can only support SSL communication and no longer supports non-SSL communication.
[0054] Since there is only one port for establishing a communication connection, and this unique port can only support SSL communication after SSL is enabled, if a node does not support communicating with other nodes via SSL (that is, the node still supports versions before Dubbo 2.7.5), then the node will not be able to establish a communication connection with other nodes because it does not support SSL handshakes.
[0055] In order to avoid this problem, in the prior art, it is generally necessary to synchronously modify all server nodes (server) and client nodes (client) in the communication system so that all nodes support SSL.
[0056] However, given the complexity of actual applications, it is very difficult to complete the transformation of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications.
[0057] Considering that the number of server nodes in the communication system is far less than that of client nodes, and the server nodes are usually managed by the operator and are easy to modify, the present invention only needs to modify the server nodes to achieve support for both the secure transmission protocol (SSL protocol) and the plaintext transmission protocol (non-SSL protocol) by one port.
[0058] The following combination Figure 3-Figure 9 The present invention describes a method, device, electronic device and storage medium for establishing a communication connection.
[0059] Figure 3 The flow chart of the communication connection establishment method provided by the present invention is as follows: Figure 3 As shown, the communication connection establishment method provided by the present invention is applied to a server node, and the method includes:
[0060] Step 301: Receive a first request message from a client node.
[0061] In this embodiment, the method of the present invention is described by taking a communication system based on the microservice framework Dubbo as an example.
[0062] The communication system based on the microservice framework Dubbo includes at least a server node (server) and a client node (client), and the communication connection establishment method of the present invention is applied to the server node.
[0063] After a server node and a client node establish a network connection, such as through a TCP three-way handshake, the first request message received by the server node from the client node is recorded as the first request message. The first request message may be a connection request based on a handshake protocol using a secure transport protocol, or a request based on a non-secure transport protocol, such as a Dubbo service message.
[0064] Step 302: Call a first processor to parse the first request message and determine a protocol type corresponding to the first request message.
[0065] As mentioned in the previous step description, the first request message could be a connection request based on a handshake protocol using a secure transport protocol, or a request based on a non-secure transport protocol. In this step, the first request message is parsed, and the protocol type corresponding to the first request message is determined based on the parsed result.
[0066] Specifically, the first processor is invoked to extract header information from the first request message, and then uses the header information to determine whether the first request message is a connection request based on a handshake protocol of a secure transmission protocol or a request based on a non-secure transmission protocol, thereby determining the protocol type corresponding to the first request message. Specifically, if the first request message is a connection request based on a handshake protocol of a secure transmission protocol, the protocol corresponding to the first request message is the secure transmission protocol; if the first request message is a request based on a non-secure transmission protocol, the protocol corresponding to the first request message is the non-secure transmission protocol.
[0067] For example, if the secure transport protocol is the SSL protocol, then a connection request based on the handshake protocol of the secure transport protocol is an SSL handshake request. An SSL handshake request begins with a fixed message header, and the magic number in the message header can be used to identify an SSL handshake request. By identifying the magic number in the message header of the first request message, it can be determined whether the first request message is an SSL handshake request. A similar method can be used for processing when the secure transport protocol is the TLS protocol.
[0068] By identifying and processing the magic number in the message header of the first request message, it is also possible to determine whether the first request message is a request based on an unsecured transmission protocol. For example, a Dubbo service message is a type of request based on an unsecured transmission protocol. A Dubbo service message begins with a fixed message header, and the magic number in the message header can be used to identify a Dubbo service message. By identifying and processing the magic number in the message header of the first request message, it is possible to determine whether the first request message is a Dubbo service message.
[0069] The function of the first processor has been described above. In this embodiment, the first processor can be called a checkSSLHandler processor.
[0070] Generally speaking, if the first request message is a connection request based on a handshake protocol of a secure transmission protocol, the first request message is sent by a client node that supports secure transmission protocol communication (ie, a modified client node).
[0071] Step 103: When the protocol type corresponding to the first request message is the secure transmission protocol, call a second processor to process the first request message to establish a communication connection based on the secure transmission protocol.
[0072] When it is confirmed that the protocol type corresponding to the first request message is a secure transmission protocol, in this step, the second processor is dynamically called to process the first request message, thereby establishing a communication connection based on the secure transmission protocol.
[0073] In this embodiment, if the secure transmission protocol is the SSL protocol, the second processor is an SSLHandler. The SSLHandler can complete the SSL handshake process and establish an encrypted communication connection. After the encrypted communication connection is established, the SSLHandler can also decrypt received data based on the SSL protocol or encrypt data to be sent based on the SSL protocol, thereby completing the SSL communication process.
[0074] The specific implementation process of the second processor establishing the communication connection based on the secure transmission protocol is common knowledge to those skilled in the art and will not be further described here.
[0075] The communication connection establishment method provided by the present invention can realize that one port of the server node supports both secure transmission protocols and non-secure transmission protocols by modifying the server node, thereby overcoming the problem in the prior art that it is very difficult to complete the modification of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications.
[0076] Based on any of the foregoing embodiments, in this embodiment, calling the second processor to process the first request message to establish a communication connection based on the secure transmission protocol includes:
[0077] loading and activating the second processor;
[0078] The second processor is called to execute a handshake process of a secure transmission protocol according to the first request message to establish a communication connection based on the secure transmission protocol.
[0079] In the prior art, the second processor is generally called in a default fixed order. For example, in Dubbo2.7.5, when the system is started, the functional modules are loaded in the following order by default: SSLHandler-EncoderHandler-DecoderHandler-DubboHandler.
[0080] In this embodiment, the second processor (SSLHandler) adopts a dynamic calling method, that is, only after confirming that the protocol type corresponding to the first request message is a secure transmission protocol (that is, determining that a connection request based on a handshake protocol based on a secure transmission protocol is received), the second processor will be loaded and activated, and then called.
[0081] Because the second processor is used to establish a communication connection based on a secure transmission protocol and to transmit data based on that communication connection, loading, activating, and invoking the second processor is only meaningful when the protocol type corresponding to the first request message is a secure transmission protocol. If the second processor is still invoked in a default fixed order according to the existing technology, it will not be applicable when the protocol type corresponding to the first request message is a non-secure transmission protocol, resulting in a waste of resources and time. More seriously, it will affect the processing of requests based on non-secure transmission protocols.
[0082] The communication connection establishment method provided by the present invention loads, activates and calls the second processor for establishing a communication connection based on a secure transmission protocol only when the protocol type corresponding to the first request message is a secure transmission protocol, which helps to reduce the waste of resources and time and avoids the adverse impact on the processing of requests based on non-secure transmission protocols.
[0083] Based on any of the above embodiments, in this embodiment, after establishing the communication connection based on the secure transmission protocol, the method further includes at least one of the following:
[0084] Invoking the second processor to receive a data packet from the client node and decrypt the data packet; invoking the third processor to decode and perform service processing on the decrypted data packet;
[0085] The third processor is called to encode the data packet to be sent; the second processor is called to encrypt the encoded data packet, and then the encrypted data packet is sent to the client node.
[0086] In the previous embodiment, the process of establishing a communication connection based on the secure transmission protocol is described. After the communication connection is established, data transmission can be achieved based on the communication connection.
[0087] Data transmission includes two directions: one is receiving data packets from external client nodes, and the other is sending its own data packets to external client nodes.
[0088] When receiving a data packet from an external client node, the second processor (such as SSLHandler) is first called to decrypt the received data packet according to the secure transmission protocol, and then the third processor is called to decode and process the decrypted data packet. In this embodiment, the third processor is a collective term for the nettyServerHandler, EncoderHandler, and DecoderHandler contained in the server node. For example, the DecoderHandler can be called to decode the data packet, and then the nettyServerHandler is called to process the decoded data packet.
[0089] When sending its own data packet to an external client node, the data to be sent is first obtained from the nettyServerHandler, then the EncoderHandler encodes the data to be sent, and then the second processor (such as SSLHandler) encrypts the received data packet according to the secure transmission protocol, and finally sends the encrypted data to the client node.
[0090] The communication connection establishment method provided by the present invention can realize the secure transmission of data through the communication connection based on the secure transmission protocol, which helps to improve the security of data.
[0091] Based on any of the foregoing embodiments, in this embodiment, the calling the first processor to parse the first request message and determine the protocol type corresponding to the first request message further includes:
[0092] In a case where the header information is a service processing request, it is determined that the protocol type corresponding to the first request message is a non-secure transmission protocol.
[0093] In the previous embodiment, the case where the first request message is a connection request based on a handshake protocol of a secure transmission protocol was discussed. In this embodiment, the case where the first request message is a request based on a non-secure transmission protocol will be discussed.
[0094] Since the first request message is the first request message received after the server node establishes a network connection with the client node, if the first request message is a service processing request, then the protocol type corresponding to the first request message can be considered to be a non-secure transmission protocol. Subsequently, data transmission can be carried out according to the non-secure transmission protocol.
[0095] Generally speaking, if the first request message is a request of a non-secure transmission protocol, the first request message is sent by a client node that supports communication using the non-secure transmission protocol (ie, an unmodified client node).
[0096] The communication connection establishment method provided by the present invention can realize that one port of the server node supports both secure transmission protocols and non-secure transmission protocols by modifying the server node, thereby overcoming the problem in the prior art that it is very difficult to complete the modification of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications.
[0097] Based on any of the above embodiments, in this embodiment, the method further includes:
[0098] In a case where the protocol type corresponding to the first request message is the non-secure transmission protocol, a third processor is called to decode and process the first request message.
[0099] The protocol type corresponding to the first request message is the non-secure transmission protocol, which means that the first request message is a service processing request. At this time, the aforementioned second processor will no longer be called, but the function module in the server node will be used to further process the service processing request.
[0100] In this embodiment, a third processor is called to process the service processing request. For example, the third processor is a collective term for the nettyServerHandler, EncoderHandler, and DecoderHandler included in the server node. The DecoderHandler can be called to decode the service processing request, and then the nettyServerHandler is called to perform service processing on the decoded service processing request.
[0101] Processors such as nettyServerHandler, EncoderHandler, and DecoderHandler are common knowledge in the field, so their workflows are not described in this embodiment.
[0102] The communication connection establishment method provided by the present invention can realize that one port of the server node supports both secure transmission protocols and non-secure transmission protocols by modifying the server node, thereby overcoming the problem in the prior art that it is very difficult to complete the modification of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications.
[0103] Based on any of the foregoing embodiments, in this embodiment, after calling the first processor to parse the first request message and determining the protocol type corresponding to the first request message, the method further includes:
[0104] Uninstall the first processor.
[0105] The functions of the first processor have been described in the previous embodiments. Since the first processor is only used to determine the protocol type corresponding to the first communication message during the initial phase before the communication connection is established, it no longer serves a purpose after the communication connection is established. Therefore, in this embodiment, a time limit is set for uninstalling the first processor. Specifically, after the first processor completes parsing the first request message and determines the protocol type corresponding to the first request message, the first processor can be uninstalled. This prevents the first processor from occupying server node resources due to long-term operation.
[0106] The communication connection establishment method provided by the present invention dynamically unloads the first processor after the first processor completes a predetermined function, thereby avoiding occupation of server node resources by the first processor during long-term operation.
[0107] Based on any of the foregoing embodiments, in this embodiment, before receiving the first request message from the client node, the method further includes:
[0108] Starting and initializing the server node; wherein, initializing the server node includes: loading and activating the first processor.
[0109] Those skilled in the art know that the server node needs to be initialized when it is started. In this embodiment, when the server node is initialized, it not only needs to load and activate functional modules such as nettyServerHandler, EncoderHandler, and DecoderHandler, but also needs to load and activate the first processor.
[0110] After the first processor is loaded and activated, when the server node receives the first request message, the first processor may be called to parse the first request message, thereby determining the protocol type corresponding to the first request message.
[0111] The communication connection establishment method provided by the present invention can realize that one port of the server node supports both secure transmission protocols and non-secure transmission protocols by modifying the server node, thereby overcoming the problem in the prior art that it is very difficult to complete the modification of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications.
[0112] The present invention will be further described below with reference to a specific example.
[0113] In this example, we still take the communication system based on the microservice framework Dubbo as an example.
[0114] In order to enable Dubbo's server node to support both SSL and non-SSL protocols on one port, the following modifications are made to Dubbo's server node: (1) Add checkSSLHandler to detect whether it is Dubbo protocol or SSL handshake protocol; (2) Change the SslHandler processor from fixed loading mode to dynamic loading mode. Figure 4 This is a schematic diagram of the modified server node.
[0115] Innovative changes:
[0116] Change 1 - Added checkSSLHandler processor: Added a checkSSLHandler processing class to the underlying Netty communication layer of the server node. The main functions of this processing Handler include: (1) Checking the header of the first request message after the connection is established, whether it is a dubbo request or an SSL Client Hello handshake request; both the dubbo protocol and the SSL ClientHello protocol start with a fixed header, also known as a magic number. Just by judging the magic number, you can know whether the first request is an SSL handshake request (corresponding to the client node that has upgraded SSL) or a dubbo business processing (corresponding to the client node that has not been upgraded). (2) If it is a dubbo request, the data processing does not enter the SSLHandler processing class; if it is an SSL ClientHello handshake request, the data request is handed over to the SSLHandler for processing; (3) After the first request processing is completed, the checkSSLHandler is dynamically uninstalled;
[0117] Change 2 - SSLHandler processing class: It is no longer loaded in a fixed order by default, but dynamically decides whether to load and activate it based on the inspection results of the checkSSLHandler processor.
[0118] Figure 5 This is a schematic diagram of the processing flow of the server node, such as Figure 5 As shown, after the TCP three-way handshake establishes a connection:
[0119] (1) If the client has not been upgraded, that is, the first message sent is dubbo protocol data. The checkSSLHandler of the server node checks the message header and finds that it is dubbo protocol. It bypasses the SSLHandler processor and directly uses the dubbo codec processor and business processor, while uninstalling the checkSSLHandler itself. The entire processing chain of the server node is transformed into Figure 6 shown.
[0120] (2) If the client is upgraded, the first message sent is the SSL Client Hello handshake request. The checkSSLHandler of the server node checks the message header and finds that it is the SSL protocol. It dynamically loads and activates the SSLHandler processor, then passes the message to the SSLHandler processor for processing, and finally uninstalls the checkSSLHandler itself. The entire processing chain of the server node is transformed into Figure 7 shown.
[0121] By adopting the method of the present invention, the same port in the server node of Dubbo can support both non-SSL protocol and SSL protocol, thereby reducing the cost of business transformation and going online.
[0122] The communication connection establishment device provided by the present invention is described below. The communication connection establishment device described below and the communication connection establishment method described above can be referenced to each other.
[0123] Figure 8 A schematic diagram of a communication connection establishment device provided by the present invention, such as Figure 8 As shown, the communication connection establishment device provided by the present invention includes:
[0124] The message receiving module 801 is configured to receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node;
[0125] A protocol type determination module 802 is configured to call a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol;
[0126] The communication connection establishing module 803 is configured to, when the protocol type corresponding to the first request message is the secure transmission protocol, call a second processor to process the first request message to establish a communication connection based on the secure transmission protocol.
[0127] The communication connection establishment device provided by the present invention is applied to the server node, which can enable one port of the server node to support both the secure transmission protocol and the non-secure transmission protocol, overcoming the problem in the prior art of having great difficulty in completing the transformation of all server nodes and client nodes at the same time, which will have an adverse impact on the normal development of network communications.
[0128] Based on any of the foregoing embodiments, in this embodiment, the protocol type determination module is specifically configured to:
[0129] Invoking a first processor to extract header information from the first request message;
[0130] In a case where the header information is a handshake request of a secure transmission protocol, it is determined that the protocol type corresponding to the first request message is a secure transmission protocol.
[0131] Based on any of the above embodiments, in this embodiment, the communication connection establishing module is specifically configured to:
[0132] loading and activating the second processor;
[0133] The second processor is called to execute a handshake process of a secure transmission protocol according to the first request message to establish a communication connection based on the secure transmission protocol.
[0134] Based on any of the above embodiments, in this embodiment, the apparatus further includes at least one of the following modules:
[0135] The data receiving module is configured to call the second processor to receive a data packet from the client node and decrypt the data packet; and call the third processor to decode and process the decrypted data packet.
[0136] The data sending module is used to call the third processor to encode the data packet to be sent; call the second processor to encrypt the encoded data packet, and then send the encrypted data packet to the client node.
[0137] Based on any of the foregoing embodiments, in this embodiment, the protocol type determination module is further configured to:
[0138] In a case where the header information is a service processing request, it is determined that the protocol type corresponding to the first request message is a non-secure transmission protocol.
[0139] Based on any of the above embodiments, in this embodiment, the device further includes:
[0140] The decoding and service processing module is used to call a third processor to decode and process the first request message when the protocol type corresponding to the first request message is the non-secure transmission protocol.
[0141] Based on any of the above embodiments, in this embodiment, the secure transmission protocol is the SSL protocol; accordingly,
[0142] The second processor is SSLHandler.
[0143] Based on any of the above embodiments, in this embodiment, the device further includes:
[0144] An uninstall module is used to uninstall the first processor.
[0145] Based on any of the above embodiments, in this embodiment, the device further includes:
[0146] A startup module is used to start and initialize the server node; wherein, initializing the server node includes: loading and activating the first processor.
[0147] Figure 9 An example of a physical structure diagram of an electronic device is shown below. Figure 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930, and a communication bus 940, wherein the processor 910, the communication interface 920, and the memory 930 communicate with each other via the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute a method for establishing a communication connection, which includes:
[0148] Receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node;
[0149] Invoking a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol;
[0150] In a case where the protocol type corresponding to the first request message is the secure transmission protocol, a second processor is called to process the first request message to establish a communication connection based on the secure transmission protocol.
[0151] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0152] On the other hand, the present invention further provides a computer program product, comprising a computer program stored on a non-transitory computer-readable storage medium, wherein the computer program comprises program instructions. When the program instructions are executed by a computer, the computer is capable of performing the communication connection establishment method provided by each of the above methods, the method comprising:
[0153] Receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node;
[0154] Invoking a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol;
[0155] In a case where the protocol type corresponding to the first request message is the secure transmission protocol, a second processor is called to process the first request message to establish a communication connection based on the secure transmission protocol.
[0156] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the above-mentioned communication connection establishment method, the method comprising:
[0157] Receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node;
[0158] Invoking a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol;
[0159] In a case where the protocol type corresponding to the first request message is the secure transmission protocol, a second processor is called to process the first request message to establish a communication connection based on the secure transmission protocol.
[0160] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0161] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for establishing a communication connection, characterized in that: The communication system based on the microservice framework includes at least a server node and a client node. The method is applied to the server node, including: Receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node; Invoking a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol; In a case where the protocol type corresponding to the first request message is the secure transmission protocol, calling a second processor to process the first request message to establish a communication connection based on the secure transmission protocol; The calling the first processor to parse the first request message and determine the protocol type corresponding to the first request message includes: Invoking a first processor to extract header information from the first request message; the header information includes a magic number; Identifying and processing the magic number of header information in the first request message, and determining that the handshake request is a secure transmission protocol, determining that the protocol type corresponding to the first request message is a secure transmission protocol; The magic number of the header information in the first request message is identified and processed. When it is determined to be a Dubbo service message, the protocol type corresponding to the first request message is determined to be a non-secure transmission protocol.
2. The method for establishing a communication connection according to claim 1, wherein: The calling of the second processor to process the first request message to establish a communication connection based on the secure transmission protocol includes: loading and activating the second processor; The second processor is called to execute a handshake process of a secure transmission protocol according to the first request message to establish a communication connection based on the secure transmission protocol.
3. The method for establishing a communication connection according to claim 2, wherein: After establishing the communication connection based on the secure transmission protocol, the method further includes at least one of the following: Invoking the second processor to receive a data packet from the client node and decrypt the data packet; invoking the third processor to decode and perform service processing on the decrypted data packet; The third processor is called to encode the data packet to be sent; the second processor is called to encrypt the encoded data packet, and then the encrypted data packet is sent to the client node.
4. The method for establishing a communication connection according to claim 1, wherein: The calling the first processor to parse the first request message and determine the protocol type corresponding to the first request message further includes: In a case where the header information is a service processing request, it is determined that the protocol type corresponding to the first request message is a non-secure transmission protocol.
5. The method for establishing a communication connection according to claim 1, wherein: The method also includes: In a case where the protocol type corresponding to the first request message is the non-secure transmission protocol, a third processor is called to decode and process the first request message.
6. The method for establishing a communication connection according to any one of claims 1 to 5, wherein: The secure transmission protocol is the SSL protocol; accordingly, The second processor is SSLHandler.
7. The method for establishing a communication connection according to any one of claims 1 to 5, characterized in that: After calling the first processor to parse the first request message and determining the protocol type corresponding to the first request message, the method further includes: Uninstall the first processor.
8. The method for establishing a communication connection according to any one of claims 1 to 5, wherein: Before receiving the first request message from the client node, the method further includes: Starting and initializing the server node; wherein, initializing the server node includes: loading and activating the first processor.
9. A communication connection establishing device, characterized in that: The communication system based on the microservice framework includes at least a server node and a client node. The device is applied to the server node and includes: A message receiving module, configured to receive a first request message from a client node; wherein the first request message is the first request message received after the server node establishes a network connection with the client node; a protocol type determination module, configured to call a first processor to parse the first request message and determine a protocol type corresponding to the first request message, where the protocol type includes a secure transmission protocol or a non-secure transmission protocol; a communication connection establishing module, configured to, when the protocol type corresponding to the first request message is the secure transmission protocol, call a second processor to process the first request message to establish a communication connection based on the secure transmission protocol; The protocol type determination module is specifically used to: Invoking a first processor to extract header information from the first request message; the header information includes a magic number; Identifying and processing the magic number of header information in the first request message, and determining that the handshake request is a secure transmission protocol, determining that the protocol type corresponding to the first request message is a secure transmission protocol; The magic number of the header information in the first request message is identified and processed. When it is determined to be a Dubbo service message, the protocol type corresponding to the first request message is determined to be a non-secure transmission protocol.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the communication connection establishment method according to any one of claims 1 to 8 are implemented.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the communication connection establishment method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Method and device for user terminal of enterprise mobile private network to access public network
CN108696546A
Service access method and device
CN110392066A
Message processing method and device, computing equipment and readable storage medium
CN112615822A