Method and system for downloading configuration data by expanding SOCKS5 command set

By extending the SOCKS5 command set, the client obtains configuration data within the protocol framework, solving the problems of low efficiency and poor reliability of manual configuration in large-scale deployments, and realizing efficient and reliable configuration data acquisition and business access.

CN121967195APending Publication Date: 2026-05-01CBC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CBC TECH CO LTD
Filing Date
2025-12-24
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In large-scale deployments of the SOCKS5 protocol, manual configuration or pushing configuration parameters through independent channels is inefficient and susceptible to network fluctuations, resulting in poor reliability of configuration transmission and impacting service deployment progress and user access experience.

Method used

By extending the SOCKS5 command set, the client initiates a configuration parameter request within the protocol framework, and the server responds with configuration data. Combined with fragmentation processing, verification retransmission, and rate limiting mechanisms, reliable acquisition and transmission of configuration data are ensured.

Benefits of technology

It eliminates the need for off-band management, reduces manual configuration costs, adapts to large-scale deployments, ensures the reliability and stability of configuration acquisition, and improves network interaction efficiency and usability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121967195A_ABST
    Figure CN121967195A_ABST
Patent Text Reader

Abstract

The invention relates to a method and a system for realizing configuration data downloading by expanding an SOCKS5 command set. The method comprises the following steps of: initiating transmission layer connection to an SOCKS5 server through an SOCKS5 client; the client completes user authentication interaction with the server based on the SOCKS5 protocol; after authentication, the client sends a configuration parameter request command to the server at any moment before service data transmission, and the configuration parameter request command is used for requesting to access configuration data required by a target resource; the client receives a configuration data response command from the server; the client obtains configuration data based on the response command; the client sends an access target resource request command to the server according to the SOCKS5 protocol based on the configuration data; the client receives an access target resource response command from the server; and the client starts to transmit the service layer data to the server based on the response command. According to the scheme, the SOCKS5 command set is extended without out-of-band management, the cost is saved, fragmentation, verification and current limiting are kept stable, additional functions such as statistics can be realized, and the network interaction efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

A method and system for downloading configuration data by extending the SOCKS5 command set. Technical Field

[0001] This application relates to the field of network communication technology, and in particular to a method and system for downloading configuration data by extending the SOCKS5 command set. Background Technology

[0002] In the field of network communication, SOCKS5, as a mainstream proxy protocol (RFC 1928) that supports anonymity, cross-protocol transmission and UDP forwarding, is widely used in scenarios where clients access Internet resources due to its multiple authentication methods (such as username and password, GSSAPI, etc.) and scalable authentication features.

[0003] However, in actual deployments, access to resources for different purposes depends on specific configurations (such as the address of the front-end load balancer), and the SOCKS5 server needs to pre-configure these access parameters for clients through out-of-band management methods (such as manual configuration, push through an independent management channel, etc.). This method has significant drawbacks in large-scale deployment scenarios: on the one hand, manual configuration or push through an independent channel requires additional hardware and manpower costs, and the configuration efficiency is low, making it difficult to adapt to the dynamic changes in resources; on the other hand, out-of-band channels are susceptible to network fluctuations, resulting in poor reliability of configuration transmission, frequent configuration delays or losses, causing clients to be unable to obtain the correct access parameters in a timely manner, thereby affecting the business deployment progress, reducing the user access experience, and becoming a key bottleneck in the practical application of the SOCKS5 protocol. Summary of the Invention

[0004] In view of this, this application proposes a method for a SOCKS5 client to download configuration data by extending the SOCKS5 command set, comprising the following steps: the SOCKS5 client initiates a transport layer connection to the SOCKS5 server; the SOCKS5 client completes user authentication interaction with the SOCKS5 server based on the SOCKS5 protocol; at any time after user authentication and before business data transmission, the SOCKS5 client sends a configuration parameter request command to the SOCKS5 server, wherein the configuration parameter request command is used to request the configuration data required to access the target resource; the SOCKS5 client receives a configuration data response command from the SOCKS5 server; the SOCKS5 client obtains the configuration data based on the received configuration data response command; based on the obtained configuration data, the SOCKS5 client sends a target resource access request command to the SOCKS5 server according to the SOCKS5 protocol; the SOCKS5 client receives a target resource access response command from the SOCKS5 server; and the SOCKS5 client begins transmitting business layer data with the SOCKS5 server based on the target resource access response command.

