Application network configuration methods, devices, storage media, and electronic devices

By using the application's network proxy configuration page, which is independent of the system configuration page, the network configuration information of the target proxy device is determined and invoked. This solves the problem of complex and inefficient application network environment switching in the existing technology, and achieves flexible and efficient network environment switching.

CN117714283BActive Publication Date: 2026-05-26BEIJING PERFECT LINGXI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING PERFECT LINGXI TECH CO LTD
Filing Date
2023-07-07
Publication Date
2026-05-26

Smart Images

  • Figure CN117714283B_ABST
    Figure CN117714283B_ABST
Patent Text Reader

Abstract

This application relates to a network configuration method, apparatus, storage medium, and electronic device for an application. The method includes: determining a target proxy device through the application's network proxy configuration page, wherein the application's network proxy configuration page is independent of the system network proxy configuration page of the system hosting the application; searching for target network proxy configuration information for the target proxy device from multiple network proxy configuration information sets, wherein the network proxy configuration information includes at least the network address and port number of the proxy device; and invoking the network API of the system hosting the application based on the target network proxy configuration information, so that the application can transmit data with a data server through the target proxy device. This application solves the technical problems of inconvenience and low efficiency in switching network environments during application development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communications, and more particularly to a network configuration method, apparatus, storage medium, and electronic device for an application. Background Technology

[0002] In existing technologies, during application development, developers often need to connect packet capture software to capture packets under different network environments, which involves frequent switching of the network environment used by the application. Generally, this switching of network environment is achieved by manually setting the system's network parameters, which is complex, inflexible, and inefficient. Summary of the Invention

[0003] This application provides a network configuration method, apparatus, storage medium, and electronic device for applications to solve the technical problem of inconvenience and low efficiency in switching network environments during application development.

[0004] In a first aspect, this application provides a network configuration method for an application, comprising: determining a target proxy device through the application's network proxy configuration page, wherein the application's network proxy configuration page is independent of the system network proxy configuration page of the system where the application resides; searching for target network proxy configuration information of the target proxy device from multiple network proxy configuration information, wherein the network proxy configuration information includes at least the network address and port number of the proxy device; and calling the network API of the system where the application resides based on the target network proxy configuration information, so that the application transmits data with a data server through the target proxy device.

[0005] As an optional example, determining the target proxy device through the application's network proxy configuration page includes: displaying the unique identifier of the proxy device on the network proxy configuration page according to priority, wherein the closer the most recent usage time of the network proxy configuration information of the proxy device is to the current time, the higher the priority of the unique identifier of the proxy device; and, upon receiving a selection instruction, determining the proxy device indicated by the selection instruction as the target proxy device.

[0006] As an optional example, the above method further includes: when it is determined through the above network proxy configuration page that the proxy configuration corresponding to the application is not used, determining the system proxy configuration of the system where the application is located, and connecting to the system proxy device through the above system proxy configuration to transmit data with the data server; or when it is determined through the above network proxy configuration page that the proxy configuration corresponding to the application is not used, transmitting data through direct connection with the data server.

[0007] As an optional example, controlling the application to transmit data between the current proxy device and the data server according to the test order and / or test time period of the current proxy device in the test instruction includes: determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device.

[0008] As an optional example, before determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device, the method further includes: forwarding a predetermined number and a predetermined size of test data packets to the data server through the current proxy device; recording the average forwarding time of the current proxy device; and determining the performance of the current proxy device based on the average forwarding time.

[0009] As an optional example, before determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device, the method further includes: forwarding a predetermined number of test data packets of different sizes to the data server through the current proxy device; recording the forwarding time of the current proxy device for each type of test data packet; and determining the performance of the current proxy device based on the forwarding time.

[0010] Secondly, this application provides a network configuration device for an application, comprising: a determining module, configured to determine a target proxy device through the application's network proxy configuration page, wherein the application's network proxy configuration page is independent of the system network proxy configuration page of the system where the application resides; a searching module, configured to search for target network proxy configuration information of the target proxy device from multiple network proxy configuration information, wherein the network proxy configuration information includes at least the network address and port number of the proxy device; and a setting module, configured to call the network API of the system where the application resides based on the target network proxy configuration information, so that the application transmits data with a data server through the target proxy device.

[0011] As an optional example, the search module includes: a search unit, configured to, when displaying the network proxy configuration page, search for multiple network proxy configuration information from the storage area corresponding to the network proxy configuration page in local storage, and determine the target network proxy configuration information from the multiple network proxy configuration information found; and an acquisition unit, configured to, if the multiple network proxy configuration information is not included in the local storage, acquire an imported configuration file, and determine the target network proxy configuration information from the multiple network proxy configuration information in the configuration file; or, if the multiple network proxy configuration information is not included in the local storage, acquire the input target network proxy configuration information.

