Communication connection establishment method, device, electronic device and storage medium
By setting switch information for the service consumer end and service provider end in the microservice framework, we jointly decide whether to establish a communication connection based on the secure transmission protocol, solving the problem of the inability to accurately control the opening of SSL links in the prior art, and realizing the precise control of communication connections and the gradual gray-scale online function.
Patent Information
- Application Number
- CN202110723344.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-06-28
AI Technical Summary
When the existing microservice framework opens the SSL link, it cannot meet the requirements of gradual grayscale online, resulting in the inability to accurately control whether the service consumer side opens the SSL link.
By setting switch information separately on the service consumer end and the service provider end, the service consumer end and the service provider end jointly decide whether to establish a communication connection based on the secure transmission protocol to achieve precise control of the SSL link.
It realizes precise control over whether the communication connection is enabled or not based on the secure transmission protocol, meets the requirements of gradually gray-scale onlineization of the service consumer side, and avoids online problems caused by passive opening of the SSL link.
Smart Images

Figure CN115604337B_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, Dubbo, etc.
[0003] Early versions of the microservice framework generally use a network transmission protocol that transmits plain text (referred to as the plain text transmission protocol) to achieve communication between microservices. Messages transmitted in plain text are at risk of being eavesdropped, tampered with, or forged, so later versions of the microservice framework also provide the function of achieving communication between microservices through a secure transmission protocol. Common secure transmission protocols include the SSL (Secure Sockets Layer) protocol and its successor, the TLS (Transport Layer Security) protocol.
[0004] The communication system based on the microservice framework includes a service provider, a service consumer, and a registration center. When communication between microservices needs to be achieved through a secure transmission protocol, a secure transmission channel, such as an SSL link, can be established between the service provider and the service consumer.
[0005] In some microservice frameworks, whether to open the SSL link is determined by the service provider. Once the service provider decides to open the SSL link, all service consumers connected to it will passively open the SSL link, which cannot meet the requirements of gradual grayscale launch. Summary of the invention
[0006] 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.
[0007] The present invention provides a method for establishing a communication connection, which is applied to a service consumer node, and the method comprises:
[0008] Acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node;
[0009] In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, a communication connection based on the secure transmission protocol is established between the service consumption end node and the service provision end node.
[0010] According to a method for establishing a communication connection provided by the present invention, when both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, establishing a communication connection based on the secure transmission protocol between the service consumer end node and the service provider end node includes:
[0011] In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, calling a first processor;
[0012] A communication connection based on a secure transmission protocol is established between the service consuming end node and the service providing end node through the first processor.
[0013] According to a communication connection establishment method provided by the present invention, the secure transmission protocol is the SSL protocol; accordingly,
[0014] The first processor is SSLHandler.
[0015] According to a method for establishing a communication connection provided by the present invention, the method further includes:
[0016] In the case where at least one of the first connection mode and the second connection mode is a connection mode based on a non-secure transmission protocol, a communication connection based on a non-secure transmission protocol is established between the service consumer end node and the service provider end node.
[0017] According to a method for establishing a communication connection provided by the present invention, the method further includes:
[0018] The first switch information is set at the service consumer node by setting an environment variable.
[0019] According to a method for establishing a communication connection provided by the present invention, the first switch information is set in the service consumer node by setting an environment variable, including:
[0020] In the case where the service consumer node is determined to be published, first switch information is set at the service consumer node by setting an environment variable, wherein the first switch information is used to indicate that a first connection mode supported by the service consumer node is a connection mode based on the secure transmission protocol;
[0021] And, when the service consumer node is determined not to be published, first switch information is set at the service consumer node by setting an environment variable, and the first switch information is used to indicate that the first connection method supported by the service consumer node is a connection method based on the non-secure transmission protocol.
[0022] According to a method for establishing a communication connection provided by the present invention, the method further includes:
[0023] In the case of monitoring that the service provider node is started, second switch information is obtained from the registration center, where the second switch information is registered to the registration center by the service provider node when it is started.
[0024] The present invention also provides a service consumption end node, comprising:
[0025] A switch information acquisition module, used to acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node;
[0026] A communication connection establishing module based on a secure transmission protocol is used to establish a communication connection based on a secure transmission protocol between the service consumer end node and the service provider end node when both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol.
[0027] The present invention also provides a communication system, comprising:
[0028] A service provider node, a registration center, and a plurality of service consumer nodes.
[0029] 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 when executing the program.
[0030] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the communication connection establishment method are implemented.
[0031] The communication connection establishment method, device, electronic device and storage medium provided by the present invention jointly decide whether to establish a communication connection based on the secure transmission protocol between the service consumer node and the service provider node, and different service consumer nodes in the same communication system do not affect each other. Therefore, it can meet the requirements of gradually graying out the service consumer nodes and realize precise control of whether the communication connection based on the secure transmission protocol is opened or not. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 A flowchart of a method for establishing a communication connection based on Dubbo2.7.5 in the prior art;
[0034] Figure 2 A flow chart of a method for establishing a communication connection provided by the present invention;
[0035] Figure 3 A schematic diagram of a service provider node having the function of supporting both a secure transmission protocol and a non-secure transmission protocol in one embodiment;
[0036] Figure 4 is a flow chart of establishing a connection between a service provider node and a service consumer node in an embodiment;
[0037] Figure 5 is a schematic diagram of a processing link of a service consumer node when SSLHandler is loaded in one embodiment;
[0038] Figure 6 A schematic diagram of a service consumer node provided by the present invention;
[0039] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] In the present invention, the microservice framework Dubbo is taken as an example to illustrate the method of the present invention. For ease of understanding, the microservice framework Dubbo is first introduced.
[0042] Dubbo is widely used in business system construction to complete communication between microservices. In versions prior to Dubbo 2.7.5, microservices communicated in plain text, which resulted in the risk of messages being eavesdropped, tampered with, or forged. Starting from Dubbo 2.7.5, SSL communication function is provided, and the service provider decides whether to enable the SSL link.
[0043] Figure 1 The following is a flowchart of a method for establishing a communication connection based on Dubbo 2.7.5. Figure 1 As shown, the method includes:
[0044] Step 101: When the service provider is started, the switch information that determines whether the SSL link is turned on is registered with the registration center.
[0045] In this step, a switch parameter can be set for the service provider, and whether the SSL link is opened or not can be determined by assigning a value to the switch parameter. For example, the switch parameter is recorded as sslenable, when sslenable=true, the SSL link is opened; when sslenable=false, the SSL link is closed.
[0046] The switch parameters may be registered in a registration center.
[0047] Step 102: After monitoring the changes of the service provider, each node as the service consumer obtains the switch information from the registration center.
[0048] In this step, the switch information is generally stored in the service provider list. After each node as the service consumer monitors the changes of the service provider, it pulls the latest service provider list from the registration center to obtain the switch information.
[0049] Step 103: When each node serving as a service consumer establishes a connection with a service provider, it reads the switch information of the service provider.
[0050] Step 104: When the switch information of the service provider is set to open the SSL link, each node as the service consumer establishes an SSL link with the service provider.
[0051] From the above description, it can be seen that according to the settings of Dubbo2.7.5, whether to open the SSL link is determined by the service provider. Once the service provider decides to open the SSL link, all service consumers connected to it will passively open the SSL link. It is impossible to accurately control whether different service consumers open the SSL link, and it is impossible to meet the requirements of gradual grayscale launch in actual application scenarios.
[0052] Combine the following Figure 2-Figure 7The present invention describes a method, device, electronic device and storage medium for establishing a communication connection.
[0053] Figure 2 The flowchart of the communication connection establishment method provided by the present invention is applied to the service consumer node, such as Figure 2 As shown, the method includes:
[0054] Step 201: Acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node;
[0055] Step 202: When both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, a communication connection based on the secure transmission protocol is established between the service consumer node and the service provider node.
[0056] 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.
[0057] The communication system based on the microservice framework Dubbo includes at least a service provider node (provider) and a service consumer node (consumer), and the network communication connection establishment method of the present invention is applied to the service consumer node.
[0058] As a prerequisite for the implementation of the method of the present invention, the service provider node involved in the method of the present invention should have the function of supporting both the secure transmission protocol and the non-secure transmission protocol.
[0059] Figure 3 FIG. 1 is a schematic diagram of a service provider node having the function of supporting both secure transmission protocol and non-secure transmission protocol in one embodiment. Figure 3As shown, the provider node includes checkSSLHandler, SSLHandler, DecoderHandler, EncoderHandler and nettyServerHandler. Among them, checkSSLHandler is used to check the message header (header) of the first request message after the connection is established, and determine whether the message header is a non-SSL request (such as dubbo request) or an SSL Client Hello handshake request. If it is an SSL Client Hello handshake request, the data request is handed over to SSLHandler for processing; if it is a non-SSL request, the data request bypasses SSLHandler, and a module in DecoderHandler, EncoderHandler or nettyServerHandler performs subsequent processing on the data request. After the first request message is processed, checkSSLHandler is dynamically uninstalled. SSLHandler can complete the SSL handshake process and establish an encrypted transmission channel. After the encrypted transmission channel is established, SSLHandler can also decrypt the received data based on the SSL protocol, or encrypt the data to be sent based on the SSL protocol, thereby completing the SSL communication process. DecoderHandler is used to implement data decryption. EncoderHandler is used to implement data encryption. nettyServerHandler is used to implement business processing.
[0060] It can be seen from the above description that the service provider node of the above structure can support both the secure transmission protocol and the non-secure transmission protocol based on one port.
[0061] In this embodiment, a switch information is set for each of the service consumer node and the service provider node. The first switch information is used to indicate whether the service consumer node supports a connection method based on a secure transmission protocol or a connection method based on a non-secure transmission protocol. The second switch information is used to indicate whether the service provider node supports a connection method based on a secure transmission protocol or a connection method based on a non-secure transmission protocol.
[0062] A communication connection based on a secure transmission protocol can be established between the service consumer node and the service provider node only when both conditions are met: the service consumer node supports a connection method based on a secure transmission protocol, and the service provider node supports a connection method based on a secure transmission protocol.
[0063] As the name implies, switch information refers to information with two states, "on" and "off". In the present invention, the two states that can be expressed by the switch information can be used to describe whether the service consumer node or the service provider node supports a connection method based on a secure transmission protocol or a connection method based on a non-secure transmission protocol.
[0064] In this embodiment, both the first switch information and the second switch information can be represented by binary bits. For example, the first switch information can be represented by a binary bit. When the value of the binary bit is "1", the first switch information indicates that the service consumer node supports a connection method based on a secure transmission protocol. When the value of the binary bit is "0", the first switch information indicates that the service consumer node supports a connection method based on a non-secure transmission protocol. Similarly, the second switch information can be represented by another binary bit. When the value of the binary bit is "1", the second switch information indicates that the service provider node supports a connection method based on a secure transmission protocol. When the value of the binary bit is "0", the first switch information indicates that the service provider node supports a connection method based on a non-secure transmission protocol.
[0065] It should be noted that there may be multiple service consumer nodes in a communication system, and different service consumer nodes have their own corresponding first switch information. That is, if there is a service consumer node A and a service consumer node B in a communication system. The first switch information corresponding to the service consumer node A cannot be used to indicate the service consumer node B, and similarly, the first switch information corresponding to the service consumer node B cannot be used to indicate the service consumer node A.
[0066] From the above description, it can be seen that according to the communication connection establishment method provided by the present invention, to establish a communication connection based on a secure transmission protocol between a service consumer node and a service provider node, it will no longer be determined solely by the service provider node, but the result of the joint action of the service consumer node and the service provider node. Moreover, different service consumer nodes in the same communication system do not affect each other, so it can meet the requirements of the gradual grayscale launch of service consumer nodes, and realize the precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0067] Based on any of the foregoing embodiments, in this embodiment, when both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, establishing a communication connection between the service consumer node and the service provider node based on the secure transmission protocol includes:
[0068] In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, calling a first processor;
[0069] A communication connection based on a secure transmission protocol is established between the service consuming end node and the service providing end node through the first processor.
[0070] In this embodiment, when the first connection mode and the second connection mode are both connection modes based on the secure transmission protocol, the first processor can be called to establish a communication connection between the service consumer node and the service provider node based on the secure transmission protocol.
[0071] For example, if the secure transmission protocol is the SSL protocol, the first processor is SSLHandler. As mentioned in the previous description, SSLHandler can complete the SSL handshake process and establish an encrypted transmission channel. Therefore, by calling SSLHandler, a communication connection based on the SSL protocol can be established between the service consumer node and the service provider node.
[0072] The communication connection establishment method provided by the present invention jointly decides whether to establish a communication connection based on the secure transmission protocol between the service consumer node and the service provider node, and different service consumer nodes in the same communication system do not affect each other. Therefore, it can meet the requirements of gradually graying out the service consumer nodes and realize precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0073] Based on any of the above embodiments, in this embodiment, the method further includes:
[0074] In the case where at least one of the first connection mode and the second connection mode is a connection mode based on a non-secure transmission protocol, a communication connection based on a non-secure transmission protocol is established between the service consumer end node and the service provider end node.
[0075] In the previous embodiment, the process of establishing a communication connection based on a secure transmission protocol between the service consumer node and the service provider node is described. In this embodiment, the process of establishing a communication connection based on a non-secure transmission protocol between the service consumer node and the service provider node is described.
[0076] In the present invention, a switch information is set for each of the service consumer node and the service provider node. As described in the previous embodiment, the first switch information set for the service consumer node has two states, namely, indicating that the service consumer node supports a connection method based on a secure transmission protocol, and indicating that the service consumer node supports a connection method based on a non-secure transmission protocol; the second switch information set for the service provider node also has two states, namely, indicating that the service provider node supports a connection method based on a secure transmission protocol, and indicating that the service provider node supports a connection method based on a non-secure transmission protocol.
[0077] In this embodiment, according to the first switch information and the second switch information, when at least one of the service consumer node and the service provider node supports a connection method based on a non-secure transmission protocol, a communication connection based on a non-secure transmission protocol is established between the service consumer node and the service provider node.
[0078] In this embodiment, the non-secure transmission protocol may be a plain text transmission protocol, such as TCP / IP, FTP, HTTP, POP, Telent, etc.
[0079] The communication connection establishment method provided by the present invention jointly decides whether to establish a communication connection based on the secure transmission protocol between the service consumer node and the service provider node, and different service consumer nodes in the same communication system do not affect each other. Therefore, it can meet the requirements of gradually graying out the service consumer nodes and realize precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0080] Based on any of the above embodiments, in this embodiment, the method further includes:
[0081] The first switch information is set at the service consumer node by setting an environment variable.
[0082] In this embodiment, when the service consumer node is published, the first switch information can be injected into the environment variable by exporting, so as to set the first switch information for the service consumer node.
[0083] The communication connection establishment method provided by the present invention can set respective configuration information for different service consumer end nodes, thereby realizing precise control over whether each service consumer end node opens a communication connection based on the secure transmission protocol.
[0084] Based on any of the above embodiments, in this embodiment, setting the first switch information in the service consumer node by setting the environment variable includes:
[0085] In the case where the service consumer node is determined to be published, first switch information is set at the service consumer node by setting an environment variable, wherein the first switch information is used to indicate that a first connection mode supported by the service consumer node is a connection mode based on the secure transmission protocol;
[0086] And, when the service consumer node is determined not to be published, first switch information is set at the service consumer node by setting an environment variable, and the first switch information is used to indicate that the first connection method supported by the service consumer node is a connection method based on the non-secure transmission protocol.
[0087] The method of the present invention can be used in the application scenario of "gray-scale launch". The so-called "gray-scale launch" simply means opening multiple functions of the communication system one by one, or opening the functions of the communication system to multiple customers in batches.
[0088] Based on the application scenario of "gray-scale launch", in the present invention, it is necessary to independently control the connection mode between the service provider node and multiple service consumer nodes.
[0089] For example, in an application scenario, there is usually only one service provider node, which can be recorded as node A, and there are usually multiple service consumer nodes. Assuming there are four, they can be recorded as node B, node C, node D, and node E. Communication connections AB, AC, AD, and AE can be established between the service provider node and the service consumer node. If a "grayscale launch" is required, it is necessary to determine whether the communication connections AB, AC, AD, and AE are based on a secure transmission protocol or a non-secure transmission protocol.
[0090] Since there is only one service provider node, the implementation of "grayscale launch" is mainly achieved through the service consumer node. Specifically, the first switch information is set in the service consumer node by setting the environment variable. If the first switch information indicates that the service consumer node supports a connection method based on a secure transmission protocol, then when the service provider node also supports a connection method based on a secure transmission protocol, the communication connection established between the two is a communication connection based on a secure transmission protocol; if the first switch information indicates that the service consumer node supports a connection method based on a non-secure transmission protocol, then the communication connection established between the two is a communication connection based on a non-secure transmission protocol.
[0091] For example, in the aforementioned application scenario, at the first moment, the communication connection AB is required to be a communication connection based on a secure transmission protocol, while the communication connections AC, AD, and AE are communication connections based on an unsecure transmission protocol. In view of this situation, node A is required to first be set to support the secure transmission protocol through the second switch information, and then node B is set to support the secure transmission protocol by setting the environment variable, and node C, node D, and node E are set to support the unsecure transmission protocol, so as to meet the user's needs. At the second moment, the demand changes, and the communication connections AB and AC are required to be communication connections based on a secure transmission protocol, while the communication connections AD and AE are communication connections based on an unsecure transmission protocol. In view of this situation, node C can be set to support the secure transmission protocol by setting the environment variable, so as to meet the user's needs. At the third moment, the demand changes again, and the communication connections AB, AC, and AD are required to be communication connections based on a secure transmission protocol, while the communication connection AE is a communication connection based on an unsecure transmission protocol. In view of this situation, node D can be set to support the secure transmission protocol by setting the environment variable, so as to meet the user's needs.
[0092] The communication connection establishment method provided by the present invention can set respective configuration information for different service consumer nodes, thereby realizing precise control over whether each service consumer node starts a communication connection based on the secure transmission protocol, thereby meeting the requirements of "grayscale launch".
[0093] Based on any of the above embodiments, in this embodiment, the method further includes:
[0094] In the case of monitoring that the service provider node is started, second switch information is obtained from the registration center, where the second switch information is registered to the registration center by the service provider node when it is started.
[0095] The second switch information is set for the service provider node, and the service consumer node can directly obtain the second switch information through the registration center. For example, after the service provider node is started, the second switch information is registered to the registration center. The service consumer node monitors the service provider node, and when the service provider node is started, it obtains the second switch information from the registration center and saves it locally. Subsequently, based on the second switch information and in conjunction with the first switch information, it can be determined whether to establish a communication connection based on a secure transmission protocol between the service consumer node and the service provider node.
[0096] The communication connection establishment method provided by the present invention can provide the configuration information of the service provider node side for the service consumer node, and realizes the precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0097] The present invention is further described below in conjunction with a specific example.
[0098] In this example, a communication system based on the microservice framework Dubbo is still taken as an example.
[0099] The present invention proposes a method for accurately controlling the SSL function of a specified link based on a dual switch mode, that is, in addition to the switch of the service provider node (provider), the service consumer node (consumer) is also set with a switch. Only when the switches of both the provider and the consumer are turned on, the connection is created using the SSL method. This avoids the situation where the consumer is not fully prepared, such as not configuring a certificate, and passively turning on SSL, causing online problems.
[0100] The switch of the Consumer can be injected into the environment variables through the export method when the publishing system is published on the consumer side. That is, different settings can be configured for each different machine to achieve precise control.
[0101] In the present invention, the provider is required to support both SSL and non-SSL protocols on the same port.
[0102] Figure 4 FIG. 1 is a flow chart of establishing a connection between a service provider node and a service consumer node in one embodiment. Figure 4 As shown in the figure, after the online changes, the entire process of establishing a connection between the consumer and the provider is as follows:
[0103] (1) After the service provider configures the SSL switch, it registers the switch sslenable=true to the registration center at startup;
[0104] (2) Each machine on the service consumer side monitors the changes of the provider, pulls the latest provider list, and obtains the SSLenable switch information of the provider;
[0105] (3) When each consumer establishes a connection with a remote provider, it reads the provider's sslEnable switch and also reads the consumer-side sslEnable switch from the environment variable. Only when both the local consumer-side sslEnable switch and the remote provider's sslEnable switch are turned on, can the consumer establish SSL with the remote provider.
[0106] The SSL switch on the consumer side is injected by the publishing system through environment variables. The underlying Netty client on the consumer side will load SSLHandler before loading it if both switches are turned on. The processing chain of Nettyclient is as follows Figure 5 If not satisfied, SSLHandler is not loaded.
[0107] (4) If the SSL switch of the remote provider is set to on and the SSL switch of the local consumer is also on, a single consumer establishes an SSL connection with the remote provider;
[0108] (5) If the SSL switch of the remote provider is not turned on, and the SSL switch of the local consumer is turned on, since the condition of turning on both switches at the same time is not met, non-SSL communication will continue;
[0109] (6) If the SSLenable switch of the remote provider is set to on, and the SSLenable switch of the local consumer is not set or is turned off, since the condition of turning on both switches at the same time is not met, non-SSL communication will continue;
[0110] (7) If neither the remote provider nor the local consumer has set the SSL switch, non-SSL communication will continue.
[0111] From the above description, it can be seen that when the service consumer publishes one by one through the publishing system, different environment variables can be injected to accurately control whether SSL is enabled for the specified link (the provider switch is turned on by default), thus achieving the effect of grayscale specified links.
[0112] The service consumer node provided by the present invention is described below. The service consumer node described below and the communication connection establishment method described above can be referenced to each other.
[0113] Figure 6 A schematic diagram of a service consumer node provided by the present invention, such as Figure 6 As shown, the service consumption end node provided by the present invention includes:
[0114] The switch information acquisition module 601 is used to acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node;
[0115] The communication connection establishing module 602 based on the secure transmission protocol establishes a communication connection based on the secure transmission protocol between the service consumer node and the service provider node when both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol.
[0116] The service consumption end node and the service provision end node provided by the present invention jointly decide whether to establish a communication connection based on the secure transmission protocol between the two, and different service consumption end nodes in the same communication system do not affect each other. Therefore, it can meet the requirements of gradually graying out the service consumption end nodes and realize precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0117] Based on any of the foregoing embodiments, in this embodiment, when both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, establishing a communication connection between the service consumer node and the service provider node based on the secure transmission protocol includes:
[0118] In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, calling a first processor;
[0119] A communication connection based on a secure transmission protocol is established between the service consuming end node and the service providing end node through the first processor.
[0120] Based on any of the above embodiments, in this embodiment, the secure transmission protocol is the SSL protocol; accordingly,
[0121] The first processor is SSLHandler.
[0122] Based on any of the above embodiments, in this embodiment, the service consumer node further includes:
[0123] A communication connection establishing module based on a non-secure transmission protocol is used to establish a communication connection based on a non-secure transmission protocol between the service consumer end node and the service provider end node when at least one of the first connection mode and the second connection mode is a connection mode based on a non-secure transmission protocol.
[0124] The service consumption end node and the service provision end node provided by the present invention jointly decide whether to establish a communication connection based on the secure transmission protocol between the two, and different service consumption end nodes in the same communication system do not affect each other. Therefore, it can meet the requirements of gradually graying out the service consumption end nodes and realize precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0125] Based on any of the above embodiments, in this embodiment, the service consumer node further includes:
[0126] The first switch information setting module is used to set the first switch information in the service consumer node by setting environment variables.
[0127] The service consumer end nodes provided by the present invention can each independently set configuration information to achieve accurate control of whether each service consumer end node opens a communication connection based on the secure transmission protocol.
[0128] Based on any of the above embodiments, in this embodiment, setting the first switch information in the service consumer node by setting the environment variable includes:
[0129] In the case where the service consumer node is determined to be published, first switch information is set at the service consumer node by setting an environment variable, wherein the first switch information is used to indicate that a first connection mode supported by the service consumer node is a connection mode based on the secure transmission protocol;
[0130] And, when the service consumer node is determined not to be published, first switch information is set at the service consumer node by setting an environment variable, and the first switch information is used to indicate that the first connection method supported by the service consumer node is a connection method based on the non-secure transmission protocol.
[0131] Based on any of the above embodiments, in this embodiment, the service consumer node further includes:
[0132] The second switch information setting module is used to obtain second switch information from the registration center when monitoring the startup of the service provider node, and the second switch information is registered to the registration center by the service provider node when it is started.
[0133] The service consumption end node provided by the present invention can automatically obtain the configuration information of the service provision end node side, thereby realizing the precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0134] The present invention also provides a communication system, comprising:
[0135] A service provider node, a registration center, and multiple service consumer nodes as described above.
[0136] The communication system provided by the present invention jointly decides whether to establish a communication connection based on the secure transmission protocol between the service consumer node and the service provider node, and different service consumer nodes in the same communication system do not affect each other. Therefore, it can meet the requirements of gradually graying out the service consumer nodes and realize precise control of whether the communication connection based on the secure transmission protocol is opened or not.
[0137] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the communication connection establishment method, which includes:
[0138] Acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node;
[0139] In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, a communication connection based on the secure transmission protocol is established between the service consumption end node and the service provision end node.
[0140] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, 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, and the computer software product is stored in a storage medium, including a number of instructions for 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: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0141] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, and when the program instructions are executed by a computer, the computer can execute the communication connection establishment method provided by the above methods, the method comprising:
[0142] Acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node;
[0143] In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, a communication connection based on the secure transmission protocol is established between the service consumption end node and the service provision end node.
[0144] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the above-mentioned communication connection establishment method, the method comprising:
[0145] Acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node;
[0146] In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, a communication connection based on the secure transmission protocol is established between the service consumption end node and the service provision end node.
[0147] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0148] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for 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 some parts of the embodiments.
[0149] 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 embodiments of the present invention.
Claims
1. A method for establishing a communication connection, characterized in that: Applied to the service consumer nodes that are gradually launched in grayscale, the methods include: Acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node, wherein different service consumer nodes have their own corresponding first switch information; In the case where both the first connection mode and the second connection mode are connection modes based on a secure transmission protocol, establishing a communication connection between the service consumption end node and the service provision end node based on a secure transmission protocol; In the case where at least one of the first connection mode and the second connection mode is a connection mode based on a non-secure transmission protocol, establishing a communication connection between the service consumption end node and the service provision end node based on the non-secure transmission protocol; Among them, the secure transmission protocol is the SSL protocol, and the non-secure transmission protocols include TCP / IP, FTP, HTTP, POP, and Telent; the service provider node supports both the secure transmission protocol and the non-secure transmission protocol based on one port.
2. The method for establishing a communication connection according to claim 1, characterized in that: The establishing of a communication connection between the service consumer node and the service provider node based on the secure transmission protocol when both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol includes: In the case where both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol, calling a first processor; A communication connection based on a secure transmission protocol is established between the service consuming end node and the service providing end node through the first processor.
3. The method for establishing a communication connection according to claim 2, characterized in that: The first processor is SSLHandler.
4. The method for establishing a communication connection according to any one of claims 1 to 3, characterized in that: The method also includes: The first switch information is set at the service consumer node by setting an environment variable.
5. The method for establishing a communication connection according to claim 1, characterized in that: Setting the first switch information at the service consumer node by setting an environment variable includes: In the case where the service consumer node is determined to be published, first switch information is set at the service consumer node by setting an environment variable, wherein the first switch information is used to indicate that a first connection mode supported by the service consumer node is a connection mode based on the secure transmission protocol; And, when the service consumer node is determined not to be published, first switch information is set at the service consumer node by setting an environment variable, and the first switch information is used to indicate that the first connection method supported by the service consumer node is a connection method based on the non-secure transmission protocol.
6. The method for establishing a communication connection according to any one of claims 1 to 3, characterized in that: The method also includes: In the case of monitoring that the service provider node is started, second switch information is obtained from the registration center, where the second switch information is registered to the registration center by the service provider node when it is started.
7. A service consumer node that is gradually launched in grayscale, characterized in that: include: A switch information acquisition module, used to acquire first switch information and second switch information, wherein the first switch information is used to indicate a first connection mode supported by the service consumer node, and the second switch information is used to indicate a second connection mode supported by the service provider node, wherein different service consumer nodes have their own corresponding first switch information; A communication connection establishment module based on a secure transmission protocol, which establishes a communication connection between the service consumer node and the service provider node based on a secure transmission protocol when both the first connection mode and the second connection mode are connection modes based on the secure transmission protocol; The service consumer node also includes: A communication connection establishment module based on a non-secure transmission protocol, according to the first switch information and the second switch information, when at least one of the service consumer end node and the service provider end node supports a connection mode based on a non-secure transmission protocol, a communication connection based on a non-secure transmission protocol is established between the service consumer end node and the service provider end node; Among them, the secure transmission protocol is the SSL protocol, and the non-secure transmission protocols include TCP / IP, FTP, HTTP, POP, and Telent; the service provider node supports both the secure transmission protocol and the non-secure transmission protocol based on one port.
8. A communication system, characterized in that: include: A service provider node, a registration center, and a plurality of service consumer nodes that are gradually launched in grayscale as described in claim 7.
9. 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 6 are implemented.
10. 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 method for establishing a communication connection as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method, device and network for establishing connections between home networks
CN101873245A
Processing method supporting both TLS short connection and long connection, processing system supporting both TLS short connection and long connection, and equipment
CN103312731A