[0005] In one possible implementation, the configuration parameter request command follows the fixed field structure of the SOCKS5 protocol, including the fields "version number + command number + reserved bit + configuration data type + data length + optional additional request information". The version number is fixed at 0x05, the reserved bit is fixed at 0x00, the configuration data type is used to identify the type of configuration data requested, the data length is used to identify the length of subsequent additional request information (0x0000 if there is no additional information), the length of optional additional request information is defined by the data length, and the command number avoids the 0x01-0x07 command numbers already defined in the SOCKS5 protocol. The configuration data includes the address information of the front-end load balancer corresponding to accessing different destination resources, the backup SOCKS5 service address, the load information of the front-end load balancer corresponding to accessing different destination resources, and / or the selection strategy of the front-end load balancer corresponding to accessing different destination resources.

[0006] In one possible implementation, the SOCKS5 client sends configuration parameter request commands no more than 5 times per second, and wherein, in response to the SOCKS5 server setting a rate limiting mechanism, when the SOCKS5 client request frequency exceeds the threshold, the SOCKS5 client receives a configuration parameter response command with a request exceeding the limit status code from the SOCKS5 server, and is allowed to resend the request after 3 seconds.

[0007] In one possible implementation, the SOCKS5 client obtains configuration data based on the received configuration data response command, including: responding to the configuration data response command being a fragmentation command, the fragmentation command field including a "fragment sequence number + total number of fragments" field, wherein the length of each fragment does not exceed the maximum transmission unit (MTU) of the transport layer; the SOCKS5 client receives the fragmentation commands sequentially according to the fragment sequence number; the SOCKS5 client reassembles the complete command based on the fragment sequence number and the total number of fragments; the SOCKS5 client verifies the integrity of the configuration data; in response to successful verification, the SOCKS5 client parses the configuration data command response field to obtain the configuration data; in response to verification failure, the SOCKS5 client sends a configuration parameter request command carrying a data corruption status code to the SOCKS5 server, requesting a retransmission.

[0008] The present invention also includes a SOCKS5 client that implements configuration data download by extending the SOCKS5 command set. The SOCKS5 client includes: a processor; and a memory coupled to the processor, the memory storing program instructions, which, when executed by the processor, are used to implement a method for the SOCKS5 client to download configuration data by extending the SOCKS5 command set.

[0009] This invention also includes a method for a SOCKS5 server to download configuration data by extending the SOCKS5 command set. The method includes the following steps: the SOCKS5 server receives a transport layer connection initiated by a SOCKS5 client; the SOCKS5 server receives a user authentication interaction initiated by the SOCKS5 client based on the SOCKS5 protocol; in response to successful user authentication, the SOCKS5 server receives a configuration parameter request command sent by the SOCKS5 client, wherein the configuration parameter request command is used to request configuration data required to access a target resource; the SOCKS5 server generates a configuration data response command; the SOCKS5 server sends the configuration data response command to the SOCKS5 client; the SOCKS5 server receives a target resource access request command sent by the SOCKS5 client based on the obtained configuration data, according to the SOCKS5 protocol; the SOCKS5 server sends a target resource access response command to the SOCKS5 client; and the SOCKS5 server begins transmitting business layer data with the SOCKS5 client based on the target resource access response command.

[0010] In one possible implementation, the configuration parameter request command follows the fixed field structure of the SOCKS5 protocol, including the fields "version number + command number + reserved bit + configuration data type + data length + optional additional request information". The version number is fixed at 0x05, the reserved bit is fixed at 0x00, the configuration data type is used to identify the type of configuration data requested, the data length is used to identify the length of subsequent additional request information (0x0000 if there is no additional information), the length of optional additional request information is defined by the data length, and the command number avoids the 0x01-0x07 command numbers already defined in the SOCKS5 protocol. The configuration data includes the address information of the front-end load balancer corresponding to accessing different destination resources, the backup SOCKS5 service address, the load information of the front-end load balancer corresponding to accessing different destination resources, and / or the selection strategy of the front-end load balancer corresponding to accessing different destination resources.

[0011] In one possible implementation, the SOCKS5 server generates a configuration data response command, which includes: in response to the configuration data length not exceeding the Maximum Transmission Unit (MTU) of the transport layer, the SOCKS5 server generates a configuration parameter response command carrying the corresponding configuration data according to the configuration data type field in the configuration parameter request command; in response to the configuration data length exceeding the MTU, the SOCKS5 server fragments the configuration parameter response command, wherein the fragmentation command field includes a "fragment sequence number + total number of fragments" field, where the length of each fragment does not exceed the MTU; then, the SOCKS5 server generates a configuration parameter response fragmentation command carrying the corresponding configuration data according to the fragment sequence number and the configuration data type field in the configuration parameter request command, and sends the fragmentation commands sequentially; wherein the command number of the configuration parameter response command corresponds one-to-one with the configuration parameter request command, and the value avoids the command numbers already defined by the SOCKS5 protocol.