[0012] As an optional example, the above-mentioned search module further includes: a traversal unit, used to traverse the code in the above-mentioned configuration file after obtaining the imported configuration file; when traversing to the first string, determining the string of the first length after the first string as the device network address in a network proxy configuration information; when traversing to the second string, determining the string of the second length after the second string as the port number in the above-mentioned network proxy configuration information; when traversing to the third string, determining the string of the third length after the third string as the most recent usage time of the above-mentioned network proxy configuration information.

[0013] As an optional example, the determination module includes: a determination unit, configured to display the unique identifier of the proxy device on the network proxy configuration page according to priority, wherein the closer the most recent usage time of the network proxy configuration information of the proxy device is to the current time, the higher the priority of the unique identifier of the proxy device; and, upon receiving a selection instruction, to determine the proxy device indicated by the selection instruction as the target proxy device.

[0014] As an optional example, the above-mentioned setting module includes: a setting unit, which, upon receiving a connection request, calls the system network configuration API based on the network address and port number of the proxy device in the target network proxy configuration information; or, upon receiving a save and connect request, calls the system network configuration API based on the network address and port number of the proxy device in the target network proxy configuration information, and saves the network address and port number of the proxy device to a configuration file.

[0015] As an optional example, the above apparatus further includes: a first processing module, configured to, after calling the network API of the system where the application resides based on the target network proxy configuration information, during the process of displaying the network proxy configuration page, upon receiving a first deletion instruction for the unique identifier of any proxy device in the network proxy configuration page, delete the unique identifier of the arbitrary proxy device in the network proxy configuration page and save the network proxy configuration information of the arbitrary proxy device in the configuration file, wherein the deleted unique identifier is not displayed in the network proxy configuration page; upon receiving a first recovery instruction for the unique identifier of the arbitrary proxy device, restore the unique identifier according to the network proxy configuration information in the configuration file, wherein the restored unique identifier is displayed in the network proxy configuration page; and if no first recovery instruction is received within a certain period of time, delete the network proxy configuration information of the arbitrary proxy device in the configuration file.

[0016] As an optional example, the above apparatus further includes: a second processing module, configured to, after calling the network API of the system where the application resides based on the target network proxy configuration information, during the process of displaying the network proxy configuration page, upon receiving a second deletion instruction for the unique identifier of any proxy device in the network proxy configuration page, display the unique identifier of the arbitrary proxy device in the network proxy configuration page in a different display mode and delete the network proxy configuration information of the arbitrary proxy device in the configuration file; upon receiving a second recovery instruction for the unique identifier of the arbitrary proxy device, restore the unique identifier of the arbitrary proxy device to its original display mode and save the network proxy configuration information of the arbitrary proxy device to the configuration file; and if no second recovery instruction is received within a certain period of time, delete the unique identifier of the arbitrary proxy device.

[0017] As an optional example, the above-mentioned apparatus further includes: a third processing module, configured to determine the system proxy configuration of the system where the application is located when it is determined through the network proxy configuration page that the proxy configuration corresponding to the application is not used, and connect to the system proxy device through the system proxy configuration to transmit data with the data server; or to transmit data through direct connection with the data server when it is determined through the network proxy configuration page that the proxy configuration corresponding to the application is not used.

[0018] As an optional example, the above apparatus further includes: a testing module, configured to, upon receiving a test instruction, determine the proxy devices in the proxy device list corresponding to the test instruction as the current proxy devices, and perform the following operations one by one: determine the network proxy configuration information of the current proxy devices as the target network proxy configuration information; control the application to transmit data with the data server through the current proxy devices according to the test order and / or test time period of the current proxy devices in the test instruction; and perform packet capture operations on the application.

[0019] As an optional example, the above test module includes: a data determination unit, used to determine the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device.

[0020] As an optional example, the above-mentioned test module further includes: a first performance determination unit, configured to forward a predetermined number and a predetermined size of test data packets to the data server through the current proxy device before determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device; record the average forwarding time of the current proxy device; and determine the performance of the current proxy device based on the average forwarding time.

[0021] As an optional example, the above-mentioned test module further includes: a second performance determination unit, configured to forward a predetermined number of test data packets of different sizes to the data server through the current proxy device before determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device; record the forwarding time of the current proxy device for each type of test data packet; and determine the performance of the current proxy device based on the forwarding time.

[0022] Thirdly, this application provides an electronic device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor is configured to implement the network configuration method of the application program when executing the computer program.

[0023] Fourthly, this application also provides a computer storage medium storing computer-executable instructions for executing the network configuration method of the aforementioned application.

