Traffic management methods and apparatuses

By detecting and adjusting the policy of the drainage client, the service abnormality problem of multiple drainage clients is solved when running at the same time, and the correct traffic drainage and compatibility improvement is achieved.

WO2025138972A1PCT designated stage expired Publication Date: 2025-07-03HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/115450
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-28
Filing Date
2024-08-29
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

When multiple drainage clients are running at the same time on the terminal, some drainage clients cannot drain traffic in the way they expect, resulting in service exceptions.

Method used

Detect whether the second drainage client has been started and, if necessary, set the policy of the first drainage client to user state or kernel state to ensure that it can drain traffic in the expected way and avoid service exceptions.

Benefits of technology

Improves compatibility between drainage clients, reduces the occurrence of service exceptions, and ensures that traffic can be properly drained.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024115450_03072025_PF_FP_ABST
    Figure CN2024115450_03072025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present disclosure are traffic management methods and apparatuses. In the present disclosure, a method comprises: detecting whether a second traffic redirection client has been started in an electronic device, the second traffic redirection client having a built-in kernel-mode traffic redirection strategy; and, when the second traffic redirection client has been started in the electronic device, setting the traffic redirection strategy of a first traffic redirection client to be a user-mode traffic redirection strategy, such that the first traffic redirection client redirects a traffic on the basis of the user-mode traffic redirection strategy. The present disclosure can increase the opportunity of the first traffic redirection client redirecting the traffic in a user mode, so as to increase the opportunity of the traffic being redirected by the first traffic redirection client, and further increase the probability of the traffic being redirected by the first traffic redirection client in an expected redirection mode of the first traffic redirection client, thereby avoiding service anomalies involving the first traffic redirection client, and improving the compatibility between the first traffic redirection client and the second traffic redirection client.
Need to check novelty before this filing date? Find Prior Art

Description

Traffic management method and device

[0001] This disclosure claims priority to the Chinese patent application filed with the China Patent Office on December 28, 2023, with application number 202311843710.6 and application name “A Traffic Management Method and Device,” the entire contents of which are incorporated by reference into this disclosure. Technical Field

[0002] The present disclosure relates to the field of computer technology, and in particular to a traffic management method and device. Background Art

[0003] Currently, there are various traffic diversion clients on the market (for example, redirection software for redirecting traffic, etc.), such as VPN (Virtual Private Network), antivirus software and acceleration software, etc. Users can install the traffic diversion client on their terminals and start the traffic diversion client on the terminals so that the traffic diversion client can divert the traffic of the terminals.

[0004] However, sometimes, users may run multiple traffic diversion clients on the terminal at the same time. For example, they may start not only antivirus software but also VPN on the terminal.

[0005] However, the inventors discovered that when multiple traffic diversion clients are running simultaneously on a terminal, sometimes some traffic diversion clients are unable to divert the traffic they need to divert in the expected way, and are unable to meet the user's expected needs for these traffic diversion clients, which may very likely cause service abnormalities involving these traffic diversion clients.

[0006] Summary of the Invention

[0007] The present disclosure provides a traffic management method and apparatus.

[0008] In the first aspect, the present disclosure shows a traffic management method, which is applied to an electronic device; a first traffic diversion client has been started in the electronic device; the first traffic diversion client has built-in kernel-state traffic diversion strategy and user-state traffic diversion strategy; the method includes: detecting whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has built-in the kernel-state traffic diversion strategy; when the second traffic diversion client has been started in the electronic device, setting the diversion strategy of the first traffic diversion client to the user-state diversion strategy, so that the first traffic diversion client diverts traffic based on the user-state diversion strategy.

[0009] In the second aspect, the present disclosure shows a traffic management method, which is applied to an electronic device; a first traffic diversion client has been started in the electronic device; the first traffic diversion client has built-in kernel-state traffic diversion strategy and user-state traffic diversion strategy; the method includes: detecting whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has built-in the kernel-state traffic diversion strategy; when the second traffic diversion client has been started in the electronic device, closing the second traffic diversion client in the electronic device; setting the diversion strategy of the first traffic diversion client to the kernel-state diversion strategy, so that the first traffic diversion client diverts traffic based on the kernel-state diversion strategy.

[0010] In the third aspect, the present disclosure shows a traffic management device, which is applied to an electronic device; a first traffic diversion client has been started in the electronic device; the first traffic diversion client has built-in kernel-state traffic diversion strategy and user-state traffic diversion strategy; the device includes: a first detection module, used to detect whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has built-in the kernel-state traffic diversion strategy; a first setting module, used to set the diversion strategy of the first traffic diversion client to the user-state diversion strategy when the second traffic diversion client has been started in the electronic device, so that the first traffic diversion client diverts traffic based on the user-state diversion strategy.

[0011] In a fourth aspect, the present disclosure shows a traffic management device, which is applied to an electronic device; a first traffic diversion client has been started in the electronic device; the first traffic diversion client has built-in kernel-state traffic diversion strategy and user-state traffic diversion strategy; the device includes: a third detection module, used to detect whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has built-in the kernel-state traffic diversion strategy; a second closing module, used to close the second traffic diversion client in the electronic device when the second traffic diversion client has been started in the electronic device; a third setting module, used to set the diversion strategy of the first traffic diversion client to the kernel-state diversion strategy, so that the first traffic diversion client diverts traffic based on the kernel-state diversion strategy.

[0012] In a fifth aspect, the present disclosure shows an electronic device, which includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the method shown in any of the aforementioned aspects.

[0013] In a sixth aspect, the present disclosure shows a non-transitory computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the method shown in any of the aforementioned aspects.

[0014] In a seventh aspect, the present disclosure shows a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to perform the method shown in any of the aforementioned aspects.

[0015] Compared with the prior art, the present disclosure has the following advantages:

[0016] In the present disclosure, it is detected whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has a built-in kernel-state traffic diversion strategy. When the second traffic diversion client has been started in the electronic device, the traffic diversion strategy of the first traffic diversion client is set to the user-state traffic diversion strategy, so that the first traffic diversion client diverts traffic based on the user-state traffic diversion strategy.

[0017] When the second traffic diversion client has been started in the electronic device, the second traffic diversion client will intercept the traffic in the kernel state and process the traffic (for example, add content or divert traffic, etc.). In addition, if the priority of the second traffic diversion client for processing the traffic in the kernel state is higher than the priority of the first traffic diversion client for processing the traffic in the kernel state, the first traffic diversion client will be affected by the second traffic diversion client in the scenario of diverting traffic to the terminal. For example, after the second traffic diversion client processes a certain traffic in the kernel state, in order to avoid the traffic entering an infinite loop in the kernel state, the first traffic diversion client will no longer divert the traffic in the kernel state.

[0018] However, after the second diversion client processes a certain traffic in the kernel state, the second diversion client will transfer the certain traffic to the user state. After the traffic is transferred to the user state, the user state diversion client diverts the traffic in the user state and will not cause the traffic to enter an infinite loop in the user state, and the user state diversion client diverts the traffic in the user state will not be affected by the second diversion client. In this way, the user state diversion client can often still continue to divert the traffic in the user state.

[0019] In addition, in a scenario where the second traffic diversion client has a higher priority for processing traffic in the kernel state than the first traffic diversion client, if the second traffic diversion client intercepts and processes the traffic in the kernel state, sometimes it is not processing the traffic with respect to diversion, but rather processing the traffic with respect to adding content. For example, the second traffic diversion client is not interested in the traffic and detects that the traffic is not traffic that needs to be diverted by the second traffic diversion client. However, after the second traffic diversion client intercepts the traffic in the kernel state, it may sometimes process the traffic with respect to adding content, for example, adding some information / parameters to the traffic (some information / parameters may be content used to indicate the identity of the second traffic diversion client, or content used to indicate that the traffic has been intercepted by the second traffic diversion client). After the second traffic diversion client performs simple processing on the traffic, it does not affect the subsequent first traffic diversion client in the user state to divert the traffic in the manner expected by the first traffic diversion client. That is, the first traffic diversion client can divert the traffic in the user state in the manner expected by the first traffic diversion client.

[0020] In this way, the first diversion client can try to divert the traffic in user mode. That is, even if the traffic cannot be diverted by the first diversion client in kernel mode due to the influence of the second diversion client with higher priority, the chance of the first diversion client diverting the traffic in user mode can be increased, so as to increase the chance that the traffic can be diverted by the first diversion client, thereby increasing the possibility that the traffic can be diverted by the first diversion client in the diversion method expected by the first diversion client, so as to avoid service anomalies involving the first diversion client as much as possible, and improve the compatibility between the first diversion client and the second diversion client. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] FIG1 is a flow chart of the steps of a traffic management method disclosed in the present invention;

[0022] FIG2 is a flow chart of the steps of a traffic management method disclosed in the present invention;

[0023] FIG3 is a flow chart of the steps of a traffic management method disclosed in the present invention;

[0024] FIG4 is a flow chart of the steps of a traffic management method disclosed in the present invention;

[0025] FIG5 is a flow chart of the steps of a traffic management method disclosed in the present invention;

[0026] FIG6 is a structural block diagram of a traffic management device disclosed in the present invention;

[0027] FIG7 is a structural block diagram of a traffic management device disclosed in the present invention;

[0028] FIG8 is a structural block diagram of a device disclosed herein. DETAILED DESCRIPTION

[0029] In order to make the above-mentioned objects, features and advantages of the present disclosure more obvious and easy to understand, the present disclosure is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0030] The following description sets forth many specific details to facilitate a thorough understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0031] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a," "the," and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0032] Before introducing the solutions of the present disclosure, the technical terms that may be involved in the solutions of the present disclosure are first explained.

[0033] An operating system (OS) is a set of interrelated system software programs that manage and control computer operations, utilize and run hardware and software resources, and provide common services to organize user interactions. Depending on the operating environment, operating systems can be categorized as desktop, mobile, server, and embedded. Examples include Windows, macOS, and Linux. Operating systems operate in two states: user mode and kernel mode.

