Full-link log tracking method and device based on VLESS protocol, equipment and medium
By transmitting Trace ID in the VLESS protocol, client and server logs are unified, solving the problem of fragmented logging in the VLESS protocol proxy architecture. This improves troubleshooting efficiency and log tracing convenience, supports multiple transmission protocols, and is suitable for microservices and cloud-native architectures.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FUJIAN ZIXUN INFORMATION TECH CO LTD
- Filing Date
- 2025-12-03
- Publication Date
- 2026-05-05
AI Technical Summary
In the proxy architecture of the VLESS protocol, the client and server logs are independent of each other, which makes it inefficient for operations and maintenance personnel to troubleshoot connection anomalies. They cannot effectively correlate the client and server logs, making it difficult to locate problems, especially in high-concurrency scenarios.
By transmitting the Trace ID in the VLESS protocol, end-to-end transparent transmission is achieved from the client to the server. When the client initiates a request, it encapsulates the Trace ID in the protocol handshake data packet. The server parses and updates the log identifier to achieve consistency between the client and server log identifiers.
It enables rapid association of end-to-end logs, allowing administrators to retrieve the complete log stream simply by searching for an ID, significantly improving troubleshooting efficiency, reducing average repair time, supporting multiple transmission protocols, and easily integrating into microservices and cloud-native architectures.
Smart Images