[0024] Compared with the prior art, the above-mentioned technical solution provided in this application embodiment has the following advantages: The method provided in this application embodiment determines the target proxy device through the network proxy configuration page of the application, and then calls the network API of the system where the application is located by searching the target network proxy configuration information of the target proxy device, so as to use the target network proxy configuration information to access the target proxy device, and transmit data with the data server through the target proxy device, thereby achieving the purpose of flexible, fast and efficient switching of network environment. Attached Figure Description

[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0028] Figure 1 A flowchart illustrating a network configuration method for an application provided in an embodiment of this application;

[0029] Figure 2 A flowchart illustrating another network configuration method for an application provided in an embodiment of this application;

[0030] Figure 3 A flowchart illustrating another network configuration method for an application provided in this application embodiment;

[0031] Figure 4 A system schematic diagram illustrating a network configuration method for an application provided in an embodiment of this application;

[0032] Figure 5 A schematic diagram of the structure of a network configuration device for an application provided in an embodiment of this application;

[0033] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0035] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0036] Figure 1 This is a flowchart illustrating a network configuration method for an application provided in an embodiment of this application. Figure 1 As shown, the network configuration method for the above application includes:

[0037] S102, the target proxy device is determined through the application's network proxy configuration page. The application's network proxy configuration page is independent of the system proxy configuration page of the system where the application is located.

[0038] S104, Search for the target network proxy configuration information of the target proxy device from multiple network proxy configuration information, wherein the network proxy configuration information includes at least the network address and port number of the proxy device;

[0039] S106, based on the target network agent configuration information, call the network API of the system where the application is located, so that the application can transmit data with the data server through the target agent device.

[0040] In this embodiment, the network proxy configuration page of the application is independent of the system network proxy configuration page of the application's running system. The network proxy configuration page can be one of the application's pages or a page accessible through the application. On this page, a target proxy device can be selected. Selecting a target proxy device allows the user to choose one from multiple proxy devices. Once the selected target proxy device is determined, the backend can retrieve the target network proxy configuration information for that device from the network proxy configuration information. Each proxy device has corresponding network proxy configuration information, which may include the proxy device's network address, port number, and most recent usage time. After retrieving the target network proxy configuration information, the network API of the application's running system is called based on this information. The application's running system can be an operating system on a physical terminal or a cloud host. Accessing the target proxy device according to the target network proxy configuration information allows data to be transferred between the target proxy device and the data server.

[0041] Generally, application network proxy configuration is achieved through the system network proxy configuration page of the system it runs on. Configurations implemented in the system network proxy configuration page apply to all applications on that system; that is, all applications running on that system use the proxy information on this page for network communication. However, this application provides a separate network proxy configuration page, separate from the system network proxy configuration page, that applies only to a specific application. Its configuration only applies to that application; that is, when choosing to use the configuration on this page for network access, the corresponding proxy configuration only applies to that specific application, and the effective configuration does not affect the configuration information in the system network proxy configuration page, meaning it does not affect other applications choosing to use the configuration on the system network proxy configuration page for network access.

[0042] For example, under the scheme of this application, if a system has two applications, one of which uses the application's network proxy configuration page to configure proxy device A, and the other uses the system's network proxy configuration page to configure proxy device B, then the two applications can use proxy device A and proxy device B respectively to perform network communication simultaneously.

[0043] In this embodiment, after calling the system's network API according to the network configuration information of the target proxy device, the application can access the target proxy device through the network parameters defined by the network information, and then transmit data between the target proxy device and the data server. The data server can provide services to applications on the system, and the target proxy device provides proxy services between the system and the data server.

[0044] The method provided in this application embodiment determines the target proxy device through the network proxy configuration page of the application, and then sets the network configuration corresponding to the application by searching the target network proxy configuration information of the target proxy device. The set network configuration is then used to connect to the proxy device to transmit data with the data server, thereby achieving the purpose of flexible, fast and efficient switching of network environment.

[0045] As an optional example, such as Figure 2 As shown, the process of finding the target network proxy configuration information for the target proxy device from multiple network proxy configuration information includes:

[0046] S202, when displaying the network proxy configuration page, search for multiple network proxy configuration information from the storage area corresponding to the network proxy configuration page in the local storage, and determine the target network proxy configuration information from the multiple network proxy configuration information found.

[0047] S204. If the local storage does not include multiple network proxy configuration information, obtain the imported configuration file and determine the target network proxy configuration information from the multiple network proxy configuration information in the configuration file; or if the local storage does not include multiple network proxy configuration information, obtain the input target network proxy configuration information.

[0048] In this embodiment, network proxy configuration information can be pre-stored locally or imported via file import. If pre-stored locally, the target network proxy configuration information can be retrieved locally. If the network proxy configuration information is not stored locally, the user can be notified to import a file. The file contains the proxy device and its corresponding network proxy configuration information. The target network proxy configuration information can be retrieved through the imported file. If the network proxy configuration information is not stored locally and cannot be obtained via file import, the user can input the target network proxy configuration information on the page.