[0034] User mode: The CPU (Central Processing Unit) in user mode can only access restricted resources and cannot directly access hardware devices such as memory. It must fall into the kernel through "system calls" to access these privileged resources.

[0035] Kernel state: The CPU in kernel state can access any data, including peripheral devices such as network cards and hard disks. The CPU in kernel state can switch from one program to another without CPU preemption. The state at privilege level 0 is generally called kernel state.

[0036] WFP, short for Windows Filtering Platform, is a network packet processing framework in Microsoft's Windows operating system. WFP allows developers to filter, modify, and redirect network packets to achieve network security and management functions.

[0037] NE, Network Extension, is a network packet processing framework in Apple's macOS operating system. NE allows developers to filter, modify, and redirect network packets to achieve network security and management functions.

[0038] Netfilter is a subsystem introduced in Linux 2.4.x. As a general, abstract framework, it provides a complete set of hook function management mechanisms, making it possible to perform packet filtering, network address translation (NAT), and protocol-based connection tracking.

[0039] Virtual Network Card: A virtual network card created within a computer system. It can simulate the functionality of multiple physical network cards, allowing a computer to connect to multiple networks simultaneously or achieve network isolation.

[0040] A routing table is a table used to store and manage network routing information for a router (or operating system). It records the destination and next hop information for each IP (Internet Protocol) address segment on the network, determining the transmission path for data packets. The routing table can redirect and manage data traffic by adding, deleting, and modifying entries.

[0041] Traffic diversion, flow guidance or flow control, the purpose of traffic diversion is to guide network traffic from the source address to the destination address according to a specific strategy or to control network traffic according to the target processing method.

[0042] Redirect, Redirect, redirects various network requests to other locations through various methods (such as: web page redirection, domain name redirection, and changes in routing selection are also a redirection of the path through which data packets pass).

[0043] VPN, or Virtual Private Network, is a technology that establishes a secure connection between private networks over a public network. Using encryption and tunneling technology, VPNs enable users to access private network resources over a public network while ensuring data confidentiality and integrity.

[0044] Antivirus software, also known as anti-virus software or anti-malware software, is a type of software used to eliminate computer threats such as viruses, Trojan horses, and malware. Antivirus software typically integrates detection and identification, virus scanning and removal, automatic updates, and proactive defense features. Some antivirus software also includes data recovery, hacker protection, and network traffic control. It is a crucial component of computer defense systems (including antivirus software, firewalls, Trojan horse and malware detection and removal programs, and intrusion prevention systems).

[0045] The Domain Name System (DNS) is an Internet service. It serves as a distributed database that maps domain names to IP addresses, making Internet access more convenient. DNS uses UDP (User Datagram Protocol) port 53. Currently, the length of each domain name is limited to 63 characters, and the total length of a domain name cannot exceed 253 characters.

[0046] Among them, the inventors found that the current traffic diversion clients on the market include kernel-state traffic diversion clients, which can divert terminal traffic in kernel state through the kernel-state traffic diversion framework of the terminal's operating system.

[0047] Sometimes, more than two kernel-state traffic diversion clients will run on the terminal at the same time. Each kernel-state traffic diversion client has a priority order for traffic processing in the kernel state (for example, adding content or diversion, etc.), and each kernel-state traffic diversion client has a different diversion method for the terminal's traffic in the kernel state (for example, redirecting to different destination addresses, etc.).

[0048] In one example, for any traffic of the terminal, in the kernel state, it is often the kernel state diversion client with the highest priority that intercepts the traffic first, and then the kernel state diversion client with the highest priority can determine whether the traffic needs to be processed (for example, adding content or diversion, etc.). If the kernel state diversion client with the highest priority determines that the traffic needs to be processed in the kernel state, the kernel state diversion client with the highest priority will process the traffic in the kernel state using its built-in processing method (which may be diversion, or it may be adding some relevant parameters about the kernel state diversion client with the highest priority in the body of the traffic, etc.). After the kernel state diversion client with the highest priority processes the traffic in the kernel state, under normal circumstances, other kernel state diversion clients (kernel state diversion clients with non-highest priority) will not divert the traffic in the kernel state (other kernel state diversion clients will filter out the traffic) to avoid the traffic entering an infinite loop in the kernel state.

[0049] However, the inventors have found that sometimes there is a situation where the traffic is not expected to be processed by the highest priority kernel-state diversion client, but is expected to be diverted by a kernel-state diversion client with a lower priority.

[0050] However, based on the above description, it can be seen that after the kernel-state diversion client with the highest priority processes the traffic in the kernel state, in order to avoid the traffic entering an infinite loop in the kernel state, other kernel-state diversion clients will no longer divert the traffic in the kernel state. For example, the various kernel-state diversion clients with non-highest priority will no longer divert the traffic in the kernel state, and the purpose of "the traffic is expected to be diverted by the kernel-state diversion client with non-highest priority" cannot be achieved, which is likely to cause service abnormalities involving the kernel-state diversion client with non-highest priority.

[0051] In summary, due to the interference of other diversion clients, the traffic "expected to be diverted by a diversion client" may not be diverted by the diversion client, which may cause the service involved in the diversion client to be abnormal.

[0052] Thus, in order to avoid service anomalies involving the one diversion client, in one approach, it is necessary to enable the traffic that is "expected to be diverted by the one diversion client" to be diverted by the one diversion client as much as possible.

[0053] In order to ensure that the traffic that is expected to be diverted by this diversion client can be diverted as much as possible by this diversion client, the inventors found that sometimes there is a possible situation: a certain diversion client can divert traffic in kernel state and can also divert traffic in user state, that is, this certain diversion client has both kernel state diversion strategy and user state diversion strategy.

[0054] Among them, diverting traffic in user state can be understood as: diverting traffic to the terminal in user state based on the user state diversion framework of the terminal operating system, for example, diverting traffic to the terminal through a routing table in user state.

[0055] In this way, in one case, when a certain diversion client has been started on the terminal, if other kernel-state diversion clients are not started on the terminal, then for this certain diversion client, traffic can be diverted in the kernel state. For example, the kernel-state diversion strategy of the certain diversion client can be started, and traffic can be diverted based on the kernel-state diversion strategy.

[0056] In this case, since no other diversion clients are started in the kernel state, no other diversion clients in the kernel state will intercept the traffic and process the traffic in the kernel state (for example, add content or divert traffic, etc.). Only this certain client will divert traffic in the kernel state. Therefore, there is no traffic that is "expected to be processed in the kernel state by other diversion clients in the kernel state", and there is only traffic that is "expected to be diverted by this certain diversion client".

[0057] In this way, for the terminal's traffic, no other kernel-mode traffic diversion clients will intercept and process the terminal's traffic in the kernel. The terminal's traffic will only be intercepted and diverted by the specific diversion client in the kernel and diverted according to the diversion method expected by the specific diversion client. Therefore, the diversion of terminal traffic by the specific diversion client will not be affected by other kernel-mode traffic diversion clients. This ensures that traffic "expected to be diverted by the specific diversion client" can be diverted by the specific diversion client, avoiding service anomalies related to the specific diversion client.

[0058] Alternatively, in another case, when a certain diversion client is started on the terminal, if other kernel-state diversion clients have been started on the terminal, and the priority of traffic processing in the kernel state of the other started kernel-state diversion clients is higher than the priority of traffic processing in the kernel state of the certain diversion client, then for the certain diversion client, the user-state diversion strategy of the certain diversion client can be started, and the kernel-state diversion strategy of the certain client can be turned off, that is, the certain client can divert traffic in the user state instead of in the kernel state, for example, traffic can be diverted based on the user-state diversion strategy.

[0059] In this case, other kernel-state diversion clients will intercept traffic and process it in kernel state (for example, adding content or diverting traffic, etc.), and the priority of other kernel-state diversion clients in processing traffic in kernel state is higher than the priority of this certain kernel-state diversion client in processing traffic in kernel state. Therefore, this certain kernel-state diversion client will be affected by other kernel-state diversion clients in the scenario of diverting traffic to the terminal. For example, after other kernel-state diversion clients with high priority process a certain traffic in kernel state, in order to avoid the traffic entering an infinite loop in kernel state, this certain kernel-state diversion client will no longer divert the traffic in kernel state.

[0060] However, after other kernel-state diversion clients with high priority process a certain traffic in the kernel state, the other kernel-state diversion clients with high priority will transfer the certain traffic to the user state. After the traffic is transferred to the user state, the user-state diversion client diverts the traffic in the user state and will not cause the traffic to enter an infinite loop in the user state, and the diversion of the traffic by the certain diversion client in the user state will not be affected by other kernel-state diversion clients. In this way, the certain diversion client can often continue to divert the traffic in the user state based on the user-state diversion strategy.

[0061] In addition, in the scenario where the priority of other kernel-state diversion clients in processing traffic in the kernel state is higher than the priority of a certain kernel-state diversion client in processing traffic in the kernel state, if the other kernel-state diversion clients process the traffic in the kernel state, sometimes it is not the processing of the traffic regarding diversion, but the processing of adding content to the traffic. For example, the other kernel-state diversion clients are not interested in the traffic and detect that the traffic is not the traffic that needs to be diverted by other kernel-state diversion clients. However, after intercepting the traffic in the kernel state, the other kernel-state diversion clients may sometimes perform simple processing on the traffic, for example, adding some information / parameters to the traffic (some information / parameters may be content used to indicate the identity of other kernel-state diversion clients, or content used to indicate that the traffic has been intercepted by other kernel-state diversion clients). After the other kernel-state diversion clients perform simple processing on the traffic, it does not affect the subsequent diversion of the traffic by the certain kernel-state diversion client in the user state according to the diversion method expected by the certain kernel-state diversion client. That is, the traffic can be diverted by the certain kernel-state diversion client in the user state according to the diversion method expected by the certain kernel-state diversion client.