[0012] In one possible implementation, the SOCKS5 server can set a rate limiting mechanism when sending configuration parameter request commands to the SOCKS5 client. When the SOCKS5 client request frequency exceeds the threshold, the SOCKS5 server sends a configuration parameter response command with a "request exceeded" status code to the SOCKS5 client and allows the SOCKS5 client to resend the request after 3 seconds.

[0013] The present invention also includes a SOCKS5 server that implements configuration data download by extending the SOCKS5 command set. The SOCKS5 server includes: a processor; and a memory coupled to the processor, the memory storing program instructions, which, when executed by the processor, are used to implement the above-mentioned method of the SOCKS5 server for implementing configuration data download by extending the SOCKS5 command set.

[0014] The beneficial effects of this invention are as follows: This solution extends the SOCKS5 command set, allowing clients to obtain target resource configurations within the protocol framework without out-of-band management, saving costs associated with manual configuration and independent channels, reducing resource consumption, and adapting to large-scale deployment scenarios. Fragmentation processing, verification retransmission, and rate limiting mechanisms ensure reliable and stable configuration acquisition, preventing data loss or server overload. Simultaneously, clients can leverage the configuration and other related data provided by the server to implement additional functions such as business access statistics and dynamic adjustment of access policies, further expanding application value and improving the overall efficiency and practicality of network interaction.

[0015] Other features and aspects of this application will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0016] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this application together with the specification and serve to explain the principles of this application.

[0017] Figure 1 shows a flowchart of a method for downloading configuration data by extending the SOCKS5 command set in an embodiment of this application; Figure 2 shows a sub-process diagram of a SOCKS5 client obtaining configuration data based on fragmentation commands in an embodiment of this application; Figure 3 shows a flowchart of a method for downloading configuration data by extending the SOCKS5 command set in an embodiment of this application; Figure 4 shows a sub-process diagram of a SOCKS5 server generating response commands based on the length of configuration data in an embodiment of this application. Detailed Implementation

[0018] Various exemplary embodiments, features, and aspects of this application will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0019] It should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this application or to simplify the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.

[0020] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0021] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0022] Furthermore, to better illustrate this application, numerous specific details are provided in the following detailed embodiments. Those skilled in the art should understand that this application can be implemented without certain specific details. In some instances, methods, means, components, and circuits well-known to those skilled in the art have not been described in detail in order to highlight the main points of this application.

[0023] The invention of this application is a method and system for downloading configuration data by extending the SOCKS5 command set. It applies network communication technology, especially in the application field of SOCKS5 proxy protocol, to replace the traditional out-of-band management method, efficiently and reliably obtain the target resource access configuration data within the SOCKS5 protocol framework, optimize the configuration management process when deploying large-scale terminals, and ensure the accurate transmission of business data.

[0024] The present invention includes a method for a SOCKS5 client to download configuration data by extending the SOCKS5 command set. Specifically, referring to Figure 1, the method includes step S100, whereby the SOCKS5 client initiates a transport layer connection to the SOCKS5 server. Specifically, the SOCKS5 client initiates a transport layer connection to a specified port on the server via the TCP protocol, establishing a stable communication link. This lays the foundation for subsequent authentication, command interaction, and data transmission, ensuring the reliability of data transmission.

[0025] In step S200, the SOCKS5 client completes user authentication interaction with the SOCKS5 server based on the SOCKS5 protocol. Specifically, the client sends authentication information such as username and password according to the SOCKS5 protocol. If the server verifies the information, the interaction is complete, preventing unauthorized client access and ensuring the security of subsequent configuration and business data transmission.

[0026] In step S300, at any time after user authentication and before business data transmission, the SOCKS5 client sends a configuration parameter request command to the SOCKS5 server. This configuration parameter request command is used to request the configuration data required to access the target resource. After authentication, the client sends a configuration parameter request command conforming to the protocol field structure, precisely requesting the configuration data for the target resource without requiring an additional channel, thus conforming to the SOCKS5 protocol framework.