[0049] In this embodiment, the locally stored network proxy configuration information can be stored in different areas depending on the network proxy configuration page of the application, thereby enabling different application configuration pages to correspond to different network proxy configuration information (or network proxy configuration files).

[0050] As an optional example, after obtaining the imported configuration file, the above method also includes: traversing the code in the configuration file; if the first string is encountered, determining the first-length string after the first string as the device network address in a network proxy configuration information; if the second string is encountered, determining the second-length string after the second string as the port number in a network proxy configuration information; if the third string is encountered, determining the third-length string after the third string as the most recent usage time of a network proxy configuration information.

[0051] In this embodiment, if there is no network proxy configuration information locally, and the network proxy configuration information is imported by importing a file, the imported configuration file needs to be traversed to obtain the network proxy configuration information.

[0052] During code traversal, keywords can be iterated over. Keywords mark whether the characters following them represent a network address, port number, last used time, or other code. If a keyword marking a network address, port number, or last used time is encountered, the corresponding length of the string following the keyword is retrieved as network proxy configuration information. The lengths corresponding to the network address, port number, and last used time are different. For example, a port number can be a 4-digit number like XXXX, and a network address can be a four-segment number like XXX.XXX.XX.

[0053] As an optional example, such as Figure 3 As shown, the target proxy device can be determined through the application's network proxy configuration page, including:

[0054] S302, Display the unique identifier of the proxy device on the network proxy configuration page according to priority. The closer the most recent use time of the network proxy configuration information of the proxy device is to the current time, the higher the priority of the unique identifier of the proxy device.

[0055] S304, upon receiving a selection instruction, determines the agent device indicated by the selection instruction as the target agent device.

[0056] In this embodiment, the network proxy configuration page can display a unique identifier for the proxy device. This unique identifier can be a unique identification number, an image identifier, or an icon identifier for the proxy device. By displaying unique identifiers according to priority, users can select a proxy device as the target proxy device. This priority can be sorted by the most recent usage time from earliest to latest, or from latest to earliest, or by name, etc.

[0057] As an optional example, calling the network API of the system where the application resides based on the target network proxy configuration information includes: upon receiving a connection request, calling the system network configuration API based on the network address and port number of the proxy device in the target network proxy configuration information; or upon receiving a save and connect request, calling the system network configuration API based on the network address and port number of the proxy device in the target network proxy configuration information, and saving the network address and port number of the proxy device to the configuration file, that is, saving it in the network proxy configuration information (or network proxy configuration file) corresponding to the application.

[0058] In this embodiment, once the target network proxy device and its configuration information are determined, the target network proxy device can be connected via its configuration information. When connecting to the target proxy device, the network address of the proxy device in the application's network configuration can be replaced with the target network address in the target network proxy configuration information, and the port number of the proxy device in the application's network configuration can be replaced with the target port number in the target network proxy configuration information. The network address and port number in the application's network configuration can differ from the system network proxy configuration of the application's system. Users can also choose to use the system network proxy for network communication, i.e., configure the network proxy information through the system's settings. These two settings are independent of each other; for the same application, they are mutually exclusive (only one can be used for network communication), while for different applications, they are compatible (different applications can choose one of the two settings for network communication).

[0059] After determining the target network proxy configuration information on the application network proxy configuration page, the user can choose to connect or connect and save. If the user chooses to connect, the corresponding network configuration will be used for network communication. If the user chooses to connect and save, the corresponding network configuration will be used for network communication and the target network proxy configuration information will be stored in the local configuration file.

[0060] As an optional example, after calling the network API of the system where the application resides based on the target network proxy configuration information, the above method further includes: during the display of the network proxy configuration page, upon receiving a first deletion instruction for the unique identifier of any proxy device in the network proxy configuration page, deleting the unique identifier of any proxy device in the network proxy configuration page and saving the network proxy configuration information of any proxy device in the configuration file, wherein the deleted unique identifier is not displayed in the network proxy configuration page; upon receiving a first restore instruction for the unique identifier of any proxy device, restoring the unique identifier according to the network proxy configuration information in the configuration file, wherein the restored unique identifier is displayed in the network proxy configuration page; if no first restore instruction is received within a certain period of time, deleting the network proxy configuration information of any proxy device in the configuration file.