[0062] In this way, the certain diversion client can try to divert the traffic in the user state, that is, even if the traffic cannot be diverted by the certain diversion client in the kernel state due to the influence of other diversion clients in the kernel state with higher priority, the chance of the certain diversion client to divert the traffic in the user state can be increased, so as to increase the chance that the traffic can be diverted by the certain diversion client, and thus increase the possibility that the traffic can be diverted by the certain diversion client in the diversion method expected by the certain diversion client, so as to avoid service anomalies involving the certain diversion client as much as possible, and improve the compatibility between the certain diversion client and other diversion clients in the kernel state.

[0063] For example, in one embodiment, referring to FIG1 , a traffic management method of the present disclosure is shown, where the method is applied to an electronic device, and a first traffic diversion client has been started in the electronic device.

[0064] Traffic diversion clients may include applications used for traffic diversion, such as VPN, acceleration software, and antivirus software.

[0065] The first traffic diversion client has a built-in kernel-state traffic diversion strategy and a user-state traffic diversion strategy, that is, the first traffic diversion client can select the kernel-state traffic diversion strategy to divert traffic, or can also select the user-state kernel strategy to divert traffic.

[0066] Kernel-state traffic diversion policies include: policies for directing and controlling traffic in the kernel state of the operating system, such as policies for directing and controlling traffic through WFP in the Windows operating system, policies for directing and controlling traffic through Network Extension in the macOS operating system, and policies for directing and controlling traffic through Netfilter in the Linux operating system.

[0067] User-mode traffic diversion strategies include: strategies for directing and controlling traffic in the user mode of the operating system, for example, strategies for directing and controlling traffic through the operating system's routing table, etc.

[0068] Among them, electronic devices may include terminals and servers, etc. Terminals may include physical machines and virtual machines, etc. Physical machines may include desktop computers, tablet computers, mobile phones, laptops or PDAs (Personal Digital Assistants), etc. Servers may include ECS (Elastic Compute Service), etc.

[0069] The method includes:

[0070] In step S101, it is detected whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has a built-in kernel-mode traffic diversion strategy.

[0071] The second traffic diversion client and the first traffic diversion client are different traffic diversion clients.

[0072] In the present disclosure, when the second traffic diversion client has a built-in kernel-state traffic diversion strategy, the second traffic diversion client does not have other built-in traffic diversion strategies, for example, the second traffic diversion client does not have a built-in user-state traffic diversion strategy, etc. In this case, the second traffic diversion client can divert traffic based on the kernel-state traffic diversion strategy, rather than diverting traffic based on the user-state traffic diversion strategy.

[0073] In one embodiment of the present disclosure, in a scenario where the first traffic diversion client has been started in the electronic device, it is possible to periodically (the present disclosure does not limit the periodic period) detect whether the second traffic diversion client has been started in the electronic device or continuously detect in real time whether the second traffic diversion client has been started in the electronic device, and execute step S102 or step S103 accordingly based on the detection result.

[0074] The specific detection method for detecting whether the second traffic diversion client has been started in the electronic device can be referred to the embodiment shown in FIG2 , which will not be described in detail here.

[0075] When the second traffic diversion client has been started in the electronic device, in step S102, the traffic diversion strategy of the first traffic diversion client is set to the user-state traffic diversion strategy, so that the first traffic diversion client diverts traffic based on the user-state traffic diversion strategy.

[0076] When the second traffic diversion client has been started in the electronic device, the second traffic diversion client will often divert traffic based on the kernel-state diversion strategy. If the diversion strategy of the first traffic diversion client is set to the kernel-state diversion strategy, the second traffic diversion client may affect the "first traffic diversion client in the kernel state", which may cause the first traffic diversion client to be unable to divert the traffic it needs to divert in the way expected by the first traffic diversion client, which may cause the service involving the first traffic diversion client to be abnormal.

[0077] In this way, in order to avoid service anomalies involving the first traffic diversion client, the diversion strategy of the first traffic diversion client can be set as a user-state diversion strategy, so that the first traffic diversion client diverts traffic based on the user-state diversion strategy.

[0078] It should be noted that the specific diversion method of the first diversion client for diverting traffic based on the user-state diversion strategy can be referred to the currently existing diversion method, and this disclosure will not elaborate on it.

[0079] When the second traffic diversion client is not started in the electronic device, in step S103, the traffic diversion strategy of the first traffic diversion client is set to the kernel state traffic diversion strategy, so that the first traffic diversion client diverts traffic based on the kernel state traffic diversion strategy.

[0080] Traffic may include data or information, such as data packets or messages.

[0081] Traffic may include data or information sent by an electronic device to the outside, or may also include data or information received by an electronic device or sent by the outside to the electronic device.

[0082] Traffic may include traffic related to requests, or may also include traffic related to responses (such as responses corresponding to requests).

[0083] In the present disclosure, it is detected whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has a built-in kernel-state traffic diversion strategy. When the second traffic diversion client has been started in the electronic device, the traffic diversion strategy of the first traffic diversion client is set to the user-state traffic diversion strategy, so that the first traffic diversion client diverts traffic based on the user-state traffic diversion strategy.

[0084] When the second traffic diversion client has been started in the electronic device, the second traffic diversion client will intercept the traffic in the kernel state and process the traffic (for example, add content or divert traffic, etc.). In addition, if the priority of the second traffic diversion client for processing the traffic in the kernel state is higher than the priority of the first traffic diversion client for processing the traffic in the kernel state, the first traffic diversion client will be affected by the second traffic diversion client in the scenario of diverting traffic to the terminal. For example, after the second traffic diversion client processes a certain traffic in the kernel state, in order to avoid the traffic entering an infinite loop in the kernel state, the first traffic diversion client will no longer divert the traffic in the kernel state.

[0085] However, after the second diversion client processes a certain traffic in the kernel state, the second diversion client will transfer the certain traffic to the user state. After the traffic is transferred to the user state, the user state diversion client diverts the traffic in the user state and will not cause the traffic to enter an infinite loop in the user state, and the user state diversion client diverts the traffic in the user state will not be affected by the second diversion client. In this way, the user state diversion client can often still continue to divert the traffic in the user state.

[0086] In addition, in a scenario where the second traffic diversion client has a higher priority for processing traffic in the kernel state than the first traffic diversion client, if the second traffic diversion client intercepts and processes the traffic in the kernel state, sometimes it is not processing the traffic with respect to diversion, but rather processing the traffic with respect to adding content. For example, the second traffic diversion client is not interested in the traffic and detects that the traffic is not traffic that needs to be diverted by the second traffic diversion client. However, after the second traffic diversion client intercepts the traffic in the kernel state, it may sometimes process the traffic with respect to adding content, for example, adding some information / parameters to the traffic (some information / parameters may be content used to indicate the identity of the second traffic diversion client, or content used to indicate that the traffic has been intercepted by the second traffic diversion client). After the second traffic diversion client performs simple processing on the traffic, it does not affect the subsequent first traffic diversion client in the user state to divert the traffic in the manner expected by the first traffic diversion client. That is, the first traffic diversion client can divert the traffic in the user state in the manner expected by the first traffic diversion client.

[0087] In this way, the first diversion client can try to divert the traffic in user mode. That is, even if the traffic cannot be diverted by the first diversion client in kernel mode due to the influence of the second diversion client with higher priority, the chance of the first diversion client diverting the traffic in user mode can be increased, so as to increase the chance that the traffic can be diverted by the first diversion client, thereby increasing the possibility that the traffic can be diverted by the first diversion client in the diversion method expected by the first diversion client, so as to avoid service anomalies involving the first diversion client as much as possible, and improve the compatibility between the first diversion client and the second diversion client.

[0088] In another embodiment of the present disclosure, the first traffic diversion client has been started in the electronic device. At this time, the first traffic diversion client may have the traffic diversion function turned on or may not have the traffic diversion function turned on. Only when the first traffic diversion client turns on the traffic diversion function will the first traffic diversion client divert traffic. Alternatively, when the first traffic diversion client does not turn on the traffic diversion function, the first traffic diversion client will not divert traffic.

[0089] Since "when the first diversion client does not turn on the diversion function, the first diversion client will not divert traffic", therefore, in this case, regardless of whether the second diversion client has been started in the electronic device, there is no situation where the second diversion client will affect "the first diversion client's diversion of traffic in the kernel state", and thus there is no situation where "the first diversion client cannot divert the traffic it needs to divert in the diversion method expected by the first diversion client", and thus there is no situation where "the service involved in the first diversion client is abnormal". Therefore, there is no need to detect whether the second diversion client has been started in the electronic device, otherwise it will waste the system resources of the electronic device.

[0090] Thus, in order to save system resources of the electronic device, in another embodiment of the present disclosure, upon receiving an activation operation for activating the traffic diversion function of the first traffic diversion client, it is detected whether the second traffic diversion client has been activated in the electronic device. Through this embodiment, it is not necessary to detect whether the second traffic diversion client has been activated in the electronic device, thereby saving system resources of the electronic device.

[0091] Alternatively, in another embodiment of the present disclosure, in the process of a user using an electronic device, sometimes other clients may be started in the electronic device according to actual needs to use other clients. The other clients started may be diversion clients, or may not be diversion clients. If the other clients started are diversion clients and are diversion clients with built-in kernel-state diversion strategies, then the other clients may have an impact on "the first diversion client diverting traffic in the kernel state", which may cause the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, which may further cause the service involved in the first diversion client to be abnormal. In this way, in order to avoid the service abnormality involved in the first diversion client, it is necessary to detect whether the second diversion client has been started in the electronic device. For example, when a new client is started in the electronic device, it is detected whether the second diversion client has been started in the electronic device. Through this embodiment, it is not detected whether the second diversion client has been started in the electronic device when it is not necessary, thereby saving system resources of the electronic device.