[0027] In step S400, the SOCKS5 client receives a configuration data response command from the SOCKS5 server. Specifically, the client receives the configuration data response command returned by the server. This command may be in complete or fragmented form, providing a direct data source for the client to obtain configuration data and connecting the request and data acquisition stages.

[0028] In step S500, the SOCKS5 client responds to the command based on the received configuration data to obtain the configuration data. If the response is a fragmented command, the client receives, reassembles, and verifies the fragmented data in sequence. If successful, the client parses and obtains the configuration data; otherwise, it requests a retransmission to ensure that the obtained configuration data is complete and accurate, supporting subsequent access requests.

[0029] In step S600, the SOCKS5 client, based on the obtained configuration data, sends a request command to the SOCKS5 server to access the target resource according to the SOCKS5 protocol. The client constructs and sends the request command according to the SOCKS5 protocol specifications based on the configuration data, ensuring the request meets the server's expectations and increasing the probability of the request being correctly identified and processed.

[0030] In step S700, the SOCKS5 client receives the access target resource response command from the SOCKS5 server. By receiving the server's access target resource response command, the client understands the server's processing result for the access request, providing a basis for deciding whether to initiate business data transmission.

[0031] In step S800, the SOCKS5 client responds to the access destination resource with a command and begins transmitting business layer data with the SOCKS5 server. Based on the permission response command, the client establishes a business data transmission channel with the server and begins transmitting actual business data, thus completing a closed-loop process from configuration acquisition to business interaction.

[0032] This technical solution requires no additional communication channel and completes configuration data download within the SOCKS5 protocol framework, reducing system complexity; it obtains configuration data in advance to ensure the accuracy of business data transmission, and at the same time, it improves data transmission stability by combining rate limiting and other mechanisms.

[0033] In one possible implementation, the configuration parameter request command follows the fixed field structure of the SOCKS5 protocol, including the fields "Version Number + Command Number + Reserved Bits + Configuration Data Type + Data Length + Optional Additional Request Information". The version number is fixed at 0x05, the reserved bits are fixed at 0x00, the configuration data type identifies the category of the requested configuration data, the data length identifies the length of subsequent additional request information (0x0000 if no additional information is available), the length of optional additional request information is defined by the data length, and the command number avoids the 0x01-0x07 command numbers already defined in the SOCKS5 protocol. The configuration data includes, but is not limited to, the address information of the front-end load balancer corresponding to different destination resources. By extending the command according to the SOCKS5 protocol field structure, compatibility with the original protocol is ensured, avoiding the need for new channels; the configuration data category is accurately identified, and the load balancer address of the target resource is quickly obtained, improving the efficiency and accuracy of business access.

[0034] In one specific embodiment, such as in a voice communication scenario, the configuration information obtained may also include high availability configuration information of the SOCKS5 server itself, such as backup SOCKS5 service address, load information of front-end load balancers corresponding to accessing different destination resources, and selection strategy of front-end load balancers corresponding to accessing different destination resources.

[0035] In one specific embodiment, within an enterprise's internal office scenario, a SOCKS5 client on an employee's device needs to access the enterprise's ERP system. The client constructs a configuration parameter request command according to the protocol, setting the version number to 0x05, selecting the unused command number 0x08, reserving the 0x00 bit, and setting the configuration data type to 0x01 (identifying ERP system configuration). Since no additional information is needed, the data length is 0x0000, and no additional request information is provided. After sending this command, the client obtains the front-end load balancer address (192.168.1.100) corresponding to the ERP system from the server and subsequently initiates access requests based on this address.

[0036] In one possible implementation, the SOCKS5 client sends configuration parameter request commands no more than 5 times per second. In response to a rate-limiting mechanism set by the SOCKS5 server, when the SOCKS5 client's request frequency exceeds the threshold, the SOCKS5 client receives a configuration parameter response command with a request exceeding the limit status code from the SOCKS5 server, and is allowed to resend the request after 3 seconds. By limiting the request frequency to no more than 5 times per second, the server resources are prevented from being consumed by a large number of requests from the client in a short period, ensuring the server's normal response to other clients and maintaining the overall system efficiency. The server-side rate-limiting mechanism combined with the 3-second resend wait effectively intercepts excessive requests, while clearly defining the resend time, preventing server overload and reducing invalid client retries, thus improving interaction stability.