[0061] In this embodiment, the unique identifiers of proxy devices in the network proxy configuration page can be managed. Management includes adding, deleting, querying, and modifying. Adding allows users to input network proxy configuration information and add a unique identifier. This configuration information can be saved to a local configuration file. Querying allows users to search by keyword. Modifying involves altering the configuration information in the configuration file or modifying the unique identifier. Deleting removes the unique identifier, making it invisible to the user and preventing the corresponding network proxy configuration information from being identified as the target network proxy configuration. However, deleting the unique identifier retains the network proxy configuration information in the configuration file. If a command to restore the unique identifier is received, it is restored. The restored unique identifier is displayed on the network proxy configuration page. If no restoration command is received within a certain period, it indicates that the user wants to delete the unique identifier and its corresponding network proxy configuration information. In this case, the network proxy configuration information corresponding to the unique identifier is deleted from the local configuration file.

[0062] As an optional example, after setting the target network proxy configuration information to the network configuration of the system where the application resides, the method further includes: during the display of the network proxy configuration page, upon receiving a second deletion instruction for the unique identifier of any proxy device in the network proxy configuration page, displaying the unique identifier of any proxy device in the network proxy configuration page in a different display mode, and deleting the network proxy configuration information of any proxy device in the configuration file; upon receiving a second recovery instruction for the unique identifier of any proxy device, restoring the unique identifier of any proxy device to its original display mode, and saving the network proxy configuration information of any proxy device to the configuration file; and if no second recovery instruction is received within a certain period of time, deleting the unique identifier of any proxy device.

[0063] In this embodiment, network proxy configuration information in the configuration file can be deleted. If the network proxy configuration information in the configuration file is deleted, the unique identifier on the network proxy configuration page will be displayed in a different style than other unique identifiers, thus indicating that the corresponding network proxy configuration information has been deleted. If the user selects the proxy device corresponding to the unique identifier as the target proxy device, the corresponding network proxy configuration information will not be in the local configuration file. The user needs to input or import it. If the user restores the network proxy configuration information corresponding to the unique identifier within a certain period of time, the display format of the unique identifier will return to its original state, and the network proxy configuration information corresponding to the unique identifier will be saved in the configuration file. If the network proxy configuration information corresponding to the unique identifier is not restored within a certain period of time, the unique identifier will also be deleted.

[0064] As an optional example, the above method also includes: when it is determined through the network proxy configuration page that the proxy configuration corresponding to the application is not used, determining the system's proxy configuration, connecting to the system proxy device through the system's proxy configuration, and transmitting data with the data server; or when it is determined through the network proxy configuration page that the proxy configuration corresponding to the application is not used, transmitting data through a direct connection to the data server.

[0065] In this embodiment, the user can choose not to use the proxy configuration corresponding to the application. If the system proxy configuration is used, the user can access the system proxy device through the system configuration information, thereby transmitting data with the data server through the system proxy device. Alternatively, if the application's proxy configuration is not used, the user can directly connect to the data server for network communication. Taking three applications as an example, application 1 determines the target proxy device through the network proxy configuration page within the application and obtains the target network proxy configuration information of the target proxy device. Then, application 1 can call the system's network API through the target network proxy configuration information to access the target proxy device corresponding to the target network proxy configuration information. Application 2 uses the system proxy configuration information to access the corresponding system proxy device. Application 3 does not use a proxy device but chooses to connect directly to the data server. It should be noted that applications 2 and 3 can call the same network API as application 1 or call different network APIs to achieve access and connection with the proxy device / data server. If the same API is called, different processes of the same API are started to provide network services for different applications. The three applications can interact with the data server in parallel.

[0066] As an optional example, the above method further includes: upon receiving a test instruction, determining the proxy devices in the proxy device list corresponding to the test instruction as the current proxy device, and performing the following operations one by one: determining the network proxy configuration information of the current proxy device as the target network proxy configuration information; controlling the application to transmit data to the data server through the current proxy device according to the test order and / or test time period of the current proxy device in the test instruction; and performing packet capture operations on the application.

[0067] In this embodiment, multiple proxy devices can be tested with a single click. Users can select multiple proxy devices and test each one in a user-determined order and / or time period. Each proxy device is used as a target to transmit data with the data server, and packet capture is performed on the application during this process. This generates test results for each proxy device.

[0068] As an optional example, controlling the application to transmit data between the current agent device and the data server according to the test order and / or test time period of the current agent device in the test instructions includes: determining the size of the data transmitted between the current agent device and the data server based on the performance of the current agent device.

[0069] In this embodiment, when testing the proxy device, the size of the data packets used for testing can be determined based on the performance of the proxy device. Different performance levels result in different data packet sizes. Minimum and maximum values ​​can be set for the data packets, and an appropriate size between the maximum and minimum values ​​can be selected based on the performance requirements.

[0070] As an optional example, before determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device, the method further includes: forwarding a predetermined number and a predetermined size of test data packets to the data server through the current proxy device; recording the average forwarding time of the current proxy device; and determining the performance of the current proxy device based on the average forwarding time.