[0092] Alternatively, in another embodiment of the present disclosure, when an already started client is shut down in the electronic device, it is detected whether a second traffic diversion client has been started in the electronic device. With this embodiment, it is not necessary to detect whether the second traffic diversion client has been started in the electronic device, thereby saving system resources of the electronic device.

[0093] In addition, in another embodiment, when the second traffic diversion client is not started in the electronic device, the diversion strategy of the first traffic diversion client can be set to a kernel-state diversion strategy so that the first traffic diversion client diverts traffic based on the kernel-state diversion strategy, or the diversion strategy of the first traffic diversion client can be set to a user-state diversion strategy so that the first traffic diversion client diverts traffic based on the user-state diversion strategy.

[0094] However, compared with the traffic diversion strategy based on user state, the traffic diversion strategy based on kernel state has finer granularity and is more accurate. For example, the diversion client can obtain more relevant information about the traffic based on the kernel state diversion strategy, such as information about the process of the traffic. In this way, the diversion client can realize traffic diversion of the information of the specified process based on the kernel state diversion strategy. Compared with the kernel state-based diversion strategy that can only divert traffic to a specified network segment (a network segment may involve multiple processes), the diversion granularity is finer and more accurate.

[0095] Thus, in an optional embodiment, when the second diversion client is not started in the electronic device, the diversion strategy of the first diversion client can be set as the kernel state diversion strategy, so that the first diversion client diverts traffic based on the kernel state diversion strategy.

[0096] It should be noted that the specific diversion method of the first diversion client for diverting traffic based on the kernel-state diversion strategy can refer to the currently existing diversion method, which will not be described in detail in this disclosure.

[0097] In one embodiment of the present disclosure, referring to FIG2 , step S101 includes:

[0098] In step S201, identification information of a client started in the electronic device is obtained, and a first client list set in the first traffic diversion client is obtained, wherein the first client list includes identification information of a traffic diversion client with a built-in kernel-mode traffic diversion strategy.

[0099] The identification information of the client may include the name of the client, etc., and the identification information of different clients is different.

[0100] In the present disclosure, the developer of the first traffic diversion client can count in advance the traffic diversion clients on the market that have built-in kernel-state traffic diversion strategies (in one case, the traffic diversion clients counted only have built-in kernel-state traffic diversion strategies, but no other built-in traffic diversion strategies, for example, no built-in user-state traffic diversion strategies), and collect the identification information of the counted traffic diversion clients with built-in kernel-state traffic diversion strategies into a set, and store the set in the cloud corresponding to the first traffic diversion client.

[0101] When the user subsequently installs the first drainage client in the electronic device and the first drainage client is started in the electronic device, the first drainage client will establish a connection with the cloud corresponding to the first drainage client. After that, the cloud corresponding to the first drainage client can push the collection to the first drainage client, and then the first drainage client can store the identification information of the clients in the collection in the first client list. In this way, the first client list has the identification information of the drainage client with a built-in kernel-state drainage strategy.

[0102] In step S202, when identification information of at least one client started in the electronic device is located in the first client list, it is determined that the second traffic diversion client has been started in the electronic device.

[0103] When the identification information of at least one client that has been started in the electronic device is located in the first client list, it indicates that at least one second traffic diversion client has been started in the electronic device.

[0104] In step S203, when the identification information of each client started in the electronic device is not located in the first client list, it is determined that the second traffic diversion client is not started in the electronic device.

[0105] When the identification information of each client started in the electronic device is not located in the first client list, it means that any second traffic diversion client is not started in the electronic device.

[0106] In another embodiment of the present disclosure, the first client list can be updated subsequently according to actual needs. For example, the cloud corresponding to the first drainage client can push update information to the first drainage client. The update information carries the identification information of the drainage client to be updated, and the drainage client to be updated has a built-in kernel-state drainage strategy.

[0107] The first traffic diversion client can receive update information pushed to the first traffic diversion client by the cloud corresponding to the first traffic diversion client, and update the first client list according to the identification information of the traffic diversion client to be updated in the update information.

[0108] For example, in one example, the developer of the first traffic diversion client will continue to count new traffic diversion clients on the market that have built-in kernel-state traffic diversion strategies. For example, the new traffic diversion clients with built-in kernel-state traffic diversion strategies may be: newly manufactured traffic diversion clients from other manufacturers.

[0109] In this case, the majority of users may often use a new drainage client with a built-in kernel-mode drainage strategy. In this way, the new drainage client with a built-in kernel-mode drainage strategy may also be "installed in an electronic device and started in the electronic device."

[0110] In this way, after the new diversion client with a built-in kernel-state diversion strategy is started in the electronic device, the new diversion client with a built-in kernel-state diversion strategy may have an impact on the "first diversion client's traffic diversion in the kernel state", which may cause the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, and may further cause service abnormalities involving the first diversion client.

[0111] In this way, in order to avoid service anomalies involving the first drainage client, it is necessary to achieve the purpose of "detecting whether a new drainage client with a built-in kernel-mode drainage strategy has been started in the electronic device" when "detecting whether the second drainage client has been started in the electronic device".

[0112] In order to achieve the purpose of "detecting whether a new drainage client with a built-in kernel-state drainage strategy has been started in the electronic device" when "detecting whether the second drainage client has been started in the electronic device", it is necessary to have the identification information of the new drainage client with a built-in kernel-state drainage strategy in the first client list.

[0113] In order to make the first client list include identification information of a new traffic diversion client with a built-in kernel-state traffic diversion strategy, it is necessary to add identification information of the new traffic diversion client with a built-in kernel-state traffic diversion strategy to the first client list.

[0114] For example, in one embodiment, the update information is used to indicate the identification information of a new drainage client with a built-in kernel-state drainage strategy added to the first client list. In this way, the first drainage client can store the identification information of the new drainage client with a built-in kernel-state drainage strategy in the first client list to achieve the purpose of adding the identification information of the new drainage client with a built-in kernel-state drainage strategy to the first client list.

[0115] Or, for example, in another example, the developer of the first traffic diversion client will continue to count the old traffic diversion clients that existed on the market before but no longer exist, and have built-in kernel-state traffic diversion strategies. For example, the old traffic diversion clients with built-in kernel-state traffic diversion strategies may be: traffic diversion clients that other manufacturers no longer open to the outside world and no longer provide traffic diversion services to the outside world.

[0116] In this case, the majority of users will often no longer use the old drainage client with a built-in kernel-state drainage strategy. In this way, the old drainage client with a built-in kernel-state drainage strategy will often no longer be "installed in the electronic device and started in the electronic device". In this way, the identification information of the old drainage client with a built-in kernel-state drainage strategy will no longer work, and the first client list can be streamlined. For example, the identification information of the old drainage client with a built-in kernel-state drainage strategy will no longer be stored in the first client list to save storage resources of the electronic device and improve the efficiency of subsequent detection of whether the second drainage client has been started in the electronic device through the embodiment shown in Figure 2.

[0117] For example, in one embodiment, the update information is used to indicate that the identification information of the old drainage client with a built-in kernel-state drainage strategy is deleted from the first client list. In this way, the first drainage client can delete the identification information of the old drainage client with a built-in kernel-state drainage strategy from the first client list.

[0118] In the present disclosure, after setting the diversion strategy of the first diversion client as the user-state diversion strategy, the first diversion client can divert traffic based on the user-state diversion strategy. However, the second diversion client may be manually closed in the electronic device later because the user no longer needs to use the second diversion client, or the second diversion client may be automatically closed in the electronic device due to reasons such as the electronic device's system resource usage being too high.

[0119] If the second diversion client is closed in the electronic device, the electronic device will no longer run the second diversion client, and there will be no situation where "the second diversion client diverts traffic based on the kernel state diversion strategy". In this way, the second diversion client will not affect "the first diversion client diverting traffic in the kernel state", and the first diversion client will not be unable to divert the traffic it needs to divert according to the diversion method expected by the first diversion client due to the second diversion client, and will not cause service abnormalities involving the first diversion client.

[0120] In addition, as mentioned above, the first traffic diversion client's kernel-state-based traffic diversion strategy has the advantages of finer granularity and more accurate traffic diversion compared to the first traffic diversion client's user-state-based traffic diversion strategy.

[0121] In this way, in another embodiment of the present disclosure, after setting the diversion strategy of the first diversion client to the user-state diversion strategy, it can be detected in real time whether the second diversion client is closed in the electronic device. When the second diversion client is closed in the electronic device, the diversion strategy of the first diversion client can be switched from the user-state diversion strategy to the kernel-state diversion strategy, so that the first diversion client diverts traffic based on the kernel-state diversion strategy.

[0122] "The case of closing the second drainage client in the electronic device" can be understood as closing all drainage clients with built-in kernel-state drainage strategies in the electronic device, so that any drainage client with built-in kernel-state drainage strategies is no longer running in the electronic device.

[0123] In addition, after a large number of experimental statistics, through the embodiment shown in Figure 1, in most cases the first diversion client can divert the traffic it needs to divert in the user state according to its expected diversion method, that is, in most cases, service anomalies involving the first diversion client can be avoided (for example, in most cases, the services involved in the first diversion client are normal), and in most cases, the first diversion client and the second diversion client can be made compatible.

[0124] However, sometimes the services involved in the first diversion client are abnormal, and statistics show that it may be that certain specific clients with built-in user-mode diversion strategies that have been started in the electronic device have affected the first diversion client's traffic diversion in the user state.

[0125] Therefore, in order to further improve the possibility of maintaining normal services related to the first traffic diversion client on the basis of the embodiment shown in FIG1 , and to further improve the compatibility between the first traffic diversion client and the second traffic diversion client, based on the embodiment shown in FIG1 , in another embodiment of the present disclosure, referring to FIG3 , the method further includes:

[0126] In the case that the second traffic diversion client has been started in the electronic device, in step S301, it is detected whether the third traffic diversion client has been started in the electronic device, and the third traffic diversion client has a built-in user-mode traffic diversion strategy.

[0127] The third traffic diversion client is a traffic diversion client different from the first traffic diversion client and the first traffic diversion client.

[0128] In the present disclosure, in a scenario where the third traffic diversion client has a built-in user-mode traffic diversion policy, the third traffic diversion client does not have other built-in traffic diversion policies, for example, the third traffic diversion client does not have a built-in kernel-mode traffic diversion policy. In this case, the third traffic diversion client can divert traffic based on the user-mode traffic diversion policy, rather than diverting traffic based on the kernel-mode traffic diversion policy.

[0129] Here, for detecting whether the third traffic diversion client has been started in the electronic device, reference may be made to the embodiment shown in FIG4 , which will not be described in detail here.

[0130] In the case that the third traffic diversion client is not started in the electronic device, step S102 is performed again: the traffic diversion strategy of the first traffic diversion client is set to the user-state traffic diversion strategy.

[0131] In the case that the third traffic diversion client has been started in the electronic device, in step S302, the third traffic diversion client is closed in the electronic device, and then step S102 is performed: the traffic diversion strategy of the first traffic diversion client is set to the user-state traffic diversion strategy.

[0132] After closing the third traffic diversion client in the electronic device, the third traffic diversion client no longer runs in the electronic device, so that any traffic diversion client with a built-in user-state traffic diversion strategy is not started in the electronic device, and thereafter, the situation of "the third traffic diversion client diverting traffic based on the user-state traffic diversion strategy" will not occur.

[0133] In this way, there will be no situation where the third traffic diversion client will affect the "traffic diversion by the first traffic diversion client in the user state", and the third traffic diversion client will not cause the first traffic diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first traffic diversion client, and will not cause service abnormalities involving the first traffic diversion client. That is, after setting the diversion strategy of the first traffic diversion client to the user state diversion strategy, the first traffic diversion client will not be affected by the traffic diversion strategy based on the user state.

[0134] In the present disclosure, when a third traffic diversion client has been started in an electronic device, if the third traffic diversion client is directly closed in the electronic device, it may make the user feel very abrupt, and the user is not clear about the reason for closing the third traffic diversion client in the electronic device. For example, the user may not know that the electronic device is closing the third traffic diversion client in the electronic device for the first traffic diversion client (in order to prevent the first traffic diversion client from being affected by the third traffic diversion client based on the user-state diversion strategy). The user may mistakenly believe that the electronic device has a fault or the third traffic diversion client has a fault, which may reduce the user experience.

[0135] Furthermore, the user may manually control the electronic device to restart the third diversion client, and then the third diversion client may affect the "traffic diversion by the first diversion client in the user state", which may cause the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, and may further cause service abnormalities involving the first diversion client.

[0136] Afterwards, in order to avoid service anomalies involving the first drainage client, the electronic device will close the third drainage client, and then the user manually controls the electronic device to restart the third drainage client, and the cycle repeats, continuously reducing the user experience.

[0137] Therefore, in order to avoid continuously degrading the user experience, in another embodiment of the present disclosure, when the third traffic diversion client has been started in the electronic device, a shutdown prompt message can be displayed. The shutdown prompt message is used to prompt whether to close the third traffic diversion client in the electronic device for the first traffic diversion client. "For the first traffic diversion client" can be understood as: the traffic diversion strategy based on the user state for the first traffic diversion client is not affected by the third traffic diversion client, etc.

[0138] The user can see the displayed closing prompt information. If the user decides to close the third drainage client in the electronic device, the user can enter a confirmation operation for the closing prompt information, or if the user decides not to close the third drainage client in the electronic device, the user can enter a cancel operation for the closing prompt information.

[0139] When the electronic device receives a confirmation operation for closing the prompt information, step S302 is executed again: closing the third traffic diversion client in the electronic device.

[0140] Alternatively, when the electronic device receives a cancel operation to close the prompt information, step S302 is not executed. For example, the third drainage client is not closed in the electronic device, and the third drainage client continues to run in the electronic device (that is, the third drainage client continues to be in an activated state in the electronic device).

[0141] Through the present disclosure, whether to close the third traffic diversion client in the electronic device is left to the user to decide, so that the user is informed and the user experience is avoided from being continuously degraded.

[0142] In one embodiment of the present disclosure, referring to FIG4 , step S301 includes:

[0143] In step S401, identification information of the client started in the electronic device is obtained, and a second client list set in the first diversion client is obtained, where the second client list includes identification information of the diversion client with a built-in user-mode diversion strategy.

[0144] In the present disclosure, the developer of the first traffic diversion client can count in advance the traffic diversion clients on the market that have built-in user-state traffic diversion strategies (in one case, the traffic diversion clients counted only have built-in user-state traffic diversion strategies, but no other built-in, for example, no built-in kernel-state traffic diversion strategies), and collect the identification information of the counted traffic diversion clients with built-in user-state traffic diversion strategies into a set, and store the set in the cloud corresponding to the first traffic diversion client.

[0145] When the user subsequently installs the first drainage client in the electronic device and starts the first drainage client in the electronic device, the first drainage client will establish a connection with the cloud corresponding to the first drainage client. After that, the cloud corresponding to the first drainage client can push the collection to the first drainage client, and then the first drainage client can store the identification information of the clients in the collection in the second client list. In this way, the second client list has the identification information of the drainage client with a built-in user-state drainage strategy.

[0146] In step S402, when identification information of at least one client started in the electronic device is located in the second client list, it is determined that a third traffic diversion client has been started in the electronic device.

[0147] When the identification information of at least one client that has been started in the electronic device is located in the second client list, it indicates that at least one third traffic diversion client has been started in the electronic device.

[0148] In step S403, when the identification information of each client started in the electronic device is not located in the second client list, it is determined that the third traffic diversion client is not started in the electronic device.

[0149] When the identification information of each client started in the electronic device is not located in the second client list, it means that any third traffic diversion client is not started in the electronic device.

[0150] In another embodiment of the present disclosure, the second client list can be updated based on actual needs. For example, the cloud corresponding to the first drainage client can push update information to the first drainage client. The update information carries the identification information of the drainage client to be updated, and the drainage client to be updated has a built-in user-state drainage strategy.

[0151] The first traffic diversion client can receive update information pushed to the first traffic diversion client by the cloud corresponding to the first traffic diversion client, and update the second client list according to the identification information of the traffic diversion client to be updated in the update information.

[0152] For example, in one example, the developer of the first traffic diversion client will continue to count new traffic diversion clients on the market that have built-in user-state traffic diversion strategies. For example, the new traffic diversion clients with built-in user-state traffic diversion strategies may be: newly manufactured traffic diversion clients from other manufacturers.

[0153] In this case, the majority of users may often use a new drainage client with a built-in user-mode drainage strategy. In this way, the new drainage client with a built-in user-mode drainage strategy may also be "installed in an electronic device and started in the electronic device."

[0154] In this way, after the new diversion client with a built-in user-state diversion strategy is started in the electronic device, the new diversion client with a built-in user-state diversion strategy may have an impact on the "first diversion client's traffic diversion in the user state", which may cause the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, and may further cause service abnormalities involving the first diversion client.

[0155] In this way, in order to avoid service anomalies involving the first drainage client, it is necessary to achieve the purpose of "detecting whether a new drainage client with a built-in user-mode drainage strategy has been started in the electronic device" when "detecting whether the third drainage client has been started in the electronic device".

[0156] In order to achieve the purpose of "detecting whether a new drainage client with a built-in user-state drainage strategy has been started in the electronic device" when "detecting whether the third drainage client has been started in the electronic device", it is necessary to have the identification information of the new drainage client with a built-in user-state drainage strategy in the second client list.

[0157] In order to ensure that the second client list has identification information of a new traffic diversion client with a built-in user-state traffic diversion strategy, it is necessary to add identification information of a new traffic diversion client with a built-in user-state traffic diversion strategy to the second client list.

[0158] For example, in one embodiment, the update information is used to indicate the identification information of a new drainage client with a built-in user-state drainage strategy added to the second client list. In this way, the first drainage client can store the identification information of the new drainage client with a built-in user-state drainage strategy in the second client list to achieve the purpose of adding the identification information of the new drainage client with a built-in user-state drainage strategy to the second client list.

[0159] Or, for example, in another example, the developer of the first traffic-generating client will continue to count the old traffic-generating clients that existed on the market before but no longer exist, and have built-in user-state traffic-generating strategies. For example, the old traffic-generating clients with built-in user-state traffic-generating strategies may be: traffic-generating clients that other manufacturers no longer open to the outside world and no longer provide traffic-generating services to the outside world.

[0160] In this case, the majority of users will often no longer use the old drainage client with a built-in user-state drainage strategy. In this way, the old drainage client with a built-in user-state drainage strategy will often no longer be "installed in the electronic device and started in the electronic device". In this way, the identification information of the old drainage client with a built-in user-state drainage strategy will no longer work, and the second client list can be streamlined. For example, the identification information of the old drainage client with a built-in user-state drainage strategy will no longer be stored in the second client list to save storage resources of the electronic device and improve the efficiency of subsequent detection of whether the third drainage client has been started in the electronic device through the embodiment shown in Figure 4.

[0161] For example, in one embodiment, the update information is used to indicate that the identification information of the old drainage client with a built-in user-state drainage strategy is deleted from the second client list. In this way, the first drainage client can delete the identification information of the old drainage client with a built-in user-state drainage strategy from the second client list.

[0162] Alternatively, in another embodiment, referring to FIG5 , a traffic management method of the present disclosure is shown, which is applied to an electronic device in which a first traffic diversion client is started. The first traffic diversion client has built-in kernel-mode traffic diversion strategies and user-mode traffic diversion strategies.

[0163] The method includes:

[0164] In step S501, it is detected whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has a built-in kernel-mode traffic diversion strategy.