[0037] Referring specifically to Figure 2, in one possible implementation, the SOCKS5 client obtains configuration data based on the received configuration data response command, including step S510. In response to the configuration data response command being a fragmentation command, the fragmentation command field includes a "fragment sequence number + total number of fragments" field. The length of each fragment does not exceed the maximum transmission unit (MTU) of the transport layer. The SOCKS5 client receives the fragmentation commands sequentially according to the fragment sequence number. Specifically, when the configuration data response command is in fragmentation form, the command includes the "fragment sequence number + total number of fragments" field, and the length of each fragment does not exceed the MTU. The client receives the fragments sequentially according to the fragment sequence number, avoiding reassembly chaos due to out-of-order reception, and adapting to transport layer limitations to prevent data from being discarded due to exceeding the MTU.

[0038] In step S520, the SOCKS5 client reassembles the complete command based on the fragment sequence number and the total number of fragments. Specifically, the client first extracts the sequence number of each fragment and the total number of fragments, then arranges the fragments in ascending order of sequence number and assembles them into a complete command. This process ensures that the fragment reassembly order is correct, avoiding missing or disordered configuration data due to incorrect order, and laying the foundation for subsequent verification.

[0039] Step S530: The SOCKS5 client verifies the integrity of the configuration data. In one embodiment, the client calculates the integrity of the reassembled command data using a preset verification algorithm (such as CRC checksum) and compares it with the checksum provided by the server. This quickly identifies whether the data has been corrupted during transmission or reassembly, ensuring the initial integrity of the configuration data.

[0040] In step S540, in response to successful verification, the SOCKS5 client parses the configuration data command response fields to obtain the configuration data. After successful verification, the client extracts valid configuration information (such as the load balancer address) from the configuration data response command according to the field parsing rules defined in the SOCKS5 protocol. This ensures accurate acquisition of the required configuration data, providing reliable parameter support for subsequent access to the target resource.

[0041] In step S550, in response to a verification failure, the SOCKS5 client sends a configuration parameter request command carrying a data corruption status code to the SOCKS5 server, requesting a retransmission. In one embodiment, if verification fails, the client immediately constructs a configuration parameter request command containing a data corruption status code (e.g., 0x02) and sends it to the server to request a retransmission of the corresponding fragment. This avoids interruption of configuration acquisition due to data corruption and ensures the continuity of the configuration data acquisition process.

[0042] This technical solution avoids data loss by segmenting and receiving data to adapt to MTU limitations; orderly reassembly and verification ensure the integrity of configuration data and reduce the error rate; and a retransmission mechanism for verification failures ensures process continuity, reduces the risk of configuration acquisition interruption, and improves the overall reliability and efficiency of configuration data acquisition, supporting the stable operation of subsequent business access.

[0043] Based on this method, the present invention also includes a SOCKS5 client that implements configuration data download by extending the SOCKS5 command set. The SOCKS5 client includes: a processor; and a memory coupled to the processor, the memory storing program instructions, which, when run by the processor, are used to implement the method of the SOCKS5 client implementing configuration data download by extending the SOCKS5 command set.

[0044] Obviously, those skilled in the art should understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the control methods described above. The modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps as a single integrated circuit module. Thus, the present invention is not limited to any specific hardware and software combination.

[0045] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the control methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.

[0046] The present invention also includes a method for a SOCKS5 server to download configuration data by extending the SOCKS5 command set. Specifically, referring to Figure 3, the method includes step S1000, where the SOCKS5 server receives a transport layer connection initiated by a SOCKS5 client. Specifically, the SOCKS5 server listens on a specified TCP port, receives transport layer connection requests initiated by the client in real time, verifies the connection's legitimacy, and establishes a connection, thus building a stable underlying communication link for subsequent authentication and command interaction, ensuring reliable data transmission.

[0047] In step S1100, the SOCKS5 server receives the user authentication interaction initiated by the SOCKS5 client based on the SOCKS5 protocol. Specifically, the server receives the authentication information sent by the client according to the SOCKS5 protocol, verifies the validity of the information according to preset rules, completes the authentication interaction if the verification is successful, and terminates the connection if the verification fails, ensuring that only authorized clients can enter the subsequent process.

[0048] In step S1200, in response to successful user authentication, the SOCKS5 server receives a configuration parameter request command sent by the SOCKS5 client. This configuration parameter request command requests the configuration data required to access the target resource. After successful authentication, the server receives the configuration parameter request command from the client, parses the configuration data type and other fields in the command, clarifies the type of configuration data required by the client, provides a basis for accurately generating the response command, and avoids invalid data transmission.