[0071] In this embodiment, the performance of the proxy device can be determined by sending test data packets. For a predetermined number and size of test data packets, the proxy device can forward them and record the forwarding time of each test data packet. The average forwarding time is obtained by averaging the forwarding times. This allows the determination of the average forwarding time for a given data packet size. Different data packet sizes have different average forwarding times; the data packet size with the shortest average forwarding time is selected as the forwarding data packet size used during packet capture. Alternatively, a data packet size with an average forwarding time corresponding to a specific forwarding time can be selected, such as a data packet size with an average forwarding time of 10 milliseconds, or a data packet size with the smallest ratio of data packet size to forwarding time.

[0072] As an optional example, before determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device, the method further includes: forwarding a predetermined number of test data packets of different sizes to the data server through the current proxy device; recording the forwarding time of the current proxy device for each size of test data packet; and determining the performance of the current proxy device based on the forwarding time.

[0073] In this embodiment, the performance of the proxy device can be determined by sending test data packets. For test data packets of different sizes, the forwarding time for each size is recorded, and the data packet size with the smallest forwarding time, or the data packet size with a forwarding time of a specific value, is selected as the size of the data packets forwarded during the packet capture operation.

[0074] Figure 4 This is an optional system diagram of this embodiment. Taking a mobile application as an example and an Apple operating system (iPhone OS, iOS) as an example, if the application needs to interact with the server, it can use a proxy device. When using a proxy device, a proxy device is selected from multiple proxy devices. Then, the configuration information of the selected proxy device is determined from the local proxy device IP address list information. Finally, based on the configuration information of the selected proxy device, the network API of the system where the application is located is called to access the proxy device and send data to the proxy device, which then forwards it to the data server.

[0075] In this embodiment, users do not need to navigate to the system settings page; instead, they can directly begin configuring the network proxy on the in-app network proxy configuration page. Assuming a connection to proxy device A is needed to complete a packet capture request, the application proxy configuration page will load a list of previously saved proxy configurations. The list will prioritize recently used proxy configurations based on their usage time. If no proxy configuration information is available locally, the application proxy configuration list can be imported externally. The imported file is in JSON format, with the following content: an array of devices, where proxyName represents the name of the proxy device, ip represents the device's network address, port represents the device's proxy software port, and lastUsedTime is the last time the proxy software was used.

[0076]

[0077]

[0078] If the current configuration list contains the address and port of proxy device A, selecting this configuration information will automatically complete the network proxy connection. If the current list does not contain information about device A, the user needs to manually enter the address and port of device A. After entering the IP address and port of device A, the "Connect" and "Save and Connect" options will be displayed. Clicking the former will not save the information of device A, while clicking "Save and Connect" will save the IP address and port information of proxy A, as well as the current time of using proxy A, to the local proxy configuration list.

[0079] Applications can use the following code to configure network proxy settings for proxy IP addresses through the Application Programming Interface (API) provided by the iOS system.

[0080] let proxyHost = "proxyA address"

[0081] let proxyPort = "proxy port A"

[0082] sessionConfig=URLSessionConfiguration.default

[0083] sessionConfig.connectionProxyDictionary=[

[0084] kCFNetworkProxiesHTTPEnable:true,

[0085] kCFNetworkProxiesHTTPProxy:proxyHost,

[0086] kCFNetworkProxiesHTTPPort:proxyPort,

[0087] "HTTPSEnable":true,

[0088] "HTTPSProxy":proxyHost,

[0089] "HTTPSPort":proxyPort ]

[0091] Users can select to connect to other proxy devices through the above process. If a user wants to delete a proxy configuration information, after reading the locally permanently saved proxy configuration information list, they can delete a specific configuration information item in the current list. The deleted information will then be removed from the local configuration list, and the user will not see the previously deleted proxy information when loading the local list again. Other methods for deleting unique identifiers or network proxy configuration information have also been explained above and will not be repeated here.

[0092] If users do not want to use the in-app network proxy configuration information, and if users want to choose the system proxy, the option to use the system proxy should also be provided to users. This can be configured directly using the following code.

[0093] var sessionConfig=URLSessionConfiguration.default

[0094] If a user wants to bypass the current network's proxy, they can choose the direct proxy connection option, which can be configured using the following code. Direct connection will connect directly to the data server without requiring a proxy device for forwarding.

[0095] var sessionConfig=URLSessionConfiguration.default

[0096] configuration.connectionProxyDictionary=[:]

[0097] All of the above operations are completed directly within the application, without needing to navigate to system settings for configuration. By providing in-app configuration and disabling the HTTP network proxy, the tedious process of repeatedly navigating to system settings for configuration is simplified. Furthermore, the proxy only applies to the current application, making network proxy configuration more flexible. In addition, by providing a local caching mechanism for input proxy addresses and the ability to import configuration information from external sources, the problem of users repeatedly entering the same IP address and port when using the same proxy is solved, allowing users to directly fill in previously entered proxy information. It also supports automatic saving of proxy addresses and one-click switching of proxy addresses, making it quick and easy for users to switch between multiple proxy configurations. Finally, it provides both system proxy and direct connection methods, allowing the application to either use the system proxy or bypass it for direct proxy connections.