[0165] This step can refer to the description of step S101 and will not be described in detail here.

[0166] If the second traffic diversion client has been started in the electronic device, step S502 may be executed, or if the second traffic diversion client has not been started in the electronic device, step S503 may be directly executed.

[0167] In the case that the second traffic diversion client has been started in the electronic device, in step S502, the second traffic diversion client is closed in the electronic device.

[0168] When the second traffic diversion client has been started in the electronic device, the second traffic diversion client will often divert traffic based on the kernel-state diversion strategy. If the diversion strategy of the first traffic diversion client is set to the kernel-state diversion strategy, the second traffic diversion client may affect the "first traffic diversion client in the kernel state", which may cause the first traffic diversion client to be unable to divert the traffic it needs to divert in the way expected by the first traffic diversion client, which may cause the service involving the first traffic diversion client to be abnormal.

[0169] In this way, in order to avoid service anomalies related to the first traffic diversion client, the second traffic diversion client can be closed in the electronic device.

[0170] After closing the second diversion client in the electronic device, the second diversion client no longer runs in the electronic device, so that any diversion client with a built-in kernel-state diversion strategy is not started in the electronic device. Afterwards, the situation of "the second diversion client diverting traffic in the kernel state based on the kernel-state diversion strategy" will not occur.

[0171] In this way, there will be no situation where the second diversion client will affect "the first diversion client's traffic diversion in the kernel state". In this way, after setting the diversion strategy of the first diversion client to the kernel state diversion strategy, the first diversion client can divert traffic based on the kernel state diversion strategy, and will not be affected by the second diversion client, causing the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, and will not cause service abnormalities involving the first diversion client.

[0172] In this way, after the second traffic diversion client is closed in the electronic device, step S503 can be executed.

[0173] When the second traffic diversion client is not started in the electronic device, in step S503, the traffic diversion strategy of the first traffic diversion client is set to the kernel state traffic diversion strategy, so that the first traffic diversion client diverts traffic based on the kernel state traffic diversion strategy.

[0174] It should be noted that the specific diversion method of the first diversion client for diverting traffic based on the kernel-state diversion strategy can refer to the currently existing diversion method, which will not be described in detail in this disclosure.

[0175] In the present disclosure, it is detected whether the second diversion client has been started in the electronic device, and the second diversion client has a built-in kernel-state diversion strategy. If the second diversion client has been started in the electronic device, the second diversion client is closed in the electronic device, and the diversion strategy of the first diversion client is set to the kernel-state diversion strategy, so that the first diversion client diverts traffic based on the kernel-state diversion strategy.

[0176] Through the present disclosure, after the second diversion client is closed in the electronic device, the second diversion client no longer runs in the electronic device, so that any diversion client with a built-in kernel-state diversion strategy is not started in the electronic device, and thereafter, the situation of "the second diversion client diverting traffic in the kernel state based on the kernel-state diversion strategy" will not occur.

[0177] In this way, there will be no situation where the second diversion client will affect "the first diversion client's diversion of traffic in the kernel state". In this way, after setting the diversion strategy of the first diversion client to the kernel state diversion strategy, the first diversion client can divert traffic based on the kernel state diversion strategy, and will not be affected by the second diversion client, causing the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, so that the traffic can be diverted by the first diversion client in the diversion method expected by the first diversion client, for example, the traffic "expected to be diverted by the first diversion client" can be diverted by the first diversion client in the kernel state (for example, redirected in the kernel state), and will not cause service abnormalities involving the first diversion client.

[0178] In the present disclosure, when the second traffic diversion client has been started in the electronic device, if the second traffic diversion client is directly closed in the electronic device, it may make the user feel very abrupt, and the user is not clear about the reason for closing the second traffic diversion client in the electronic device. For example, the user may not know that the electronic device is closing the second traffic diversion client in the electronic device for the first traffic diversion client (in order to ensure that the traffic diversion strategy of the first diversion client based on the kernel state will not be affected by the second diversion client). The user may mistakenly believe that the electronic device has a fault or the second diversion client has a fault, which may reduce the user experience.

[0179] Furthermore, the user may manually control the electronic device to restart the second diversion client, and then the second diversion client may affect the "first diversion client's traffic diversion in the kernel state", which may cause the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, and may further cause service abnormalities involving the first diversion client.

[0180] Afterwards, in order to avoid service anomalies involving the first drainage client, the electronic device will close the second drainage client, and then the user manually controls the electronic device to restart the second drainage client, and the cycle repeats, continuously reducing the user experience.

[0181] Therefore, in order to avoid continuously degrading the user experience, in another embodiment of the present disclosure, when the second traffic diversion client has been started in the electronic device, a shutdown prompt message can be displayed. The shutdown prompt message is used to prompt whether to close the second traffic diversion client in the electronic device for the first traffic diversion client. "For the first traffic diversion client" can be understood as: the traffic diversion based on the kernel state diversion strategy for the first diversion client is not affected by the second diversion client, etc.

[0182] The user can see the displayed closing prompt information. If the user decides to close the second drainage client in the electronic device, the user can enter a confirmation operation for the closing prompt information. Alternatively, if the user decides not to close the second drainage client in the electronic device, the user can enter a cancel operation for the closing prompt information.

[0183] When the electronic device receives a confirmation operation for closing the prompt information, step S502 is executed again: closing the second traffic diversion client in the electronic device.

[0184] Alternatively, when the electronic device receives a cancel operation to close the prompt information, step S502 is not executed. For example, the second drainage client is not closed in the electronic device, and the second drainage client continues to run in the electronic device (that is, the second drainage client continues to be in an activated state in the electronic device).

[0185] Through the present disclosure, whether to close the second traffic diversion client in the electronic device is left to the user to decide, so that the user is informed and the user experience is avoided from being continuously degraded.

[0186] In another embodiment of the present disclosure, after setting the diversion strategy of the first diversion client to the kernel state diversion strategy, during the user's use of the electronic device, the electronic device may sometimes receive a startup request for starting the second diversion client in the electronic device. For example, the user may trigger the icon of the second diversion client to submit a startup request to the electronic device to start the second diversion client in the electronic device, or, during the user's use of certain functions of other clients in the electronic device, the event of starting the second diversion client is automatically triggered, thereby automatically submitting a startup request to the electronic device to start the second diversion client in the electronic device, etc.

[0187] However, after the electronic device starts the second traffic diversion client, the second traffic diversion client will affect the "traffic diversion by the first traffic diversion client in the kernel state", which may cause the first traffic diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, and may further cause service abnormalities involving the first diversion client.

[0188] In this way, in order to avoid service anomalies involving the first drainage client, in one embodiment of the present disclosure, when a startup request for starting the second drainage client in an electronic device is received, the action of "starting the second drainage client in the electronic device according to the startup request" can be intercepted so that the electronic device does not process the startup request, that is, the second drainage client is not started in the electronic device according to the startup request, so that the second drainage client is not started in the electronic device.

[0189] In the present disclosure, when a startup request for starting a second traffic diversion client in an electronic device is received, if the action of "starting the second traffic diversion client in the electronic device according to the startup request" is directly intercepted and the second traffic diversion client is not started in the electronic device, it may make the user feel very abrupt, and the user is not clear about the reason why the electronic device does not start the second traffic diversion client. For example, the user may not know that the electronic device is targeting the first traffic diversion client and does not start the second traffic diversion client in the electronic device (in order to ensure that the traffic diversion strategy of the first diversion client based on the kernel state will not be affected by the second diversion client). The user may mistakenly believe that there is a fault in the electronic device or the second diversion client, which may reduce the user experience.

[0190] Furthermore, the user may manually control the electronic device to restart the second diversion client, and then the second diversion client may affect the "first diversion client's traffic diversion in the kernel state", which may cause the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, and may further cause service abnormalities involving the first diversion client.

[0191] Afterwards, in order to avoid service abnormalities involving the first drainage client, the electronic device will intercept the action of "starting the second drainage client in the electronic device according to the startup request". Then the user manually controls the electronic device to start the second drainage client again, and the cycle repeats, continuously reducing the user experience.

[0192] Therefore, in order to avoid continuously degrading the user experience, in another embodiment of the present disclosure, when a startup request for starting a second traffic diversion client in an electronic device is received, a cancellation prompt message is displayed, and the cancellation prompt message is used to prompt whether to cancel the startup of the second traffic diversion client in the electronic device for the first traffic diversion client; "for the first traffic diversion client" can be understood as: the traffic diversion based on the kernel state diversion strategy for the first diversion client is not affected by the second diversion client, etc.

[0193] The user can see the displayed cancellation prompt information. If the user decides to cancel the launch of the second drainage client in the electronic device, the user can enter a confirmation operation for the cancellation prompt information. Alternatively, if the user decides that the second drainage client needs to be launched in the electronic device, the user can enter a cancellation operation for the cancellation prompt information.

[0194] When the electronic device receives a confirmation operation for canceling the prompt information, the action of "starting the second traffic diversion client in the electronic device according to the start request" is intercepted.

[0195] Alternatively, when the electronic device receives a cancel operation to cancel the prompt information, it may not intercept the action of "starting the second drainage client in the electronic device according to the startup request", but execute the action of "starting the second drainage client in the electronic device according to the startup request" to start the second drainage client in the electronic device.

[0196] Through the present disclosure, whether to cancel starting the second traffic diversion client in the electronic device is left to the user to decide, so that the user is informed and the user experience is avoided from being continuously degraded.

[0197] It should be noted that for the method embodiments, for simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present disclosure.

[0198] Referring to Figure 6, a structural block diagram of a traffic management device disclosed in the present invention is shown, which is applied to an electronic device; a first traffic diversion client has been started in the electronic device; the first traffic diversion client has built-in kernel-state traffic diversion strategy and user-state traffic diversion strategy; the device includes: a first detection module 11, used to detect whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has built-in kernel-state traffic diversion strategy; a first setting module 12, used to set the diversion strategy of the first traffic diversion client to the user-state diversion strategy when the second traffic diversion client has been started in the electronic device, so that the first traffic diversion client diverts traffic based on the user-state diversion strategy.

