Traffic guiding method, device and electronic equipment
By intercepting and replacing the network connection function of the application in the terminal device, the method of guiding the application's traffic data to the second server is realized, solving the problems of complex traffic guidance and privacy leakage in the prior art, and achieving a simpler and safer traffic data guidance effect.
Patent Information
- Application Number
- CN202010744398.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-29
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2040-07-29
AI Technical Summary
The existing traffic guidance methods are complex and have the risk of privacy leakage, making it difficult to conveniently and securely guide the application's traffic data.
By intercepting the first network connection function in the terminal device using the second network connection function, and when the communication address of the first server meets the preset traffic boot condition, the communication address is replaced to establish a network connection with the second server, thereby guiding the traffic data of the application to the second server.
It realizes that the application's traffic data is convenient and securely directed without integrating VPN interfaces or other interfaces in the application, reducing operational complexity and privacy risks.
Smart Images

Figure CN114095185B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to a traffic guiding method, device and electronic device. The present application also relates to a data access method. Background Art
[0002] With the continuous development of computer technology, when a terminal device sends the traffic data of an application to a server, due to the limitation of the network bandwidth of the server or based on security considerations, a traffic guidance method can be used to guide the traffic data to other servers first, so that other servers can schedule or perform security authentication on the traffic data, so as to reduce the server bandwidth pressure or improve the security of data access.
[0003] At present, the commonly used traffic steering method is generally based on a virtual private network (VPN), that is, when an application sends traffic data to a server, a VPN interface corresponding to the server is pre-integrated in the application, and the traffic data is sent to the server through the VPN interface.
[0004] The existing traffic guiding methods have the following problems: 1. Complex access, that is, for applications in different operating systems, it is necessary to integrate the VPN interface corresponding to each operating system and other corresponding interfaces to guide the traffic data of the application; 2. Complex use, that is, when guiding traffic based on VPN, it is necessary to configure corresponding routing strategies, domain name service (DNS) strategies, and Internet Protocol (IP) forwarding strategies according to the different networks where the application is located and the server is located; 3. Privacy leakage risk, that is, the existing traffic guiding method will guide the global traffic data of the application to the VPN server, which has the risk of leaking user privacy information. Therefore, it is necessary to provide a traffic guiding method to conveniently and safely guide the traffic data of the application. Summary of the invention
[0005] One purpose of the embodiments of the present disclosure is to provide a new technical solution for traffic steering.
[0006] According to a first aspect of the present disclosure, a traffic guiding method is provided, which is applied to a terminal device having an application installed thereon, and the method comprises:
[0007] When the application establishes a network connection with the first server through a first network connection function, intercepting the first network connection function using a second network connection function, wherein a parameter of the first network connection function includes a first communication address of the first server;
[0008] When the first communication address meets the preset traffic guidance condition, the first communication address is replaced with the second communication address of the second server through the second network connection function;
[0009] A network connection is established with the second server via the second communication address to direct the traffic data of the application to the second server.
[0010] Optionally, the using the second network connection function to intercept the first network connection function includes:
[0011] Obtaining a first execution address of the first network connection function, wherein the first execution address is an address of the first network connection function in a file, and the file includes an executable file corresponding to the application;
[0012] Obtaining a second execution address of the second network connection function;
[0013] The first execution address is replaced with the second execution address through the second network connection function.
[0014] Optionally, the file is an executable and linkable format file corresponding to the application, the first execution address is a function address of the first network connection function in a global offset table of the executable and linkable format file, and the second execution address is a function address of the second network connection function in a global offset table of the executable and linkable format file.
[0015] Optionally, the method further comprises:
[0016] Acquire a communication address set configured by a user, wherein the communication addresses in the communication address set are communication addresses of servers that need to perform traffic guidance processing;
[0017] In a case where the first communication address is included in the communication address set, it is determined that the first communication address satisfies the preset traffic guiding condition.
[0018] Optionally, directing the traffic data of the application to the second server includes:
[0019] When the network connection between the application and the second server is successfully established, the application sends a data access request to the second server through the network connection; and the application receives a data response message provided by the second server corresponding to the data access request.
[0020] Optionally, the second server is a local proxy server, wherein the local proxy server is used to send the data access request sent by the application to the first server, and receive a data response message returned by the first server and corresponding to the data access request.
[0021] Optionally, the local proxy server is obtained by:
[0022] Acquire a communication address set configured by a user, wherein the communication addresses in the communication address set are communication addresses of servers that need to perform traffic guidance processing;
[0023] The local proxy server is determined according to the communication address set.
[0024] According to a second aspect of the present disclosure, a data access method is also provided, which is applied to a terminal device, comprising:
[0025] Sending a request message for establishing a network connection to a target server, wherein the communication address of the target server meets a preset traffic guidance condition;
[0026] In the case where the network connection is successfully established, sending a data access request for the target server to a local proxy server, wherein the local proxy server corresponds to the target server;
[0027] Receive a data response message returned by the local proxy server and corresponding to the data access request.
[0028] According to a third aspect of the present disclosure, another traffic guiding method is also provided, which is applied to a terminal device having an application installed thereon, and includes:
[0029] When the application establishes a network connection with the first server, intercepting the network connection;
[0030] When the first communication address of the first server corresponding to the network connection meets a preset traffic guidance condition, replacing the first communication address with a second communication address of the second server;
[0031] A network connection is established with the second server via the second communication address to direct the traffic data of the application to the second server.
[0032] According to a fourth aspect of the present disclosure, the present disclosure further provides a traffic guiding device, which is applied to a terminal device installed with an application program, comprising:
[0033] an interception module, configured to intercept the first network connection function using a second network connection function when the application establishes a network connection with the first server through the first network connection function, wherein a parameter of the first network connection function includes a first communication address of the first server;
[0034] An address replacement module, configured to replace the first communication address with a second communication address of a second server through the second network connection function when the first communication address meets a preset traffic guidance condition;
[0035] A network connection establishing module is used to establish a network connection with the second server through the second communication address to guide the traffic data of the application to the second server.
[0036] According to a fifth aspect of the present disclosure, a terminal device is further provided, comprising the apparatus according to the fourth aspect of the present disclosure; or,
[0037] The terminal device includes a memory and a processor, the memory is used to store a computer program, and the processor is used to control the terminal device to execute the method according to the first aspect, the second aspect or the third aspect of the present disclosure under the control of the computer program.
[0038] According to the sixth aspect of the present disclosure, a computer-readable storage medium is also provided, wherein the computer-readable storage medium stores a computer program that can be read and executed by a computer, and the computer program is used to execute the method according to the first aspect, the second aspect or the third aspect of the present disclosure when read and executed by the computer.
[0039] One beneficial effect of the present disclosure is that, according to an embodiment of the present disclosure, when guiding the traffic data of an application, it is not necessary to integrate a VPN interface or other interface in the application. Instead, when the application establishes a network connection with the first server through the first network connection function, the first network connection function is intercepted by the second network connection function, and when the first communication address of the first server meets the preset traffic guidance condition, the first communication address is replaced with the second communication address of the second server through the second network connection function, and then the second communication address is used to establish a network connection with the second server to guide the traffic data of the application to the second server. According to an embodiment of the present disclosure, when a terminal device with an application installed performs traffic guidance processing on the application, it is not necessary to provide corresponding integrated interfaces for applications in different operating systems, nor is it necessary to configure various forwarding strategies for the traffic data of the application. At the same time, the traffic data of the application can be processed in a targeted manner according to the preset traffic guidance conditions, so as to conveniently and safely guide the traffic data of the application.
[0040] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0042] Figure 1 It is a schematic diagram of an application scenario illustrating the effects of an embodiment of the present disclosure.
[0043] Figure 2 It is a hardware configuration structure diagram of an optional traffic steering system that can be used to implement the traffic steering method of the embodiment of the present disclosure.
[0044] Figure 3 It is a flow chart of the traffic directing method according to an embodiment of the present disclosure.
[0045] Figure 4 It is a processing diagram of the traffic steering method according to an embodiment of the present disclosure.
[0046] Figure 5 It is a flowchart of a data access method according to an embodiment of the present disclosure.
[0047] Figure 6 It is a flowchart of another traffic directing method according to an embodiment of the present disclosure.
[0048] Figure 7 is a schematic diagram of a flow directing device according to an embodiment of the present disclosure.
[0049] Figure 8a It is a schematic principle block diagram of a terminal device according to an embodiment of the present disclosure.
[0050] Figure 8b is a schematic principle block diagram of an electronic device according to another embodiment of the present disclosure. DETAILED DESCRIPTION
[0051] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0052] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0053] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0054] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0055] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0056] With the continuous development of computer technology, the number of online users of applications at the same time is also gradually increasing. However, there is an upper limit to the total bandwidth of the server corresponding to the application within a preset time length, or the server's processing capacity for data access requests sent by the application. In particular, in practice, the server corresponding to the application may also be subject to attacks such as distributed denial of service attacks (DDoS). Therefore, in order to reduce the pressure on the server and perform security authentication on the traffic data received by the server, the traffic data of the application can be first directed to other servers, so that other servers can schedule or perform security authentication on the traffic data, so as to achieve the effect of reducing the pressure on the server bandwidth or improving the security of data access.
[0057] Please see Figure 1 , which is a schematic diagram of an application scenario illustrating the effects of the embodiments of the present disclosure. Figure 1As shown, in order to address the problem that existing traffic steering methods cannot conveniently and safely guide the traffic data of applications, the traffic steering method provided in the embodiments of the present disclosure uses a second network connection function to intercept the first network connection function when the application in the terminal device 1200 establishes a network connection with the first server, i.e., server 1100a, through a first network connection function, and replaces the first communication address with the second server, i.e., the second communication address of server 1100b, through the second network connection function when the first communication address of server 1100a meets the preset traffic steering conditions, and establishes a network connection with server 1100b through the second communication address, and guides the traffic data of the application in the terminal device 1200 to server 1100b through the network connection.
[0058] like Figure 1 As shown, after the network connection is successfully established, the traffic data sent by the application in the terminal device 1200, such as a data access request, can be first directed to the server 1100b. The server 1100b can schedule the traffic data of the application and perform security authentication, and then forward the traffic data to the server 1100a, receive the data response message returned by the server 1100a, and return the data response message to the terminal device 1200, so as to reduce the bandwidth pressure of the server 1100a and improve the security of data access.
[0059] according to Figure 1 It can be seen from the content that the method provided in this embodiment does not need to provide the application with an integrated interface corresponding to each operating system according to the difference in the operating system running on the terminal device 1200. It only needs to use the second network connection function to intercept the first network connection function, and when the first communication address of the first server, that is, server 1100a, meets the preset traffic guidance conditions, by establishing a network connection between the second communication address and the second server, that is, server 1100b, the traffic data of the application can be conveniently and safely guided to server 1100b.
[0060] <Hardware Configuration>
[0061] Figure 2 It is a hardware configuration structure diagram of an optional traffic steering system 100 that can be used to implement the traffic steering method of the embodiment of the present disclosure.
[0062] like Figure 2 As shown, the traffic guidance system 100 of this embodiment includes a server 1100a, a server 1100b, a terminal device 1200 and a network 1300.
[0063] The server 1100a and the server 1100b may be, for example, blade servers, rack servers, etc. The server 1100a and the server 1100b may also be server clusters deployed in the cloud, which is not limited here.
[0064] It should be noted that, since the server 1100a and the server 1100b can be servers with the same hardware configuration, in the embodiment of the present disclosure, the server 1100a is taken as an example to illustrate its hardware configuration, and the hardware configuration of the server 1100b is not repeated.
[0065] like Figure 2 As shown, the server 1100a may include a processor 1110, a memory 1120, an interface device 1130, a communication device 1140, a display device 1150, and an input device 1160. The processor 1110 may be, for example, a central processing unit CPU, etc. The memory 1120 may include, for example, a ROM (read-only memory), a RAM (random access memory), a non-volatile memory such as a hard disk, etc. The interface device 1130 may include, for example, a USB interface, a serial interface, etc. The communication device 1140 may be, for example, capable of wired or wireless communication. The display device 1150 may be, for example, a liquid crystal display screen. The input device 1160 may include, for example, a touch screen, a keyboard, etc.
[0066] It should be understood by those skilled in the art that although Figure 2 , multiple devices of the server 1100a are shown; however, the server 1100a and the server 1100b of the embodiment of the present disclosure may only involve some of the devices, for example, only the processor 1110 and the memory 1120.
[0067] like Figure 2 As shown, the terminal device 1200 may include a processor 1210, a memory 1220, an interface device 1230, a communication device 1240, a display device 1250, an input device 1260, an audio output device 1270, an audio input device 1280, and the like. Among them, the processor 1210 may be a central processing unit CPU, a microprocessor MCU, and the like. The memory 1220 may include, for example, a ROM (read-only memory), a RAM (random access memory), a non-volatile memory such as a hard disk, and the like. The interface device 1230 may include, for example, a USB interface, an earphone interface, and the like. The communication device 1240 may, for example, be capable of wired or wireless communication. The display device 1250 may, for example, be a liquid crystal display screen, a touch display screen, and the like. The input device 1260 may, for example, include a touch screen, a keyboard, and the like. The terminal device 1200 may output audio information through an audio output device 1270, and the audio output device 1270 may, for example, include a speaker. The terminal device 1200 may pick up voice information input by a user through an audio pickup device 1280, and the audio pickup device 1280 may, for example, include a microphone.
[0068] The terminal device 1200 can be a smart phone, a laptop computer, a desktop computer, a tablet computer, a wearable device, a smart speaker, a set-top box, a smart TV, etc.
[0069] In the embodiment of the present disclosure, the terminal device 1200 may be used to participate in implementing the traffic steering method according to any embodiment of the present disclosure.
[0070] As used in the embodiments of the present disclosure, the memory 1120 of the terminal device 1200 is used to store instructions, and the instructions are used to control the processor 1110 to operate to support the implementation of the traffic steering method according to any embodiment of the present disclosure. A technician can design instructions according to the scheme disclosed in the present disclosure. How instructions control the processor to operate is well known in the art, so it will not be described in detail here.
[0071] It should be understood by those skilled in the art that although Figure 2 Multiple devices of the terminal device 1200 are shown in the figure, but the terminal device 1200 of the embodiment of the present disclosure may only involve some of the devices, for example, only the processor 1210, the memory 1220, etc.
[0072] The communication network 1300 may be a wireless network or a wired network, a local area network or a wide area network. The terminal device 1200 may communicate with the server 1100a and the server 1100b via the communication network 1300.
[0073] Figure 2 The flow directing system 1000 shown is illustrative only and is in no way intended to limit the present disclosure, its application, or uses. Figure 2 Only one server 1100a, one server 1100b and one terminal device 1200 are shown, but this does not mean to limit the respective numbers. The data processing system 1000 may include multiple servers 1100a, 1100b and / or multiple terminal devices 1200.
[0074] <Method Example 1>
[0075] Figure 3 is a flow chart of a traffic guiding method according to an embodiment of the present disclosure, which can be applied to a terminal device installed with an application program, for example, Figure 2 In addition, the application in the terminal device can be any application, for example, it can be an application such as a game, an online trading platform, etc.
[0076] according to Figure 2 As shown, the method of this embodiment may include the following steps S3100 to S3300, which are described in detail below.
[0077] Step S3100, when the application establishes a network connection with the first server through a first network connection function, use a second network connection function to intercept the first network connection function, wherein the parameters of the first network connection function include a first communication address of the first server.
[0078] Before introducing step S3100, the initiation process of the traffic data of the application in the terminal device is briefly described first. The initiation process of the traffic data of the application generally includes: step S3101, parsing the server address, obtaining the communication address of the server, wherein the server can be a server to receive the data access request sent by the application and provide data response messages to the application, and the communication address of the server is generally the host address of the server, and the host address is generally composed of an Internet protocol address (IP, Internet Protocol Address) and a port number (Port); step S3102, creating a socket, wherein the socket is an abstract layer, and the application generally sends and receives data to the server through the socket; step S3103, establishing a network connection with the server through the network connection function and the server communication address, wherein the network connection function is generally connect(int sockfd, const struct The function is in the form of sockaddr*serv_addr, socklen_taddrlen), the first parameter sockfd of the function is the identifier of the socket created in step S3102, the second parameter sockaddr is the communication address of the server to which the network connection is to be established, and the third parameter addrlen is the length of the second parameter; step S3104, after the network connection is successfully established in step S3103, a data access request is sent to the server through the socket, or a data response message provided by the server is received.
[0079] The network connection function in the present disclosure is a function that implements the network connection function, which can be understood as a computer program or instruction set that implements the network connection function. When other computer programs call the function according to the format defined by the function, the network connection function can be implemented.
[0080] In order to solve the problem that existing traffic guiding methods cannot conveniently and safely guide the traffic data of applications, the embodiments of the present disclosure guide the traffic data of applications by intercepting relevant interface functions in the initiation process of the traffic data of applications.
[0081] Specifically, the resolution function used to resolve the server address in the above step S3101 can be intercepted to change the communication address of the server, that is, the communication address of the first server, to the communication address of other servers, that is, the communication address of the second server, so as to guide the traffic data of the application from the first server to the second server. However, in practice, for the above step S3101, when the first server address is a domain name address, it is generally necessary to use a domain name server (DNS, Domain Name Server) to resolve the domain name address to obtain the IP address of the first server; and when the first server address is directly an IP address, it is not necessary to perform domain name resolution on the first server address. Therefore, the method of guiding the traffic data of the application by intercepting the resolution function also has the technical problems of cumbersome steps and inconvenience.
[0082] In the specific implementation, for the above step S3103, in Android (Android System), Apple (IOS, IPhone Operation System) and other operating systems, when establishing a network connection, the application generally uses Berkeley sockets (also known as BSD Socket) to create a network connection, and in the parameters of the network connection function, the communication address of the server to be established is usually determined, that is, generally composed of an IP address and a port number. Therefore, in the embodiment of the present disclosure, when the application establishes a network connection with the server through the network connection function, the flow data of the application can be guided by intercepting the network connection. It should be noted that BSD Socket, also known as BSD socket application program interface, is an application development library for implementing inter-process network connections.
[0083] In this embodiment, the application program may be any application program in the terminal device, for example, it may be an application program such as a game or an online trading platform. The first network connection function is an initial function in the application program for establishing a network connection with the first server. The first network connection function generally refers to a system-level interface function. For example, the first network connection function may be the connect() function provided by BSD Socket. The first server is an initial server that is to receive a data access request sent by the application program and provide a data response message to the application program. For example, it may be Figure 1The server 1100a shown. The second network connection function is used to intercept the first network connection function, and can be specifically used to determine whether the first communication address meets the preset traffic guidance condition, and determine whether to guide the traffic of the application according to the determination result, wherein the parameters of the second network connection function can be consistent with the parameters of the first network connection function, for example, the second network connection function can be in the form of connect-2().
[0084] It should be noted that in this embodiment, the application establishes a network connection with the server through a network connection function. Of course, with the continuous advancement of technology, in specific implementation, the application may also establish a network connection with the server through other methods, which is not specifically limited here.
[0085] In a specific implementation, the use of the second network connection function to intercept the first network connection function includes: obtaining a first execution address of the first network connection function, wherein the first execution address is an address of the first network connection function in a file, and the file includes an executable file corresponding to the application; obtaining a second execution address of the second network connection function; and replacing the first execution address with the second execution address through the second network connection function.
[0086] In specific implementation, the first network function can be intercepted through the hook technology, wherein the hook technology is also called the hook function, which means that before the application is ready to call the target function, the hook program first captures the call message, and the hook function first obtains the control right, so that the hook function can process (change) the execution behavior of the function, or force the end of the message transmission, etc.
[0087] The first execution address, also called the entry address, is the calling address of the first network connection function in the executable file of the application.
[0088] The executable file corresponding to the application is a file that can be loaded and executed by the operating system. In different operating system environments, the executable file is presented differently.
[0089] For example, under the Windows operating system, executable files can be types of files such as exe files (executable file), sys files (system file) and COM files (COM format file); in operating systems with Linux as the kernel, such as Android systems or IOS systems, executable files are generally executable and linkable format (ELF, Executable and Linkable Format) files.
[0090] In this embodiment, Hook technology can be used to register a second network connection function. During the running of the application, when the application obtains the first communication address and calls the first network connection function to establish a network connection with the first server, the Hook technology is used to intercept the application's call message to the first network connection function, and the first execution address of the first network function in the executable file corresponding to the application is changed to the second execution address of the second network connection function, so that when the application calls the first network connection function, it actually calls the second network connection function.
[0091] It should be noted that Hook technology generally includes inline hooks (inlineHook), method switching (MethodSwizzling) and procedure link table hooks (PLTHook).
[0092] InlineHook is a method to implement Hook by directly modifying the binary code of the target function in the executable file corresponding to the application. The target function can be the first network connection function. Since the modification of the binary code is relatively complicated, this method has the problems of cumbersome steps and complex implementation. In addition, this method also needs to obtain the full permissions of the executable file. In practice, due to the permission restrictions of the operating system, this method cannot be used in some scenarios. Therefore, although this method can achieve the effect of intercepting the first network function, it is not convenient enough and has poor compatibility.
[0093] MethodSwizzling is a method of implementing Hook by replacing the virtual function pointer of the target function or searching for the response function during the running of the application. Although this method can also achieve the effect of intercepting the first network function, it is generally only applicable to the IOS system. Therefore, this method also has the problems of inconvenience and poor compatibility.
[0094] PLTHook is a method for hooking the target function based on the delayed binding strategy when the Linux operating system executes executable files. This method implements the Hook by directly modifying the execution address of the target function in the global offset table (GOT, GlobalOffsetTable), which can conveniently and stably hook the target function.
[0095] In the specific implementation, since both inlineHook and MethodSwizzling have certain problems, in order to conveniently and stably intercept the first network connection function, this embodiment adopts PLTHook to intercept the first network connection function. That is to say, in this embodiment, the file is an executable and linkable format file corresponding to the application, and the first execution address is the function address of the first network connection function in the global offset table of the executable and linkable format file, and the second execution address is the function address of the second network connection function in the global offset table of the executable and linkable format file.
[0096] It should be noted that, since there is a detailed description of the Hook technology in the prior art, this embodiment only briefly describes the technology, and its detailed processing process is not repeated. Of course, in the specific implementation, other methods can also be used to intercept the first network connection function of the application, which is not repeated here.
[0097] After step S3100, step S3200 is executed to replace the first communication address with the second communication address of the second server through the second network connection function when the first communication address meets the preset traffic guidance condition.
[0098] According to step S3100, after the second network connection function is used to intercept the first network connection function, out of consideration for user privacy protection, it can be determined whether the first communication address of the first server meets the preset traffic guidance condition.
[0099] Specifically, when an application is running, not all traffic data needs to be directed. For example, for a game application in a terminal device, when a user uses the application, it is not necessary to connect to the game server to obtain game data; when using the application, the user can also visit the official website of the game to recharge game coins or browse forum data. Therefore, in the specific implementation, in order to protect user privacy and improve user experience, this embodiment also provides a method for determining whether the first communication address of the first server meets the preset traffic guidance conditions, specifically including: obtaining a communication address set configured by the user, wherein the communication addresses in the communication address set are the communication addresses of the servers that need to be processed for traffic guidance; when the communication address set includes the first communication address, determining that the first communication address meets the preset traffic guidance conditions.
[0100] The communication address set may be the communication addresses of the servers that require traffic guidance processing and are pre-configured by the user.
[0101] For example, for game applications, in order to reduce the bandwidth pressure of the game server and improve the security of data access requests to the game server, the communication address in the communication address set corresponding to the game application can be the host address and port number of the server in the game server cluster.
[0102] In a specific implementation, when the first communication address exists in the communication address set, it can be determined that the first communication address meets the preset traffic steering condition. At this time, the first communication address can be replaced with the second communication address, so that the application establishes a network connection with the second server.
[0103] Of course, when the first communication address does not exist in the communication address set, it indicates that there is no need to guide the traffic data of the application program. At this time, the application program can continue to establish a network connection with the first server.
[0104] It should be noted that, in specific implementation, other methods may also be used to determine whether the first communication address of the first server meets the traffic guidance condition, and no special limitation is made here.
[0105] After step S3200, step S3300 is executed to establish a network connection with the second server through the second communication address to guide the traffic data of the application to the second server.
[0106] According to step S3200, when the first communication address of the first server meets the preset traffic directing conditions, the first communication address is replaced with the second communication address of the second server. At this time, a network connection can be established with the second server through the second communication address, so that when the application sends traffic data through the network connection, the traffic data is sent to the second server.
[0107] In this embodiment, directing the traffic data of the application to the second server includes: when a network connection between the application and the second server is successfully established, the application sends a data access request to the second server through the network connection; and the application receives a data response message provided by the second server corresponding to the data access request.
[0108] That is, the traffic data of the application includes the data access request issued by the application and the data response message corresponding to the data access request provided by the second server. Of course, in the specific implementation, the traffic data of the application can also be the heartbeat data sent and received by the application according to the heartbeat mechanism, which will not be repeated here.
[0109] In a specific implementation, the second server may be a local proxy server, wherein the local proxy server is used to send the data access request sent by the application to the first server, and receive a data response message returned by the first server corresponding to the data access request.
[0110] Specifically, after directing the traffic data of the application to the second server, in order to reduce hardware pressure and reduce the steps of configuring various forwarding strategies such as routing, the second server can be a local proxy server running in the terminal device, that is, it can be a virtual server established in the terminal device, and the virtual server is used to receive data access requests or other traffic data sent by the application in the terminal device, and after scheduling or security authentication of the traffic data, the traffic data is sent to the first server after automatically generating routing packages, login authentication or traffic encryption; after receiving the traffic data sent by the local proxy server, the first server can generate a data response message corresponding to the traffic data, and return the data response message to the local proxy server; after receiving the data response message returned by the first server, the local proxy server can provide the data response message to the application in the terminal device.
[0111] In a specific implementation, the local proxy server can be obtained by the following method: obtaining a communication address set configured by a user, wherein the communication addresses in the communication address set are communication addresses of servers that require traffic guidance processing; and determining the local proxy server based on the communication address set.
[0112] Please see Figure 4 , which is a processing schematic diagram of the flow guidance method according to an embodiment of the present disclosure. Figure 4 When an application integrates the method, it first integrates the software development kit (SDK) corresponding to the traffic steering method into the code engineering of the application. After that, it only needs to execute step S4100 in the code file of the application, that is, call the initialization interface function, for example, the init interface function to integrate the method into the application.
[0113] Please continue to see Figure 4After the application calls the initialization interface function provided by the SDK corresponding to the method through step S4100, the SDK can automatically execute step S4200 to obtain a communication address set, that is, obtain the communication address of the server that needs to perform traffic guidance processing and is pre-configured by the user; then, automatically execute step S4300 to determine the local proxy server, that is, determine the local proxy server corresponding to the application according to the communication address in the communication address set, wherein, if the local proxy server does not exist in the terminal device, the local proxy server can be automatically established in the terminal device according to the communication address, and the corresponding routing strategy and other forwarding strategies can be configured, and if the local proxy server exists in the terminal device, the local proxy server can be directly selected; after step S4300, step S4400 can be automatically executed, that is, the first network connection function is Hooked through the Hook technology.
[0114] After the application completes the integration of the traffic steering method provided in this embodiment, during the operation of the application, when the application establishes a network connection with the first server through the first network connection function, the above steps S3100 to S3300 can be executed. When the first communication address meets the preset traffic steering conditions, the first communication address of the first server is replaced with the address of the local proxy server, and the communication address of the local proxy server is used to establish a network connection with the local proxy server to guide the traffic data of the application to the local proxy server, thereby conveniently, stably and securely guiding the traffic data of the application.
[0115] According to the above description, the traffic guidance method of this embodiment does not need to build a VPN server, nor does it need to integrate VPN interfaces and other interfaces in the application. Since the method guides the traffic of the application by hooking the network connection function, the method has good stability and compatibility. When integrating the method, it is not necessary to develop corresponding interfaces for different operating systems respectively. It is only necessary to call a general initialization interface function to complete the integration of the method. In addition, when using the method, it is also possible to conveniently guide the four-layer or seven-layer traffic data of the Transmission Control Protocol (TCP) according to the user configuration, which will not be repeated here.
[0116] It should be noted that after the traffic data of the application is directed to the second server, for example, the local proxy server, through the method of this embodiment, the data access processing of the first server by the terminal device where the application is located specifically includes: sending a request message for establishing a network connection to the first server, wherein the communication address of the first server satisfies the preset traffic directing conditions; if the network connection is successfully established, sending a data access request for the first server to the local proxy server, wherein the local proxy server corresponds to the first server; and receiving a data response message returned by the local proxy server corresponding to the data access request.
[0117] According to the above steps S3100 to S3300, it can be known that the method of this embodiment does not need to integrate a VPN interface or other interface in the application when conducting traffic guidance processing on the application. Instead, when the application establishes a network connection with the first server through the first network connection function, the second network connection function is used to intercept the first network connection function, and when the first communication address of the first server meets the preset traffic guidance condition, the first communication address is replaced with the second communication address of the second server through the second network connection function, and then the second communication address is used to establish a network connection with the second server to guide the traffic data of the application to the second server. According to the embodiment of the present disclosure, when the terminal device with the application installed conducts traffic guidance processing on the application, it is not necessary to provide corresponding integrated interfaces for the applications in different operating systems, nor is it necessary to configure various forwarding strategies for the traffic data of the application. At the same time, the traffic data of the application can be processed in a targeted manner according to the preset traffic guidance conditions, so as to conveniently and safely guide the traffic data of the application.
[0118] <Method Example 2>
[0119] Corresponding to the traffic guiding method in method embodiment 1, this embodiment also provides a data access method, see Figure 5 , which is a flow chart of a data access method according to this embodiment, the method can be implemented by a terminal device, wherein an application program is running in the terminal device, for example, Figure 1 The terminal device 1200 is implemented in.
[0120] like Figure 5 As shown, the data access method provided by this embodiment includes steps S5100 to S5300.
[0121] Step S5100, sending a request message for establishing a network connection to a target server, wherein the communication address of the target server meets a preset traffic directing condition.
[0122] Step S5200: When the network connection is successfully established, a data access request for the target server is sent to a local proxy server, wherein the local proxy server corresponds to the target server.
[0123] Step S5300: Receive a data response message returned by the local proxy server and corresponding to the data access request.
[0124] In this embodiment, the terminal device can be a mobile terminal device such as a smart phone, a laptop computer, a desktop computer, a tablet computer, a wearable device, or a smart home device such as a smart speaker, a set-top box, a smart TV, etc., without any special limitation here.
[0125] <Method Example 3>
[0126] Corresponding to the flow guiding method in method embodiment 1, this embodiment also provides another flow guiding method, please refer to Figure 6 , which is a flow chart of another method for directing traffic according to an embodiment of the present disclosure, which method can also be applied to a terminal device with an application installed, for example, Figure 2 The terminal device 1200 is implemented in.
[0127] like Figure 6 As shown, the traffic directing method provided in this embodiment includes steps S6100 to S6300.
[0128] Step S6001, when the application establishes a network connection with the first server, intercept the network connection.
[0129] Step S6002, when the first communication address of the first server corresponding to the network connection meets the preset traffic guidance condition, replace the first communication address with the second communication address of the second server;
[0130] Step S6003: Establish a network connection with the second server through the second communication address to direct the traffic data of the application to the second server.
[0131] It should be noted that, in the present embodiment, when the application establishes a network connection with the first server, the network connection can be established with the first server through a network connection function; correspondingly, when the network connection is intercepted, the network connection can also be intercepted through other network connection functions corresponding to the network connection function; of course, with the continuous advancement of technology, in specific implementation, the application can also establish a network connection with the server through other methods, and intercept the network connection through other methods, which is not specifically limited here.
[0132] <Device Example>
[0133] Corresponding to the above embodiment, this embodiment also provides a flow guiding device, which can be applied to a terminal device installed with an application program, such as Figure 7 As shown, it is a schematic diagram of a flow guiding device according to an embodiment of the present disclosure.
[0134] according to Figure 7 As shown, the traffic directing device 7000 of this embodiment includes an interception module 7100 , an address replacement module 7200 and a network connection establishment module 7300 .
[0135] The interception module 7100 is used to intercept the first network connection function using the second network connection function when the application establishes a network connection with the first server through the first network connection function, wherein the parameters of the first network connection function include the first communication address of the first server.
[0136] In one embodiment, when the interception module 7100 uses the second network connection function to intercept the first network connection function, it can be used to: obtain a first execution address of the first network connection function, wherein the first execution address is the address of the first network connection function in a file, and the file includes an executable file corresponding to the application; obtain a second execution address of the second network connection function; and replace the first execution address with the second execution address through the second network connection function.
[0137] In this embodiment, the file may be an executable and linkable format file corresponding to the application, the first execution address is a function address of the first network connection function in a global offset table of the executable and linkable format file, and the second execution address is a function address of the second network connection function in a global offset table of the executable and linkable format file.
[0138] The address replacement module 7200 is used to replace the first communication address with the second communication address of the second server through the second network connection function when the first communication address meets the preset traffic guidance condition.
[0139] In one embodiment, the device also includes: a judgment module, used to obtain a communication address set configured by the user, wherein the communication addresses in the communication address set are communication addresses of servers that need to perform traffic guidance processing; when the first communication address is included in the communication address set, it is determined that the first communication address meets the preset traffic guidance condition.
[0140] The network connection establishing module 7300 is used to establish a network connection with the second server through the second communication address to guide the traffic data of the application to the second server.
[0141] In one embodiment, when directing the traffic data of the application to the second server, the network connection establishment module 7300 can be used to: when the network connection between the application and the second server is successfully established, the application sends a data access request to the second server through the network connection; and the application receives a data response message provided by the second server corresponding to the data access request.
[0142] In this embodiment, the second server is a local proxy server, wherein the local proxy server is used to send the data access request sent by the application to the first server, and receive a data response message returned by the first server and corresponding to the data access request.
[0143] In this embodiment, the device also includes a local proxy server establishment module, which is used to obtain a communication address set configured by the user, wherein the communication addresses in the communication address set are communication addresses of servers that require traffic guidance processing; based on the communication address set, the local proxy server is determined.
[0144] <Equipment Embodiment>
[0145] Corresponding to the above method embodiment 1, the above method embodiment 2 and the above method embodiment 3, this embodiment provides a terminal device, such as Figure 8a As shown, the terminal device 100 includes a traffic directing device 7000 according to any embodiment of the present disclosure.
[0146] In another embodiment, Figure 8b As shown, the terminal device 100 may include a memory 110 and a processor 120, wherein the memory 110 is used to store executable instructions; the processor 120 is used to execute a method such as any method embodiment 1, method embodiment 2 or method embodiment 3 of the present disclosure according to the control of the executable instructions.
[0147] <Medium Example>
[0148] Corresponding to the above method embodiments, in this embodiment, a computer-readable storage medium is also provided, which stores a computer program that can be read and run by a computer, and the computer program is used to execute the method described in any of the above method embodiments 1, method embodiment 2 or method embodiment 3 of the present disclosure when read and run by the computer.
[0149] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0150] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0151] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0152] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0153] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0154] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0155] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0156] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of an instruction, and the module, a program segment or a part of an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0157] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the marketplace, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the present disclosure is defined by the appended claims.
Claims
1. A traffic guiding method, applied to a terminal device having an application installed thereon, comprising: When the application establishes a network connection with the first server through a first network connection function, intercepting the first network connection function using a second network connection function, wherein a parameter of the first network connection function includes a first communication address of the first server; When the first communication address meets the preset traffic guidance condition, the first communication address is replaced with the second communication address of the second server through the second network connection function; Establishing a network connection with the second server through the second communication address to direct the traffic data of the application to the second server; The method further comprises: Acquire a communication address set configured by a user, wherein the communication addresses in the communication address set are communication addresses of servers that need to perform traffic guidance processing; In a case where the first communication address is included in the communication address set, it is determined that the first communication address satisfies the preset traffic guiding condition.
2. The method according to claim 1, wherein the step of intercepting the first network connection function using the second network connection function comprises: Obtaining a first execution address of the first network connection function, wherein the first execution address is an address of the first network connection function in a file, and the file includes an executable file corresponding to the application; Obtaining a second execution address of the second network connection function; The first execution address is replaced with the second execution address through the second network connection function.
3. According to the method according to claim 2, the file is an executable and linkable format file corresponding to the application, the first execution address is the function address of the first network connection function in the global offset table of the executable and linkable format file, and the second execution address is the function address of the second network connection function in the global offset table of the executable and linkable format file.
4. The method according to claim 1, directing the traffic data of the application to the second server comprises: When the network connection between the application and the second server is successfully established, the application sends a data access request to the second server through the network connection; and the application receives a data response message provided by the second server corresponding to the data access request.
5. The method according to claim 4, wherein the second server is a local proxy server, wherein: The local proxy server is used to send the data access request sent by the application to the first server, and receive a data response message returned by the first server and corresponding to the data access request.
6. The method according to claim 5, wherein the local proxy server is obtained by: Get the communication address set configured by the user, where: The communication addresses in the communication address set are communication addresses of servers that need to be processed for traffic guidance; The local proxy server is determined according to the communication address set.
7. A data access method, applied in a terminal device, comprising: Sending a request message for establishing a network connection to a target server, wherein the communication address of the target server meets a preset traffic guidance condition; In the case where the network connection is successfully established, sending a data access request for the target server to a local proxy server, wherein the local proxy server corresponds to the target server; receiving a data response message returned by the local proxy server and corresponding to the data access request; The method further comprises: Acquire a communication address set configured by a user, wherein the communication addresses in the communication address set are communication addresses of servers that need to perform traffic guidance processing; In a case where the communication address of the target server is included in the communication address set, determining that the communication address of the target server meets the preset traffic guiding condition; wherein a network connection is established with a target server through a first network connection function, and when a network connection is established with a first server through the first network connection function, a second network connection function is used to intercept the first network connection function, wherein a parameter of the first network connection function includes a first communication address of the target server; When the first communication address meets the preset traffic guidance condition, the first communication address is replaced with the second communication address of the local proxy server through the second network connection function to send the data access request for the target server to the local proxy server.
8. A traffic guiding device, applied to a terminal device installed with an application, comprising: an interception module, configured to intercept the first network connection function using a second network connection function when the application establishes a network connection with the first server through the first network connection function, wherein a parameter of the first network connection function includes a first communication address of the first server; An address replacement module, configured to replace the first communication address with a second communication address of a second server through the second network connection function when the first communication address meets a preset traffic guidance condition; a network connection establishing module, configured to establish a network connection with the second server via the second communication address, so as to direct the traffic data of the application to the second server; The device also includes: a judgment module, which is used to obtain a communication address set configured by a user, wherein the communication addresses in the communication address set are communication addresses of servers that need to perform traffic guidance processing; when the first communication address is included in the communication address set, it is determined that the first communication address meets the preset traffic guidance condition.
9. A terminal device, comprising the apparatus according to claim 8; or, The terminal device comprises: A memory for storing executable instructions; A processor is used to operate the terminal device to execute the method according to any one of claims 1-7 under the control of the instruction.
10. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program that can be read and executed by a computer, and the computer program is used to execute the method according to any one of claims 1 to 7 when being read and executed by the computer.
Citation Information
Patent Citations
Flow guiding method and mobile terminal
CN108400974A
Transparent communication protection method and device for mobile application program
CN111132138A