[0098] Figure 5 This is a schematic diagram of the structure of a network configuration device for an application provided in an embodiment of this application. Figure 5 As shown, the network configuration device for the above application includes:

[0099] The determination module 502 is used to determine the target proxy device through the application's network proxy configuration page. The application's network proxy configuration page is independent of the system network proxy configuration page of the system where the application is located.

[0100] The lookup module 504 is used to look up the target network proxy configuration information of the target proxy device from multiple network proxy configuration information, wherein the network proxy configuration information includes at least the network address and port number of the proxy device;

[0101] The configuration module 506 is used to call the network API of the system where the application is located based on the target network proxy configuration information, so that the application can transmit data with the data server through the target proxy device.

[0102] In this embodiment, the network proxy configuration page of the application is independent of the system network proxy configuration page of the application's running system. The network proxy configuration page can be one of the application's pages or a page accessible through the application. On this page, a target proxy device can be selected. Selecting a target proxy device allows the user to choose one from multiple proxy devices. Once the selected target proxy device is determined, the backend can retrieve the target network proxy configuration information for that device from the network proxy configuration information. Each proxy device has corresponding network proxy configuration information, which may include the proxy device's network address, port number, and most recent usage time. After retrieving the target network proxy configuration information, the network API of the application's running system is called based on this information. The application's running system can be an operating system on a physical terminal or a cloud host. Accessing the target proxy device according to the target network proxy configuration information allows data to be transferred between the target proxy device and the data server.

[0103] Generally, application network proxy configuration is achieved through the system network proxy configuration page of the system it runs on. Configurations implemented in the system network proxy configuration page apply to all applications on that system; that is, all applications running on that system use the proxy information on this page for network communication. However, this application provides a separate network proxy configuration page, separate from the system network proxy configuration page, that applies only to a specific application. Its configuration only applies to that application; that is, when choosing to use the configuration on this page for network access, the corresponding proxy configuration only applies to that specific application, and the effective configuration does not affect the configuration information in the system network proxy configuration page, meaning it does not affect other applications choosing to use the configuration on the system network proxy configuration page for network access.

[0104] For example, under the scheme of this application, if a system has two applications, one of which uses the application's network proxy configuration page to configure proxy device A, and the other uses the system's network proxy configuration page to configure proxy device B, then the two applications can use proxy device A and proxy device B respectively to perform network communication simultaneously.

[0105] In this embodiment, after calling the system's network API according to the network configuration information of the target proxy device, the application can access the target proxy device through the network parameters defined by the network information, and then transmit data between the target proxy device and the data server. The data server can provide services to applications on the system, and the target proxy device provides proxy services between the system and the data server.

[0106] The method provided in this application embodiment determines the target proxy device through the network proxy configuration page of the application, and then sets the network configuration corresponding to the application by searching the target network proxy configuration information of the target proxy device. The set network configuration is then used to connect to the proxy device to transmit data with the data server, thereby achieving the purpose of flexible, fast and efficient switching of network environment.

[0107] For other examples of this embodiment, please refer to the method examples above, which will not be repeated here.

[0108] like Figure 6 As shown in the figure, this application provides an electronic device including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0109] Memory 113 is used to store computer programs;

[0110] In one embodiment of this application, when the processor 111 executes a program stored in the memory 113, it implements the network configuration method of the application provided in any of the foregoing method embodiments, including:

[0111] The target proxy device is determined through the application's network proxy configuration page, which is independent of the system proxy configuration page of the system on which the application is located.

[0112] Find the target network proxy configuration information of the target proxy device from multiple network proxy configuration information, wherein the network proxy configuration information includes at least the network address and port number of the proxy device;

[0113] Based on the target network proxy configuration information, the application calls the network API of the system where the application resides, so that the application can transmit data with the data server through the target proxy device.

[0114] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the network configuration method for the application provided in any of the foregoing method embodiments.

[0115] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0116] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0117] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.

[0118] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A network configuration method for an application, characterized in that, include: The target proxy device is determined through the application's network proxy configuration page, which is independent of the system network proxy configuration page of the system in which the application is located. The target network proxy configuration information of the target proxy device is searched from multiple network proxy configuration information, wherein the network proxy configuration information includes at least the network address and port number of the proxy device; Based on the target network proxy configuration information, the network API of the system where the application resides is invoked, so that the application can transmit data with the data server through the target proxy device; The method further includes: upon receiving a test instruction, determining the proxy devices in the proxy device list corresponding to the test instruction as the current proxy device, and performing the following operations one by one: determining the network proxy configuration information of the current proxy device as the target network proxy configuration information; controlling the application to transmit data to the data server through the current proxy device according to the test order and / or test time period of the current proxy device in the test instruction; performing packet capture operation on the application, and determining the size of the data transmitted between the current proxy device and the data server based on the performance of the current proxy device.