[0199] In an optional implementation, the first detection module includes: a first acquisition unit, used to obtain identification information of a client that has been started in the electronic device, and to obtain a first client list set in the first diversion client, wherein the first client list includes: identification information of a diversion client with a built-in kernel-state diversion strategy; a first determination unit, used to determine that a second diversion client has been started in the electronic device when the identification information of at least one client that has been started in the electronic device is located in the first client list; or, a second determination unit, used to determine that the second diversion client has not been started in the electronic device when the identification information of each client that has been started in the electronic device is not located in the first client list.

[0200] In an optional implementation, the first detection module also includes: a first receiving unit, used to receive update information pushed by the cloud corresponding to the first drainage client to the first drainage client, the update information carries the identification information of the drainage client to be updated, and the drainage client to be updated has a built-in kernel-state drainage strategy; a first update unit, used to update the first client list according to the identification information of the drainage client to be updated in the update information.

[0201] In an optional implementation, the first detection module is specifically used to: when receiving an activation operation for activating the drainage function of the first drainage client, detect whether the second drainage client has been started in the electronic device; or, the first detection module is specifically used to: when a new client is activated in the electronic device, detect whether the second drainage client has been started in the electronic device; or, the first detection module is specifically used to: when an activated client is closed in the electronic device, detect whether the second drainage client has been started in the electronic device.

[0202] In an optional implementation, the device also includes: a second setting module, which is used to set the diversion strategy of the first diversion client to a kernel-state diversion strategy when the second diversion client is not started in the electronic device, so that the first diversion client diverts traffic based on the kernel-state diversion strategy.

[0203] In an optional implementation, the device also includes: a switching module, which is used to switch the diversion strategy of the first diversion client from the user-state diversion strategy to the kernel-state diversion strategy when the second diversion client is closed in the electronic device after setting the diversion strategy of the first diversion client to the user-state diversion strategy, so that the first diversion client diverts traffic based on the kernel-state diversion strategy.

[0204] In an optional implementation, the device also includes: a second detection module, which is used to detect whether a third traffic diversion client has been started in the electronic device when the second traffic diversion client has been started in the electronic device, and the third traffic diversion client has a built-in user-state traffic diversion strategy; the first setting module is also used to: when the third traffic diversion client is not started in the electronic device, set the diversion strategy of the first traffic diversion client to the user-state traffic diversion strategy; or, a first closing module, which is used to close the third traffic diversion client in the electronic device when the third traffic diversion client has been started in the electronic device, and the first setting module is also used to: set the diversion strategy of the first traffic diversion client to the user-state traffic diversion strategy.

[0205] In an optional implementation, the device also includes: a first display module, used to display a closing prompt message when the third drainage client has been started in the electronic device, and the closing prompt message is used to prompt whether to close the third drainage client in the electronic device for the first drainage client; the first closing module is also used to: when a confirmation operation for the closing prompt message is received, close the third drainage client in the electronic device.

[0206] In an optional implementation, the second detection module includes: a second acquisition unit, used to obtain the identification information of the client that has been started in the electronic device, and to obtain a second client list set in the first diversion client, the second client list including: identification information of a diversion client with a built-in user-mode diversion strategy; a third determination unit, used to determine that a third diversion client has been started in the electronic device when the identification information of at least one client that has been started in the electronic device is located in the second client list; a fourth determination unit, used to determine that the third diversion client has not been started in the electronic device, or when the identification information of each client that has been started in the electronic device is not located in the second client list.

[0207] In an optional implementation, the second detection module also includes: a second receiving unit, used to receive update information pushed by the cloud corresponding to the first drainage client to the first drainage client, the update information carries the identification information of the drainage client to be updated, and the drainage client to be updated has a built-in user-state drainage strategy; a second update unit, used to update the second client list according to the identification information of the drainage client to be updated in the update information.

[0208] In the present disclosure, it is detected whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has a built-in kernel-state traffic diversion strategy. When the second traffic diversion client has been started in the electronic device, the traffic diversion strategy of the first traffic diversion client is set to the user-state traffic diversion strategy, so that the first traffic diversion client diverts traffic based on the user-state traffic diversion strategy.

[0209] When the second traffic diversion client has been started in the electronic device, the second traffic diversion client will intercept the traffic in the kernel state and process the traffic (for example, add content or divert traffic, etc.). In addition, if the priority of the second traffic diversion client for processing the traffic in the kernel state is higher than the priority of the first traffic diversion client for processing the traffic in the kernel state, the first traffic diversion client will be affected by the second traffic diversion client in the scenario of diverting traffic to the terminal. For example, after the second traffic diversion client processes a certain traffic in the kernel state, in order to avoid the traffic entering an infinite loop in the kernel state, the first traffic diversion client will no longer divert the traffic in the kernel state.

[0210] However, after the second diversion client processes a certain traffic in the kernel state, the second diversion client will transfer the certain traffic to the user state. After the traffic is transferred to the user state, the user state diversion client diverts the traffic in the user state and will not cause the traffic to enter an infinite loop in the user state, and the user state diversion client diverts the traffic in the user state will not be affected by the second diversion client. In this way, the user state diversion client can often still continue to divert the traffic in the user state.

[0211] In addition, in a scenario where the second traffic diversion client has a higher priority for processing traffic in the kernel state than the first traffic diversion client, if the second traffic diversion client intercepts and processes the traffic in the kernel state, sometimes it is not processing the traffic with respect to diversion, but rather processing the traffic with respect to adding content. For example, the second traffic diversion client is not interested in the traffic and detects that the traffic is not traffic that needs to be diverted by the second traffic diversion client. However, after the second traffic diversion client intercepts the traffic in the kernel state, it may sometimes process the traffic with respect to adding content, for example, adding some information / parameters to the traffic (some information / parameters may be content used to indicate the identity of the second traffic diversion client, or content used to indicate that the traffic has been intercepted by the second traffic diversion client). After the second traffic diversion client performs simple processing on the traffic, it does not affect the subsequent first traffic diversion client in the user state to divert the traffic in the manner expected by the first traffic diversion client. That is, the first traffic diversion client can divert the traffic in the user state in the manner expected by the first traffic diversion client.

[0212] In this way, the first diversion client can try to divert the traffic in user mode. That is, even if the traffic cannot be diverted by the first diversion client in kernel mode due to the influence of the second diversion client with higher priority, the chance of the first diversion client diverting the traffic in user mode can be increased, so as to increase the chance that the traffic can be diverted by the first diversion client, thereby increasing the possibility that the traffic can be diverted by the first diversion client in the diversion method expected by the first diversion client, so as to avoid service anomalies involving the first diversion client as much as possible, and improve the compatibility between the first diversion client and the second diversion client.

[0213] Referring to Figure 7, a structural block diagram of a traffic management device disclosed in the present invention is shown, which is applied to an electronic device; a first traffic diversion client has been started in the electronic device; the first traffic diversion client has built-in kernel-state traffic diversion strategy and user-state traffic diversion strategy; the device includes: a third detection module 21, used to detect whether a second traffic diversion client has been started in the electronic device, and the second traffic diversion client has built-in kernel-state traffic diversion strategy; a second closing module 22, used to close the second traffic diversion client in the electronic device when the second traffic diversion client has been started in the electronic device; a third setting module 23, used to set the diversion strategy of the first traffic diversion client to the kernel-state diversion strategy, so that the first traffic diversion client diverts traffic based on the kernel-state diversion strategy.

[0214] In an optional implementation, the device also includes: a second display module, which is used to display a closing prompt message when the second drainage client has been started in the electronic device, and the closing prompt message is used to prompt whether to close the second drainage client in the electronic device for the first drainage client; the second closing module is also used to: close the second drainage client in the electronic device when a confirmation operation for the closing prompt message is received.

[0215] In an optional implementation, the device also includes: an interception module for intercepting the action of "starting the second drainage client in the electronic device according to the startup request" when receiving a startup request for starting the second drainage client in the electronic device after setting the drainage strategy of the first drainage client to the kernel state drainage strategy.

[0216] In an optional implementation, the device also includes: a third display module, which is used to display a cancellation prompt message when receiving a startup request for starting the second drainage client in the electronic device, and the cancellation prompt message is used to prompt whether to cancel the startup of the second drainage client in the electronic device for the first drainage client; the interception module is also used to: when receiving a confirmation operation for the cancellation prompt message, intercept the action of "starting the second drainage client in the electronic device according to the startup request".

[0217] In the present disclosure, it is detected whether the second diversion client has been started in the electronic device, and the second diversion client has a built-in kernel-state diversion strategy. If the second diversion client has been started in the electronic device, the second diversion client is closed in the electronic device, and the diversion strategy of the first diversion client is set to the kernel-state diversion strategy, so that the first diversion client diverts traffic based on the kernel-state diversion strategy.

[0218] Through the present disclosure, after the second diversion client is closed in the electronic device, the second diversion client no longer runs in the electronic device, so that any diversion client with a built-in kernel-state diversion strategy is not started in the electronic device, and thereafter, the situation of "the second diversion client diverting traffic in the kernel state based on the kernel-state diversion strategy" will not occur.

[0219] In this way, there will be no situation where the second diversion client will affect "the first diversion client's diversion of traffic in the kernel state". In this way, after setting the diversion strategy of the first diversion client to the kernel state diversion strategy, the first diversion client can divert traffic based on the kernel state diversion strategy, and will not be affected by the second diversion client, causing the first diversion client to be unable to divert the traffic it needs to divert in the diversion method expected by the first diversion client, so that the traffic can be diverted by the first diversion client in the diversion method expected by the first diversion client. For example, the traffic "expected to be diverted by the first diversion client" can be diverted by the first diversion client in the user state (for example, redirected in the user state), which will not cause service abnormalities involving the first diversion client, and can improve the compatibility between the first diversion client and the second diversion client.