Figure CN121979697A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of log tracing technology, and in particular to a method, apparatus, device, and medium for end-to-end log tracing based on the VLESS protocol. Background Technology
[0002] In the proxy architecture of the Vless protocol, client and server logging are independent: the client can only record basic information such as locally initiated connection requests, number of bytes sent, and connection status, while the server can only record data such as the source of the incoming connection, the amount of data received, and the response status. However, the two cannot be effectively correlated. This disconnect can cause a series of problems in actual operation and maintenance: when users report connection lag, disconnection, or access failure, if the operation and maintenance personnel check the client logs and find "connection timeout," they cannot find the corresponding abnormal connection record in the server logs—the server may have multiple connection requests running simultaneously, making it impossible to distinguish which one corresponds to the client; conversely, when the server logs show "abnormal connection closure," it is also impossible to pinpoint which client's request triggered the exception.
[0003] This log gap leads to extremely low troubleshooting efficiency. Operations personnel often need to narrow down the scope by filtering indirect information such as timestamps and IP addresses. However, IPs may change dynamically, and timestamps may also deviate due to network latency. Especially in high-concurrency scenarios, these indirect correlation methods are almost ineffective, and irrelevant connections can only be eliminated one by one, which consumes a lot of time. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for end-to-end log tracing based on the VLESS protocol, which realizes end-to-end transparent transmission. Administrators only need to search for an ID in the log system to instantly pull out the complete log stream from "client-initiated request" to "server-received processing" and then to "target website response".
[0005] In a first aspect, the present invention provides a full-link log tracing method based on the VLESS protocol, comprising the following steps: Step 1: When creating a proxy protocol client instance, receive and configure tracing option parameters to determine whether to enable the link tracing function; Step 2: When the client initiates an outbound connection request, a transport layer connection to the underlying server is established; at the same time, the context of the current request is checked. If tracing is enabled and the context contains a log identifier, the identifier is extracted as the link tracing identifier. Step 3: When the client performs the application layer protocol handshake, it encapsulates the link tracing identifier into the protocol handshake data packet and sends it to the server. Step 4: The server receives and parses the handshake data packet, extracts the link tracing identifier from it; then it obtains the context object of the current session of the server, writes the extracted link tracing identifier into the context object, so as to replace or set the log identifier of the current session of the server, thereby realizing the unification of the log identifier between the client and the server.
[0006] Secondly, the present invention provides a full-link log tracing device based on the VLESS protocol, comprising: The configuration module receives and configures tracing option parameters when creating a proxy protocol client instance to determine whether to enable the link tracing function; The connection management module establishes a transport layer connection to the underlying server when a client initiates an outbound connection request. At the same time, it detects the context of the current request. If tracing is enabled and the context contains a log identifier, it extracts the identifier as the link tracing identifier. The tracking identifier extraction module encapsulates the link tracking identifier into the handshake data packet of the protocol and sends it to the server during the application layer protocol handshake. The protocol handshake module receives and parses the handshake data packet, extracting the link tracing identifier from it. Then, it obtains the context object of the current session on the server and writes the extracted link tracing identifier into the context object to replace or set the log identifier of the current session on the server, thereby unifying the log identifiers of the client and the server.
[0007] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.
[0008] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0009] One or more technical solutions provided by this invention have at least the following technical effects or advantages: 1. Significantly improved troubleshooting and maintenance efficiency End-to-end correlation: In traditional proxies, the client and server each generate logs, and manual matching by time or IP address is highly unreliable and prone to errors. This solution implements end-to-end transparent transmission of Trace IDs. Administrators only need to search for an ID (such as UUID) in the log system to instantly pull out the complete log stream from "client initiating a request" to "server receiving and processing" to "target website response".
[0010] Quickly pinpoint breakpoints: When a connection fails, you can immediately determine whether the problem lies on the client side (a request is sent but there are no server logs), the network layer (the server did not receive a packet containing the ID), or the server processing layer (the server has error logs), significantly improving the overall mean time to repair (MTTR).
[0011] 2. Low intrusion and high performance at the protocol layer Utilizing the existing handshake mechanism (Piggyback): The Trace ID is passed as a parameter to DialEarlyConn, meaning it is sent encapsulated within the VLESS protocol's handshake packet (Header / Addons). This eliminates the need to establish an additional management connection or send data out-of-band, reducing network overhead.
[0012] 3. Wide range of transmission protocol coverage Unified tracing logic: The solution not only supports basic TCP, but also explicitly handles UDP, XUDP (a possible UDP performance optimization mode), and PacketAddr (virtual network interface mode).
[0013] Advantages: Tracking works regardless of whether the user is browsing web pages (TCP), playing games / making voice calls (UDP), or setting up a complex VPN network, eliminating monitoring blind spots.
[0014] 4. Standardization of Context Integration If the upstream application (such as a browser or API gateway) has already generated a request ID and established a context, the proxy component can seamlessly inherit this ID without needing to regenerate it. This makes the component very easy to integrate into microservices or cloud-native architectures.
[0015] 5. Flexible configuration and control In a production environment, tracing can be turned off to save log storage space and slightly improve performance; it can be dynamically turned on when debugging network issues.
[0016] 6. Forced synchronization of server sessions This ensures that all subsequent logs generated by the server-side logic (such as routing, DNS resolution, and data forwarding) will automatically include this ID from the client, eliminating the need to manually annotate the ID at each log printout.
[0017] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0018] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0019] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation
[0020] The overall concept of the technical solution in this application is as follows: The core function of this invention is to establish a VLESS protocol connection, and it adds a key feature of distributed tracing, which transmits TraceId between the client and the server to track the entire lifecycle of the same request in the logs.
[0021] Explain the function and implementation process of the code: I. Initializing the Client (NewVLESS) func NewVLESS(logger log.ContextLogger, optionsoption.VLESSOutboundOptions) (*VLESS, error) { / / Initialize the VLESS core client outbound.client, err = vless.NewClient(options.UUID,options.Flow, logger, options.TraceOptions.Trace.Enable, options.Token) if err != nil { return nil, err } return outbound, nil } Function: This is the factory function for constructing VLESS outbound proxy objects.
[0022] Key point: It calls the underlying vless.NewClient to create a protocol client.
[0023] Trace switch: Note the parameter options.TraceOptions.Trace.Enable, which passes the option to enable or disable tracing from the configuration file to the underlying client. This determines whether trace-related logic needs to be handled during subsequent handshakes.
[0024] II. Establishing a Connection and Handshake (DialContext) This is the most crucial part, responsible for establishing network connections to the underlying servers and performing VLESS protocol handshakes.
[0025] ```go func (h *vlessDialer) DialContext(ctx context.Context, networkstring, destination M.Socksaddr) (net.Conn, error) { / / ... (Code omitted: Setting context metadata) ... / / 1. Establish the underlying physical connection (Transport Layer) var conn net.Conn var err error if h.transport != nil { / / If an advanced transport layer (such as WebSocket, gRPC, HTTPUpgrade, etc.) is configured, use it to establish the connection. conn, err = h.transport.DialContext(ctx) } else { / / Otherwise, use the native TCP connection. conn, err = h.dialer.DialContext(ctx, N.NetworkTCP,h.serverAddr) / / If TLS is configured, the TLS handshake will be performed over TCP. if err == nil && h.tlsConfig != nil { conn, err = tls.ClientHandshake(ctx, conn, h.tlsConfig) } } if err != nil { return nil, err } / / 2. Obtain TraceID (Core Logic) var traceId string / / If the context exists and trace is enabled in the configuration. if ctx != nil && h.trace { / / Extract the Log ID from the current Context (usually generated by the inbound connection or a newly generated UUID). if id, hasId := log.IDFromContext(ctx); hasId { traceId = fmt.Sprintf("%v", id.ID) } } / / 3. Perform the VLESS protocol handshake (Application Layer) switch N.NetworkName(network) { case N.NetworkTCP: h.logger.InfoContext(ctx, "outbound connection to ",destination) / / Call the VLESS client's TCP handshake method. Note that an additional traceId is passed here. return h.client.DialEarlyConn(conn, destination, traceId) case N.NetworkUDP: h.logger.InfoContext(ctx, "outbound packet connection to ",destination) / / Handle UDP (XUDP, PacketAddr, or standard UDP) according to configuration. if h.xudp { return h.client.DialEarlyXUDPPacketConn(conn,destination, traceId) } else if h.packetAddr { / / ... (PacketAddr special handling logic) ... / / Also pass in the traceId packetConn, err := h.client.DialEarlyPacketConn(conn,M.Socksaddr{Fqdn: packetaddr.SeqPacketMagicAddress}, traceId) / / ... } else { return h.client.DialEarlyPacketConn(conn, destination,traceId) } default: return nil, E.Extend(N.ErrUnknownNetwork, network) } } ``` Implementation process summary: 1. Underlying connection: First, connect to the proxy server via TCP / TLS or WS / gRPC.
[0026] 2. Extract ID: Examine the context of the current request and extract the ID used for log tracing.
[0027] 3. Protocol Encapsulation: Calling the h.client.DialEarly... series of methods. This implies that the underlying Vless library has been modified or extended. Its handshake method receives the traceId parameter and encapsulates this ID into the VLESS protocol header or addons before sending it to the server.
[0028] III. Extracting TraceID from the server ```go / / Zless proxy server code snippet for obtaining traceid if requestAddons.GetTraceId() != "" { if t := session.TraceIDFromContext(ctx); t != nil { t.Id = requestAddons.GetTraceId() } } ``` Context: This code runs after the proxy server receives the VLESS request and parses the headers.
[0029] Function: 1. requestAddons.GetTraceId(): Retrieves the Trace ID sent by the client from the parsed VLESS request addons (usually in Protobuf format).
[0030] 2. session.TraceIDFromContext(ctx): Gets the Trace context object of the current request processing coroutine on the server.
[0031] 3. t.Id=...: Overwrite / synchronize ID. Modify the log ID of the current session on the server to the ID sent by the client.
[0032] The following end-to-end log tracing functionality has been implemented: 1. The App / User initiates the request.
[0033] 2. Client (Zless Outbound): Receive a request and generate or retrieve a Log ID (e.g., abc-123).
[0034] DialContext is invoked.
[0035] Extract abc-123 from the Context.
[0036] In the VLESS handshake data packet, abc-123 is sent by placing it in the Addons field.
[0037] 3. Network: Encrypted VLESS packet transmission.
[0038] 4. Server (Zless Inbound): Receive connection, decrypt and parse VLESS header.
[0039] Reading the Addons reveals that it contains TraceId abc-123.
[0040] (Server-side code snippet) Forces the Log ID of the current processing thread on the server to abc-123.
[0041] 5. Results: Client log: [abc-123] outbound connection to google.com Server log: [abc-123] received connection from client... Administrators can instantly find all relevant logs for this connection on both the client and server sides by searching for "abc-123", which greatly facilitates troubleshooting. Example
[0042] like Figure 1 As shown, this embodiment provides a full-link log tracing method based on the VLESS protocol, including the following steps: Step 1: When creating a proxy protocol client instance, receive and configure tracing option parameters to determine whether to enable the link tracing function; Step 2: When the client initiates an outbound connection request, a transport layer connection to the underlying server is established; at the same time, the context of the current request is checked. If tracing is enabled and the context contains a log identifier, the identifier is extracted as the link tracing identifier. Step 3: When the client performs the application layer protocol handshake, it encapsulates the link tracing identifier into the protocol handshake data packet and sends it to the server. Step 4: The server receives and parses the handshake data packet, extracts the link tracing identifier from it; then it obtains the context object of the current session of the server, writes the extracted link tracing identifier into the context object, so as to replace or set the log identifier of the current session of the server, thereby realizing the unification of the log identifier between the client and the server.
[0043] In this embodiment, preferably, step 2 specifically involves: when the client initiates an outbound connection request, establishing a transport layer connection to the underlying server; determining whether to use a custom transport layer based on the configuration; if a custom transport layer exists, establishing a connection using a custom transport layer; if no custom transport layer exists, establishing a TCP connection, and determining whether to perform a TLS encrypted handshake based on the configuration; after the transport layer connection is successfully established, detecting the context of the current request; if tracing is enabled, obtaining the unique UUID generated when the current request flows within the client through the context reading method, and formatting it as a string-based link tracing identifier.
[0044] In this embodiment, preferably, step 3 specifically comprises: When the network type is TCP, the TCP handshake interface is called, the link tracing identifier is passed in as a parameter, and sent to the server; When the network type is UDP, the link tracing identifier is sent using one of the following methods depending on the configuration mode: Standard UDP mode: Directly call the UDP handshake interface to send data to the server; Extended UDP mode: Calls the extended UDP handshake interface that supports multiplexing or specific optimizations to send to the server; PacketAddr mode: When the target address is not a domain name, a special sequence packet with a magic address and a link tracing identifier is encapsulated and sent to the server.
[0045] In this embodiment, preferably, step 4 specifically includes: The server parses the additional information fields in the VLESS protocol request header; Determine if a non-empty link tracing identifier exists in the additional information field; If it exists, the server-side session management interface is called to obtain the context tracing object of the current coroutine or request, and the ID attribute of the object is forcibly updated to the received tracing identifier, thereby unifying the log identifiers of the client and the server.
[0046] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.
[0047] Example 2 like Figure 2 As shown, this embodiment provides a full-link log tracing device based on the VLESS protocol, including: The configuration module receives and configures tracing option parameters when creating a proxy protocol client instance to determine whether to enable the link tracing function; The connection management module establishes a transport layer connection to the underlying server when a client initiates an outbound connection request. At the same time, it detects the context of the current request. If tracing is enabled and the context contains a log identifier, it extracts the identifier as the link tracing identifier. The tracking identifier extraction module encapsulates the link tracking identifier into the handshake data packet of the protocol and sends it to the server during the application layer protocol handshake. The protocol handshake module receives and parses the handshake data packet, extracting the link tracing identifier from it. Then, it obtains the context object of the current session on the server and writes the extracted link tracing identifier into the context object to replace or set the log identifier of the current session on the server, thereby unifying the log identifiers of the client and the server.
[0048] In this embodiment, preferably, the connection management module specifically performs the following: when the client initiates an outbound connection request, a transport layer connection to the underlying server is established; it determines whether to use a custom transport layer based on the configuration; if a custom transport layer exists, the connection is established using the custom transport layer; if no custom transport layer exists, a TCP connection is established, and it is determined whether to perform a TLS encrypted handshake based on the configuration; after the transport layer connection is successfully established, the context environment of the current request is detected; if the tracing function is enabled, the unique UUID generated when the current request flows within the client is obtained through the context reading method, and it is formatted as a link tracing identifier in string form.
[0049] In this embodiment, preferably, the tracking identifier extraction module specifically comprises: When the network type is TCP, the TCP handshake interface is called, the link tracing identifier is passed in as a parameter, and sent to the server; When the network type is UDP, the link tracing identifier is sent using one of the following methods depending on the configuration mode: Standard UDP mode: Directly call the UDP handshake interface to send data to the server; Extended UDP mode: Calls the extended UDP handshake interface that supports multiplexing or specific optimizations to send to the server; PacketAddr mode: When the target address is not a domain name, a special sequence packet with a magic address and a link tracing identifier is encapsulated and sent to the server.
[0050] In this embodiment, preferably, the protocol handshake module specifically includes: The server parses the additional information fields in the VLESS protocol request header; Determine if a non-empty link tracing identifier exists in the additional information field; If it exists, the server-side session management interface is called to obtain the context tracing object of the current coroutine or request, and the ID attribute of the object is forcibly updated to the received tracing identifier, thereby unifying the log identifiers of the client and the server.
[0051] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.
[0052] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3.
[0053] Example 3 This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the implementation methods in Embodiment 1.
[0054] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.
[0055] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.
[0056] Example 4 This embodiment provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it can implement any of the implementation methods in Embodiment 1.
[0057] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0058] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0059] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0060] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0061] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for end-to-end log tracing based on the VLESS protocol, characterized in that: Includes the following steps: Step 1: When creating a proxy protocol client instance, receive and configure tracing option parameters to determine whether to enable the link tracing function; Step 2: When the client initiates an outbound connection request, a transport layer connection to the underlying server is established; at the same time, the context of the current request is checked. If tracing is enabled and the context contains a log identifier, the identifier is extracted as the link tracing identifier. Step 3: When the client performs the application layer protocol handshake, it encapsulates the link tracing identifier into the protocol handshake data packet and sends it to the server. Step 4: The server receives and parses the handshake data packet, extracts the link tracing identifier from it; then it obtains the context object of the current session of the server, writes the extracted link tracing identifier into the context object, so as to replace or set the log identifier of the current session of the server, thereby realizing the unification of the log identifier between the client and the server.
2. The end-to-end log tracing method based on the VLESS protocol according to claim 1, characterized in that: Step 2 specifically involves: when the client initiates an outbound connection request, establishing a transport layer connection to the underlying server; determining whether to use a custom transport layer based on the configuration; if a custom transport layer exists, establishing a connection using a custom transport layer; if no custom transport layer exists, establishing a TCP connection, and determining whether to perform a TLS encrypted handshake based on the configuration. After the transport layer connection is successfully established, the context of the current request is detected. If the tracing function is enabled, the unique UUID generated when the current request flows within the client is obtained through the context reading method, and it is formatted as a link tracing identifier in string form.
3. The end-to-end log tracing method based on the VLESS protocol according to claim 1, characterized in that: Step 3 specifically involves: When the network type is TCP, the TCP handshake interface is called, the link tracing identifier is passed in as a parameter, and sent to the server; When the network type is UDP, the link tracing identifier is sent using one of the following methods depending on the configuration mode: Standard UDP mode: Directly call the UDP handshake interface to send data to the server; Extended UDP mode: Calls the extended UDP handshake interface that supports multiplexing or specific optimizations to send to the server; PacketAddr mode: When the target address is not a domain name, a special sequence packet with a magic address and a link tracing identifier is encapsulated and sent to the server.
4. The end-to-end log tracing method based on the VLESS protocol according to claim 1, characterized in that: Step 4 specifically includes: The server parses the additional information fields in the VLESS protocol request header; Determine if a non-empty link tracing identifier exists in the additional information field; If it exists, the server-side session management interface is called to obtain the context tracing object of the current coroutine or request, and the ID attribute of the object is forcibly updated to the received tracing identifier, thereby unifying the log identifiers of the client and the server.
5. A full-link log tracing device based on the VLESS protocol, characterized in that: include: The configuration module receives and configures tracing option parameters when creating a proxy protocol client instance to determine whether to enable the link tracing function; The connection management module establishes a transport layer connection to the underlying server when a client initiates an outbound connection request. At the same time, the context of the current request is detected. If the tracing function is enabled and the context contains a log identifier, the identifier is extracted as the link tracing identifier. The tracking identifier extraction module encapsulates the link tracking identifier into the handshake data packet of the protocol and sends it to the server during the application layer protocol handshake. The protocol handshake module receives and parses the handshake data packet, extracting the link tracing identifier from it. Then, it obtains the context object of the current session on the server and writes the extracted link tracing identifier into the context object to replace or set the log identifier of the current session on the server, thereby unifying the log identifiers of the client and the server.
6. The end-to-end log tracing device based on the VLESS protocol according to claim 5, characterized in that: The connection management module specifically performs the following steps: when a client initiates an outbound connection request, it establishes a transport layer connection to the underlying server; it determines whether to use a custom transport layer based on the configuration; if a custom transport layer exists, it uses the custom transport layer to establish the connection; if a custom transport layer does not exist, it establishes a TCP connection and determines whether to perform a TLS encrypted handshake based on the configuration. After the transport layer connection is successfully established, the context of the current request is detected. If the tracing function is enabled, the unique UUID generated when the current request flows within the client is obtained through the context reading method, and it is formatted as a link tracing identifier in string form.
7. A full-link log tracing device based on the VLESS protocol according to claim 5, characterized in that: The tracking identifier extraction module specifically comprises: When the network type is TCP, the TCP handshake interface is called, the link tracing identifier is passed in as a parameter, and sent to the server; When the network type is UDP, the link tracing identifier is sent using one of the following methods depending on the configuration mode: Standard UDP mode: Directly call the UDP handshake interface to send data to the server; Extended UDP mode: Calls the extended UDP handshake interface that supports multiplexing or specific optimizations to send to the server; PacketAddr mode: When the target address is not a domain name, a special sequence packet with a magic address and a link tracing identifier is encapsulated and sent to the server.
8. A full-link log tracing device based on the VLESS protocol according to claim 5, characterized in that: The protocol handshake module specifically includes: The server parses the additional information fields in the VLESS protocol request header; Determine if a non-empty link tracing identifier exists in the additional information field; If it exists, the server-side session management interface is called to obtain the context tracing object of the current coroutine or request, and the ID attribute of the object is forcibly updated to the received tracing identifier, thereby unifying the log identifiers of the client and the server.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 4.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 4.