2. The method according to claim 1, characterized in that, The step of searching for the target network proxy configuration information of the target proxy device from multiple network proxy configuration information includes: When displaying the network proxy configuration page, multiple network proxy configuration information are searched from the local storage in the storage area corresponding to the network proxy configuration page, and the target network proxy configuration information is determined from the multiple network proxy configuration information found. If the local storage does not include the plurality of network proxy configuration information, the imported configuration file is obtained, and the target network proxy configuration information is determined from the plurality of network proxy configuration information in the configuration file; or if the local storage does not include the plurality of network proxy configuration information, the input target network proxy configuration information is obtained.

3. The method according to claim 2, characterized in that, After obtaining the imported configuration file, the method further includes: Iterate through the code in the configuration file; When the first string is encountered during traversal, the string of the first length following the first string is determined as the device network address in a network proxy configuration information. When the second string is encountered during traversal, the second-length string following the second string is determined as the port number in the network proxy configuration information. When the third string is encountered during traversal, the third-length string following the third string is determined as the most recent usage time of the network proxy configuration information.

4. The method according to claim 1, characterized in that, The step of calling the network API of the system where the application resides based on the target network proxy configuration information includes: Upon receiving a connection request, the system network API is invoked based on the network address and port number of the proxy device in the target network proxy configuration information; or... Upon receiving a save and connect request, the system network API is invoked based on the network address and port number of the proxy device in the target network proxy configuration information, and the network address and port number of the proxy device are saved to the configuration file.

5. The method according to claim 1, characterized in that, After invoking the network API of the system where the application resides based on the target network proxy configuration information, the method further includes: During the display of the network proxy configuration page, upon receiving a first deletion instruction for the unique identifier of any proxy device in the network proxy configuration page, the unique identifier of the arbitrary proxy device in the network proxy configuration page is deleted, and the network proxy configuration information of the arbitrary proxy device in the configuration file is saved. The deleted unique identifier is not displayed in the network proxy configuration page. Upon receiving a first recovery instruction for the unique identifier of the arbitrary proxy device, the unique identifier is recovered according to the network proxy configuration information in the configuration file, wherein the recovered unique identifier is displayed on the network proxy configuration page; If the first recovery command is not received within a certain period of time, the network proxy configuration information of the arbitrary proxy device in the configuration file will be deleted.

6. The method according to claim 1, characterized in that, After invoking the network API of the system where the application resides based on the target network proxy configuration information, the method further includes: During the display of the network proxy configuration page, upon receiving a second deletion instruction for the unique identifier of any proxy device in the network proxy configuration page, the unique identifier of any proxy device in the network proxy configuration page is displayed in a different display mode, and the network proxy configuration information of any proxy device in the configuration file is deleted; Upon receiving a second recovery command for the unique identifier of the arbitrary proxy device, the unique identifier of the arbitrary proxy device is restored to its original display mode, and the network proxy configuration information of the arbitrary proxy device is saved to the configuration file; If the second recovery command is not received within a certain period of time, the unique identifier of the arbitrary agent device is deleted.

7. A network configuration device for an application, characterized in that, include: The determination module is used to determine the target proxy device through the network proxy configuration page of the application, wherein the network proxy configuration page of the application is independent of the system network proxy configuration page of the system in which the application is located. The lookup module is used to look up the target network proxy configuration information of the target proxy device from multiple network proxy configuration information, wherein the network proxy configuration information includes at least the network address and port number of the proxy device; The configuration module is used to call the network API of the system where the application is located based on the target network proxy configuration information, so that the application can transmit data with the data server through the target proxy device; The device further includes: upon receiving a test instruction, determining the proxy devices in the proxy device list corresponding to the test instruction as the current proxy device, and performing the following operations one by one: determining the network proxy configuration information of the current proxy device as the target network proxy configuration information; controlling the application to transmit data to the data server through the current proxy device according to the test order and / or test time period of the current proxy device in the test instruction; performing packet capture operation on the application, and determining the size of the data transmitted through the current proxy device to the data server based on the performance of the current proxy device.

8. An electronic device, characterized in that, include: At least one communication interface; At least one bus connected to the at least one communication interface; At least one processor connected to the at least one bus; At least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor executes the computer program to implement the method of any one of claims 1 to 6.

9. A computer-readable storage medium storing computer-executable instructions for performing the method of any one of claims 1 to 6 of this application.