[0049] In step S1300, the SOCKS5 server generates a configuration data response command. Specifically, the server retrieves the corresponding data from the local configuration database based on the parsed configuration data type. If the data length exceeds the MTU, it is fragmented to generate a configuration data response command that conforms to the protocol specifications, ensuring that the response format is compliant.

[0050] In step S1400, the SOCKS5 server sends a configuration data response command to the SOCKS5 client. Specifically, the server sends the configuration data response commands sequentially, monitors the sending status in real time, and resends the commands if a sending failure is detected, ensuring that the client can receive the response commands in a timely manner, thus bridging the configuration request and data transmission links.

[0051] In step S1500, the SOCKS5 server receives a request command from the SOCKS5 client to access the target resource, sent according to the SOCKS5 protocol based on the obtained configuration data. The server receives the request command, parses the target resource identifier and other information in the command, determines whether access is allowed, and lays the foundation for generating an access response.

[0052] In step S1600, the SOCKS5 server sends a response command to the SOCKS5 client to access the target resource. The server generates a response command based on the access determination result; if access is granted, it carries resource access permission information; if access is denied, it explains the reason and sends it to the client according to the SOCKS5 protocol, providing clear guidance for the client on whether to initiate business data transmission.

[0053] In step S1700, the SOCKS5 server responds to the access destination resource response command and begins transmitting business layer data with the SOCKS5 client. After sending the access permission response command, the server establishes a business data transmission channel with the client, receives and sends business data according to the protocol specifications, handles anomalies in data transmission in real time, and ensures stable business data interaction.

[0054] In this technical solution, the server filters out illegal clients and ensures system security through standardized connection reception and authentication verification; it accurately parses requests and generates responses on demand, reducing invalid data interaction; the fragmentation processing and retransmission mechanism ensures the integrity of configuration data transmission; and clear access responses and stable business transmission improve overall interaction efficiency and reliability.

[0055] In one possible implementation, the configuration parameter request command follows the fixed field structure of the SOCKS5 protocol, including the fields "Version Number + Command Number + Reserved Bits + Configuration Data Type + Data Length + Optional Additional Request Information". The version number is fixed at 0x05, the reserved bits are fixed at 0x00, the configuration data type identifies the type of configuration data requested, the data length indicates the length of subsequent additional request information (0x0000 if no additional information is available), the length of optional additional request information is defined by the data length, and the command number avoids the 0x01-0x07 command numbers already defined in the SOCKS5 protocol. The configuration data includes, but is not limited to, the address information of the front-end load balancer corresponding to different destination resources. By extending the command according to the fixed field structure of the SOCKS5 protocol, no new communication channels are needed, avoiding system architecture complexity, reducing development and maintenance costs, while ensuring compatibility with the original SOCKS5 protocol and not affecting existing business processes. Furthermore, the precise field definitions allow the server to quickly identify request requirements and efficiently return the corresponding front-end load balancer address, improving the efficiency of configuration data acquisition and laying a precise foundation for subsequent business access.

[0056] In one specific embodiment, such as in a voice communication scenario, the configuration information obtained may also include the high availability configuration information of the SOCKS5 server itself, such as the backup SOCKS5 service address, the load information of the front-end load balancer corresponding to accessing different destination resources, and the selection strategy of the front-end load balancer corresponding to accessing different destination resources.

[0057] Referring specifically to Figure 4, in one possible implementation, the SOCKS5 server generating a configuration data response command includes step S1310: In response to the configuration data length not exceeding the Maximum Transmission Unit (MTU) of the transport layer, the SOCKS5 server generates a configuration parameter response command carrying the corresponding configuration data based on the configuration data type field in the configuration parameter request command. The server first determines whether the configuration data length exceeds the MTU. If it does not, it retrieves configuration data matching the configuration data type in the request command from the local configuration library and generates a complete configuration data response command according to the SOCKS5 protocol field structure. This ensures the command contains complete configuration data, allowing the client to directly parse it without fragmentation, thus improving response efficiency.

[0058] In step S1320, in response to the configuration data length exceeding the Maximum Transmission Unit (MTU) of the transport layer, the SOCKS5 server fragments the configuration parameter response command. The fragmentation command field includes a "fragment sequence number + total number of fragments" field, where the data length of each fragment does not exceed the MTU. The SOCKS5 server then generates a configuration parameter response fragmentation command carrying the corresponding configuration data according to the configuration data type field in the configuration parameter request command, based on the fragment sequence number, and sends the fragmentation commands sequentially. If the configuration data length exceeds the MTU, the server first calculates the number of fragments, adds a "fragment sequence number + total number of fragments" field to each fragment to ensure that the data length of each fragment is ≤ MTU, and then generates the corresponding fragmentation command according to the sequence number and sends it sequentially. This prevents data from being discarded by the transport layer due to exceeding the MTU and ensures data transmission integrity.