[0220] The embodiments of the present disclosure further provide a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiments of the present disclosure.

[0221] The present disclosure provides one or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause an electronic device to perform one or more of the methods described in the above embodiments. In the present disclosure, the electronic device includes a server, a gateway, a sub-device, and the like, wherein the sub-device is an IoT device or other device.

[0222] The embodiments of the present disclosure may be implemented as an apparatus configured as desired using any appropriate hardware, firmware, software, or any combination thereof, which may include a server (cluster), terminal devices such as IoT devices, and other electronic devices.

[0223] FIG8 schematically illustrates an exemplary apparatus 1300 that may be used to implement various embodiments of the present disclosure.

[0224] For one embodiment, Figure 8 shows an exemplary apparatus 1300 having one or more processors 1302, a control module (chip set) 1304 coupled to at least one of the processor(s) 1302, a memory 1306 coupled to the control module 1304, a non-volatile memory (NVM) / storage device 1308 coupled to the control module 1304, one or more input / output devices 1310 coupled to the control module 1304, and a network interface 1312 coupled to the control module 1304.

[0225] Processor 1302 may include one or more single-core or multi-core processors, and may include any combination of general-purpose processors or specialized processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, apparatus 1300 may serve as a server device such as a gateway in the embodiments of the present disclosure.

[0226] In some embodiments, the apparatus 1300 may include one or more computer-readable media (e.g., memory 1306 or NVM / storage 1308) having instructions 1314 and one or more processors 1302 configured in conjunction with the one or more computer-readable media to execute the instructions 1314 to implement a module to perform the actions of the present disclosure.

[0227] For one embodiment, the control module 1304 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1302 and / or any suitable device or component in communication with the control module 1304 .

[0228] The control module 1304 may include a memory controller module to provide an interface to the memory 1306. The memory controller module may be a hardware module, a software module, and / or a firmware module.

[0229] The memory 1306 can be used, for example, to load and store data and / or instructions 1314 for the device 1300. For one embodiment, the memory 1306 can include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 1306 can include double data rate quad synchronous dynamic random access memory (DDR4 SDRAM).

[0230] For one embodiment, control module 1304 may include one or more input / output controllers to provide interfaces to NVM / storage device 1308 and input / output device(s) 1310 .

[0231] For example, NVM / storage 1308 may be used to store data and / or instructions 1314. NVM / storage 1308 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).

[0232] NVM / storage device 1308 may include storage resources that are physically part of the device on which apparatus 1300 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 1308 may be accessible over a network via input / output device(s) 1310.

[0233] (One or more) input / output devices 1310 may provide an interface for apparatus 1300 to communicate with any other appropriate device. Input / output devices 1310 may include a communication component, a phonetic component, a sensor component, etc. Network interface 1312 may provide an interface for apparatus 1300 to communicate via one or more networks. Apparatus 1300 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.

[0234] For one embodiment, at least one of the processor(s) 1302 may be packaged together with the logic of one or more controllers of the control module 1304 (e.g., a memory controller module). For one embodiment, at least one of the processor(s) 1302 may be packaged together with the logic of one or more controllers of the control module 1304 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with the logic of one or more controllers of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with the logic of one or more controllers of the control module 1304 to form a system-on-chip (SoC).

[0235] In various embodiments, the apparatus 1300 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the apparatus 1300 may have more or fewer components and / or a different architecture. For example, in some embodiments, the apparatus 1300 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touchscreen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.

[0236] An embodiment of the present disclosure provides an electronic device, comprising: one or more processors; and one or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, enable the electronic device to perform one or more methods as disclosed herein.

[0237] An embodiment of the present disclosure provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes one or more methods of the present disclosure.

[0238] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0239] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0240] The embodiments of the present disclosure are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the processes and / or boxes in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable information processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable information processing terminal device generate a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0241] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable information processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0242] These computer program instructions can also be loaded onto a computer or other programmable information processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0243] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present disclosure.

[0244] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

[0245] The traffic management method and device provided by the present disclosure are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method and core ideas of the present disclosure. At the same time, for those skilled in the art, according to the ideas of the present disclosure, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present disclosure.

Claims

1. A traffic management method, applied to an electronic device; The first drainage client has been started in the electronic device; The first drainage client is built with a drainage policy in the kernel mode and a drainage policy in the user mode; The method includes: Detect whether a second drainage client has been started in the electronic device, where the second drainage client is built with the drainage policy in the kernel mode; When the second drainage client has been started in the electronic device, set the drainage policy of the first drainage client to the drainage policy in the user mode, so that the first drainage client drains traffic based on the drainage policy in the user mode.

2. The method according to claim 1, where the detecting whether a second drainage client has been started in the electronic device includes: Obtain the identification information of the clients that have been started in the electronic device, and obtain a first client list set in the first drainage client, where the first client list includes: the identification information of the drainage clients built with the drainage policy in the kernel mode; When the identification information of at least one client that has been started in the electronic device is in the first client list, determine that the second drainage client has been started in the electronic device; Or, when the identification information of each client that has been started in the electronic device is not in the first client list, determine that the second drainage client has not been started in the electronic device.

3. The method according to claim 2, the method further includes: Receive update information pushed by the cloud corresponding to the first drainage client to the first drainage client, where the update information carries the identification information of the drainage client to be updated, and the drainage client to be updated is built with the drainage policy in the kernel mode; Update the first client list according to the identification information of the drainage client to be updated in the update information.

4. The method according to any one of claims 1 to 3, the method further includes: When receiving an opening operation for opening the drainage function of the first drainage client, detect again whether a second drainage client has been started in the electronic device; Or, when a new client is started in the electronic device, detect again whether a second drainage client has been started in the electronic device; Or, when a started client is closed in the electronic device, detect again whether a second drainage client has been started in the electronic device.

5. The method according to any one of claims 1 to 3, the method further includes: When the second drainage client has not been started in the electronic device, set the drainage policy of the first drainage client to the drainage policy in the kernel mode, so that the first drainage client drains traffic based on the drainage policy in the kernel mode.

6. The method according to any one of claims 1 to 3, the method further includes: After setting the drainage policy of the first drainage client to the user-mode drainage policy, when the second drainage client is closed in the electronic device, switch the drainage policy of the first drainage client from the user-mode drainage policy to the kernel-mode drainage policy, so that the first drainage client drains traffic based on the kernel-mode drainage policy.

7. The method according to any one of claims 1 to 3, the method further comprising: When the second drainage client is started in the electronic device, detect whether a third drainage client has been started in the electronic device, and the third drainage client is built-in with the user-mode drainage policy; When the third drainage client has not been started in the electronic device, set the drainage policy of the first drainage client to the user-mode drainage policy again; Or, When the third drainage client has been started in the electronic device, close the third drainage client in the electronic device, and then set the drainage policy of the first drainage client to the user-mode drainage policy.

8. The method according to claim 7, wherein detecting whether a third drainage client has been started in the electronic device comprises: Obtain the identification information of the clients that have been started in the electronic device, and obtain a second client list set in the first drainage client, where the second client list includes: the identification information of the drainage clients built-in with the user-mode drainage policy; When the identification information of at least one client that has been started in the electronic device is in the second client list, determine that the third drainage client has been started in the electronic device; Or, when the identification information of each client that has been started in the electronic device is not in the second client list, determine that the third drainage client has not been started in the electronic device.

9. A traffic management method, applied to an electronic device; a first drainage client has been started in the electronic device; The first drainage client is built-in with a kernel-mode drainage policy and a user-mode drainage policy; The method comprises: Detect whether a second drainage client has been started in the electronic device, and the second drainage client is built-in with the kernel-mode drainage policy; When the second drainage client has been started in the electronic device, close the second drainage client in the electronic device; Set the drainage policy of the first drainage client to the kernel-mode drainage policy, so that the first drainage client drains traffic based on the kernel-mode drainage policy.

10. The method according to claim 9, the method further comprising: After setting the drainage policy of the first drainage client to the kernel-mode drainage policy, when a start request for starting the second drainage client in the electronic device is received, intercept the action of "starting the second drainage client in the electronic device according to the start request".

11. A traffic management device, applied to an electronic device; A first drainage client has been started in the electronic device; The first drainage client is built-in with a kernel-mode drainage policy and a user-mode drainage policy; The device comprises: A first detection module, configured to detect whether a second traffic diversion client has been started in the electronic device, where the second traffic diversion client is built with the traffic diversion policy in the kernel mode; A first setting module, configured to, when the second traffic diversion client has been started in the electronic device, set the traffic diversion policy of the first traffic diversion client to the traffic diversion policy in the user mode, so that the first traffic diversion client diverts traffic based on the traffic diversion policy in the user mode.

12. A traffic management device, applied to an electronic device; The first traffic diversion client has been started in the electronic device; The first traffic diversion client is built with a traffic diversion policy in the kernel mode and a traffic diversion policy in the user mode; The device includes: A third detection module, configured to detect whether a second traffic diversion client has been started in the electronic device, where the second traffic diversion client is built with the traffic diversion policy in the kernel mode; A second closing module, configured to, when the second traffic diversion client has been started in the electronic device, close the second traffic diversion client in the electronic device; A third setting module, configured to set the traffic diversion policy of the first traffic diversion client to the traffic diversion policy in the kernel mode, so that the first traffic diversion client diverts traffic based on the traffic diversion policy in the kernel mode.

13. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, the method according to any one of claims 1 to 10 is implemented.

14. A computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

15. A computer program product, when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Kernel-mode data access method, device and system

    CN103544324A

  • Session traffic statistical method, processor core, storage medium, and electronic device

    CN108521351A

  • System, method and computer program product for interception of user mode code execution and redirection to kernel mode

    US8572729B1