[0059] The command number of the configuration parameter response command corresponds one-to-one with the configuration parameter request command, and the value avoids the command numbers already defined in the SOCKS5 protocol.

[0060] The server flexibly selects to generate complete or fragmented response commands based on the relationship between the configuration data length and MTU. This adapts to transport layer limitations, prevents data loss, ensures the correctness of response data by accurately matching the configuration data type, and sends fragmented data in an orderly manner to ensure that the client can accurately reassemble the data, thereby improving the reliability and adaptability of the configuration data response.

[0061] In one possible implementation, the SOCKS5 server can set a rate limiting mechanism when sending configuration parameter request commands to the SOCKS5 client. When the SOCKS5 client's request frequency exceeds a threshold, the SOCKS5 server sends a configuration parameter response command with a request exceeding the limit status code to the SOCKS5 client, and allows the SOCKS5 client to resend the request after 3 seconds. This server-side rate limiting mechanism can intercept client requests exceeding the threshold, preventing a large number of requests from consuming server resources such as CPU and memory in a short period, ensuring the server's normal response to other clients, and maintaining overall system stability. Sending the request exceeding the limit status code and explicitly allowing retransmission after 3 seconds allows the client to clearly understand the retry time, reducing invalid retries, and avoiding blind requests from clients due to lack of feedback, thus improving interaction efficiency and resource utilization for both parties.

[0062] The present invention also includes a SOCKS5 server that implements configuration data download by extending the SOCKS5 command set. The SOCKS5 server includes: a processor; and a memory coupled to the processor, the memory storing program instructions, which, when executed by the processor, are used to implement the above-mentioned method of the SOCKS5 server for implementing configuration data download by extending the SOCKS5 command set.

[0063] Obviously, those skilled in the art should understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the control methods described above. The modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps as a single integrated circuit module. Thus, the present invention is not limited to any specific hardware and software combination.

[0064] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the control methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.

[0065] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for downloading configuration data by extending the SOCKS5 command set in a SOCKS5 client, characterized in that, The method includes the following steps: a SOCKS5 client initiates a transport layer connection to a SOCKS5 server; the SOCKS5 client completes user authentication interaction with the SOCKS5 server based on the SOCKS5 protocol; at any time after user authentication and before business data transmission, the SOCKS5 client sends a configuration parameter request command to the SOCKS5 server, wherein the configuration parameter request command is used to request configuration data required to access the target resource; the SOCKS5 client receives a configuration data response command from the SOCKS5 server; the SOCKS5 client obtains configuration data based on the received configuration data response command; based on the obtained configuration data, the SOCKS5 client sends a target resource access request command to the SOCKS5 server according to the SOCKS5 protocol; the SOCKS5 client receives a target resource access response command from the SOCKS5 server; and the SOCKS5 client begins transmitting business layer data with the SOCKS5 server based on the target resource access response command.

2. The method according to claim 1, characterized in that, The configuration parameter request command follows the fixed field structure of the SOCKS5 protocol, including the fields "version number + command number + reserved bit + configuration data type + data length + optional additional request information". The version number is fixed at 0x05, the reserved bit is fixed at 0x00, the configuration data type is used to identify the type of configuration data requested, the data length is used to identify the length of subsequent additional request information (0x0000 when there is no additional information), the length of optional additional request information is defined by the data length, and the command number avoids the 0x01-0x07 command numbers already defined in the SOCKS5 protocol. The configuration data includes the front-end load balancer address information corresponding to accessing different destination resources, the backup SOCKS5 service address, the load information of the front-end load balancer corresponding to accessing different destination resources, and / or the selection strategy of the front-end load balancer corresponding to accessing different destination resources.

3. The method according to claim 1, characterized in that, The SOCKS5 client sends configuration parameter request commands no more than 5 times per second. In response to the SOCKS5 server's rate limiting mechanism, when the SOCKS5 client's request frequency exceeds the threshold, the SOCKS5 client receives a configuration parameter response command with a request exceeding the limit status code from the SOCKS5 server, and is allowed to resend the request after 3 seconds.

4. The method according to claim 1, characterized in that, The process of obtaining configuration data by the SOCKS5 client based on the received configuration data response command includes: In response to the configuration data response command being a fragmentation command, the fragmentation command field includes a "fragment sequence number + total number of fragments" field, wherein the length of each fragment in the total number of fragments does not exceed the maximum transmission unit (MTU) of the transport layer; the SOCKS5 client receives the fragmentation commands sequentially according to the fragment sequence number; the SOCKS5 client reassembles the complete command based on the fragment sequence number and the total number of fragments; the SOCKS5 client verifies the integrity of the configuration data; in response to successful verification, the SOCKS5 client parses the configuration data command response field to obtain the configuration data; in response to verification failure, the SOCKS5 client sends a configuration parameter request command carrying a data corruption status code to the SOCKS5 server, requesting a retransmission.

5. A SOCKS5 client that downloads configuration data by extending the SOCKS5 command set, characterized in that, The SOCKS5 client includes: a processor; and a memory coupled to the processor, the memory storing program instructions that, when executed by the processor, implement the method of claims 1-4.

6. A method for downloading configuration data by extending the SOCKS5 command set in a SOCKS5 server, characterized in that, The method includes the following steps: A SOCKS5 server receives a transport layer connection initiated by a SOCKS5 client; the SOCKS5 server receives a user authentication interaction initiated by the SOCKS5 client based on the SOCKS5 protocol; in response to successful user authentication, the SOCKS5 server receives a configuration parameter request command sent by the SOCKS5 client, wherein the configuration parameter request command is used to request configuration data required to access a target resource; the SOCKS5 server generates a configuration data response command; the SOCKS5 server sends the configuration data response command to the SOCKS5 client; the SOCKS5 server receives a target resource access request command sent by the SOCKS5 client based on the obtained configuration data, according to the SOCKS5 protocol; the SOCKS5 server sends a target resource access response command to the SOCKS5 client; and the SOCKS5 server begins transmitting business layer data with the SOCKS5 client based on the target resource access response command.

7. The method according to claim 6, characterized in that, The configuration parameter request command follows the fixed field structure of the SOCKS5 protocol, including the fields "version number + command number + reserved bit + configuration data type + data length + optional additional request information". The version number is fixed at 0x05, the reserved bit is fixed at 0x00, the configuration data type is used to identify the type of configuration data requested, the data length is used to identify the length of subsequent additional request information (0x0000 if there is no additional information), the length of optional additional request information is defined by the data length, and the command number avoids the 0x01-0x07 command numbers already defined in the SOCKS5 protocol. The configuration data includes the front-end load balancer address information corresponding to accessing different destination resources, the backup SOCKS5 service address, the load information of the front-end load balancer corresponding to accessing different destination resources, and / or the selection strategy of the front-end load balancer corresponding to accessing different destination resources.

8. The method according to claim 7, characterized in that, The SOCKS5 server generates configuration data response commands, including: in response to the configuration data length not exceeding the Maximum Transmission Unit (MTU) of the transport layer, the SOCKS5 server generates a configuration parameter response command carrying the corresponding configuration data according to the configuration data type field in the configuration parameter request command; in response to the configuration data length exceeding the MTU of the transport layer, the SOCKS5 server performs fragmentation processing on the configuration parameter response command, wherein the fragmentation command field includes a "fragment sequence number + total number of fragments" field, wherein the data length of each fragment of the total number of fragments does not exceed the MTU, and then the SOCKS5 server generates configuration parameter response fragmentation commands carrying the corresponding configuration data according to the configuration data type field in the configuration parameter request command based on the fragment sequence number, and sends the fragmentation commands sequentially; wherein the command number of the configuration parameter response command corresponds one-to-one with the configuration parameter request command, and the value avoids the command numbers already defined by the SOCKS5 protocol.

9. The method according to claim 8, characterized in that, The SOCKS5 server can set a rate limiting mechanism by sending configuration parameter request commands to the SOCKS5 client. When the SOCKS5 client request frequency exceeds the threshold, the SOCKS5 server sends a configuration parameter response command with a "request exceeded" status code to the SOCKS5 client and allows the SOCKS5 client to resend the request after 3 seconds.

10. A SOCKS5 server that downloads configuration data by extending the SOCKS5 command set, characterized in that, The SOCKS5 server includes: a processor; and a memory coupled to the processor, the memory storing program instructions that, when executed by the processor, implement the method of claims 6-9.