CN117714283A - Network configuration method and device of application program, storage medium and electronic equipment - Google Patents

Network configuration method and device of application program, storage medium and electronic equipment Download PDF

Info

Publication number
CN117714283A
CN117714283A CN202310834903.9A CN202310834903A CN117714283A CN 117714283 A CN117714283 A CN 117714283A CN 202310834903 A CN202310834903 A CN 202310834903A CN 117714283 A CN117714283 A CN 117714283A
Authority
CN
China
Prior art keywords
proxy
network
configuration information
configuration
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310834903.9A
Other languages
Chinese (zh)
Inventor
范秀山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Perfect Lingxi Technology Co ltd
Original Assignee
Beijing Perfect Lingxi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Perfect Lingxi Technology Co ltd filed Critical Beijing Perfect Lingxi Technology Co ltd
Priority to CN202310834903.9A priority Critical patent/CN117714283A/en
Publication of CN117714283A publication Critical patent/CN117714283A/en
Pending legal-status Critical Current

Links

Abstract

The application relates to a network configuration method and device of an application program, a storage medium and electronic equipment. The method comprises the following steps: determining target agent equipment through a network agent configuration page of an application program, wherein the network agent configuration page of the application program is independent of a system network agent configuration page of a system in which the application program is positioned; searching target network proxy configuration information of the target proxy equipment from a plurality of network proxy configuration information, wherein the network proxy configuration information at least comprises a network address of the proxy equipment and a port number of the proxy equipment; and calling a network API of a system where the application program is located according to the target network proxy configuration information so that the application program transmits data with a data server through the target proxy equipment. The method and the device solve the technical problems of inconvenient network environment switching and low efficiency in the development and application process.

Description

Network configuration method and device of application program, storage medium and electronic equipment
Technical Field
The present invention relates to the field of network communications, and in particular, to a network configuration method and apparatus for an application program, a storage medium, and an electronic device.
Background
In the prior art, in the process of developing an application program by a developer, a packet capturing software is often required to be connected to perform packet capturing operations under different network environments for the application program, so frequent switching of the network environments used by the application program is involved. Generally, such switching of network environments is achieved by manually setting network parameters of the system, which is complicated, inflexible and inefficient to operate.
Disclosure of Invention
The application provides a network configuration method and device of an application program, a storage medium and electronic equipment, and aims to solve the technical problems that switching network environments is inconvenient and efficiency is low in the development and application process.
In a first aspect, the present application provides a network configuration method of an application program, including: determining target agent equipment through a network agent configuration page of an application program, wherein the network agent configuration page of the application program is independent of a system network agent configuration page of a system in which the application program is positioned; searching target network proxy configuration information of the target proxy equipment from a plurality of network proxy configuration information, wherein the network proxy configuration information at least comprises a network address of the proxy equipment and a port number of the proxy equipment; and calling the network API of the system where the application program is located according to the target network proxy configuration information so that the application program transmits data with the data server through the target proxy equipment.
As an optional example, the above-mentioned determining, by the network proxy configuration page of the application program, the target proxy device includes: displaying unique identifiers of the proxy equipment on the network proxy configuration page according to the priority, wherein the closer the latest use time point of the network proxy configuration information of the proxy equipment is to the current time point, the higher the priority of the unique identifiers of the proxy equipment is; and when receiving the selection instruction, determining the proxy equipment indicated by the selection instruction as the target proxy equipment.
As an alternative example, the method further includes: when the proxy configuration corresponding to the application program is not used by the network proxy configuration page, determining the system proxy configuration of the system where the application program is located, connecting the system proxy equipment through the system proxy configuration, and transmitting data to a data server; or when the network proxy configuration page determines that the proxy configuration corresponding to the application program is not used, the data transmission is performed through direct connection with the data server.
As an optional example, the controlling the application program to transmit data with the data server through the current proxy device according to the test sequence and/or the test period of the current proxy device in the test instruction includes: and determining the size of the data transmitted by the current proxy equipment and the data server according to the performance of the current proxy equipment.
As an optional example, before determining the size of the data transmitted through the current proxy device and the data server according to the performance of the current proxy device, the method further includes: forwarding a predetermined number of test data packets of a predetermined size to the data server via the current proxy device; recording the average forwarding time length of the current proxy equipment; and determining the performance of the current proxy equipment according to the average forwarding time length.
As an optional example, before determining the size of the data transmitted through the current proxy device and the data server according to the performance of the current proxy device, the method further includes: forwarding a predetermined number of test data packets with different sizes to the data server through the current proxy device; recording the forwarding time length of the current proxy equipment for each size of test data packet; and determining the performance of the current proxy equipment according to the forwarding time length.
In a second aspect, the present application provides a network configuration device for an application program, including: the determining module is used for determining the target agent equipment through the network agent configuration page of the application program, wherein the network agent configuration page of the application program is independent of the system network agent configuration page of the system where the application program is located; the searching module is used for searching the target network proxy configuration information of the target proxy equipment from a plurality of network proxy configuration information, wherein the network proxy configuration information at least comprises a network address of the proxy equipment and a port number of the proxy equipment; and the setting module is used for calling the network API of the system where the application program is located according to the target network proxy configuration information so that the application program can transmit data with the data server through the target proxy equipment.
As an optional example, the above-mentioned search module includes: the searching unit is used for searching a plurality of network proxy configuration information from a storage area corresponding to the network proxy configuration page in the local storage when the network proxy configuration page is displayed, and determining the target network proxy configuration information from the searched plurality of network proxy configuration information; an obtaining unit, configured to obtain an imported configuration file and determine the target network proxy configuration information from a plurality of network proxy configuration information in the configuration file, where the local storage does not include the plurality of network proxy configuration information; or if the local storage does not include the plurality of network proxy configuration information, acquiring the input target network proxy configuration information.
As an optional example, the above-mentioned search module further includes: the traversing unit is used for traversing codes in the configuration file after the imported configuration file is acquired; under the condition of traversing to the first character string, determining the character string with the first length after the first character string as a device network address in network agent configuration information; determining a character string with a second length after the second character string as a port number in the network agent configuration information under the condition of traversing to the second character string; and determining a character string with a third length after the third character string as the most recently used time point of the network agent configuration information when traversing to the third character string.
As an optional example, the determining module includes: a determining unit, configured to display, on the network proxy configuration page according to the priority, a unique identifier of the proxy device, where the closer the most recently used time point of the network proxy configuration information of the proxy device is to the current time point, the higher the priority of the unique identifier of the proxy device is; and when receiving the selection instruction, determining the proxy equipment indicated by the selection instruction as the target proxy equipment.
As an alternative example, the setting module includes: a setting unit, configured to call a system network configuration API according to the network address of the proxy device and the port number of the proxy device in the target network proxy configuration information when receiving the connection request; or under the condition of receiving the save and connect request, calling a system network configuration API according to the network address of the proxy equipment and the port number of the proxy equipment in the target network proxy configuration information, and saving the network address of the proxy equipment and the port number of the proxy equipment into a configuration file.
As an alternative example, the above apparatus further includes: the first processing module is used for deleting the unique identification of any proxy device in the network proxy configuration page and saving the network proxy configuration information of the any proxy device in a configuration file when a first deleting instruction of the unique identification of any proxy device in the network proxy configuration page is received in the process of displaying the network proxy configuration page after the network API of the system where the application program is located is called according to the target network proxy configuration information; under the condition that a first recovery instruction for the unique identification of any proxy device is received, recovering the unique identification according to the network proxy configuration information in the configuration file, wherein the recovered unique identification is displayed in the network proxy configuration page; and deleting the network proxy configuration information of any proxy device in the configuration file under the condition that the first recovery instruction is not received within a period of time.
As an alternative example, the above apparatus further includes: the second processing module is used for displaying the unique identification of any proxy device in the network proxy configuration page in different display modes and deleting the network proxy configuration information of any proxy device in the configuration file under the condition that a second deleting instruction of the unique identification of any proxy device in the network proxy configuration page is received in the process of displaying the network proxy configuration page after the network API of the system where the application program is positioned is called according to the target network proxy configuration information; under the condition that a second recovery instruction for the unique identification of any proxy equipment is received, recovering the unique identification of the any proxy equipment to an original display mode, and storing network proxy configuration information of the any proxy equipment into the configuration file; and deleting the unique identification of any proxy equipment under the condition that the second recovery instruction is not received within a period of time.
As an alternative example, the above apparatus further includes: the third processing module is used for determining the system agent configuration of the system where the application program is located when the agent configuration corresponding to the application program is not used through the network agent configuration page, connecting the system agent device through the system agent configuration, and carrying out data transmission on the data server; or when the network proxy configuration page determines that the proxy configuration corresponding to the application program is not used, the data transmission is performed through direct connection with the data server.
As an alternative example, the above apparatus further includes: the testing module is used for determining the proxy equipment in the proxy equipment list corresponding to the testing instruction as the current proxy equipment under the condition of receiving the testing instruction, and executing the following operations one by one: determining the network proxy configuration information of the current proxy equipment as the target network proxy configuration information; controlling the application program to transmit data with the data server through the current proxy equipment according to the test sequence and/or test time period of the current proxy equipment in the test instruction; and executing the packet grabbing operation on the application program.
As an alternative example, the test module includes: and the data determining unit is used for determining the size of the data transmitted by the current proxy equipment and the data server according to the performance of the current proxy equipment.
As an alternative example, the test module further includes: a first performance determining unit configured to forward, by the current proxy device, a predetermined number of test packets of a predetermined size to the data server before determining the size of data transmitted by the current proxy device and the data server according to the performance of the current proxy device; recording the average forwarding time length of the current proxy equipment; and determining the performance of the current proxy equipment according to the average forwarding time length.
As an alternative example, the test module further includes: a second performance determining unit, configured to forward, by the current proxy device, a predetermined number of test data packets having different sizes to the data server before determining the size of the data transmitted by the current proxy device and the data server according to the performance of the current proxy device; recording the forwarding time length of the current proxy equipment for each size of test data packet; and determining the performance of the current proxy equipment according to the forwarding time length.
In a third aspect, the present application provides an electronic device, including: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; and at least one memory coupled to the at least one bus, wherein the memory stores a computer program, and wherein the processor is configured to implement the network configuration method of the application program when the computer program is executed.
In a fourth aspect, the present application further provides a computer storage medium storing computer executable instructions for executing the network configuration method of the application program.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method provided by the embodiment of the application program, the target agent equipment is determined through the network agent configuration page of the application program, then the network API of the system where the application program is located can be called through the searched target network agent configuration information of the target agent equipment, so that the target agent equipment is accessed by using the target network agent configuration information, and the data is transmitted through the target agent equipment and the data server, so that the purpose of flexibly, quickly and efficiently switching network environments is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to be taken in a limiting sense, unless otherwise indicated.
Fig. 1 is a flow chart of a network configuration method of an application according to an embodiment of the present application;
fig. 2 is a flowchart of another network configuration method of an application according to an embodiment of the present application;
fig. 3 is a flowchart of a network configuration method of another application provided in an embodiment of the present application;
fig. 4 is a system schematic diagram of a network configuration method of an application according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a network configuration device of an application according to an embodiment of the present application;
fig. 6 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present application based on the embodiments herein.
The following disclosure provides many different embodiments, or examples, for implementing different structures of the invention. In order to simplify the present disclosure, components and arrangements of specific examples are described below. They are, of course, merely examples and are not intended to limit the invention. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed.
Fig. 1 is a flowchart of a network configuration method of an application according to an embodiment of the present application. As shown in fig. 1, the network configuration method of the application program includes:
s102, determining target agent equipment through a network agent configuration page of an application program, wherein the network agent configuration page of the application program is independent of a system agent configuration page of a system in which the application program is positioned;
s104, searching target network proxy configuration information of target proxy equipment from a plurality of network proxy configuration information, wherein the network proxy configuration information at least comprises a network address of the proxy equipment and a port number of the proxy equipment;
s106, calling a network API of a system where the application program is located according to the target network proxy configuration information so that the application program transmits data with the data server through the target proxy equipment.
In this embodiment, the network proxy configuration page of the application is independent of the system network proxy configuration page of the system where the application is located. The network proxy configuration page may be one of the pages of the application program, or may be a page that can be jumped to by the application program, on which the target proxy device may be selected. The selection target proxy device may select one from a plurality of proxy devices for the user. When the selected target proxy device is determined, the background may look up the target network proxy configuration information of the target proxy device from the network proxy configuration information. Each proxy device corresponds to network proxy configuration information, and the network proxy configuration information may include a network address, a port number, a latest use time point, and the like of the proxy device. After the target network proxy configuration information of the target proxy equipment is found, the network API of the system where the application program is located is called according to the target network proxy configuration information. The system where the application program is located may be a physical terminal or an operating system on a cloud host. Accessing the target proxy device according to the target network proxy configuration information, and transmitting data through the target proxy device and the data server.
In general, the network proxy configuration of an application is implemented through a system network proxy configuration page of the system in which the application is located, and the configuration implemented in the system network proxy configuration page will be effective for all applications of the system, i.e. all applications running on the system will use proxy information of the page to perform network communication. In the method, a network proxy configuration page which is only effective for a certain application program is provided outside the system network proxy configuration page, and the configuration of the network proxy configuration page is only effective for the application program, namely, when the configuration of the configuration page is selected for network access, the corresponding proxy configuration is only effective for the certain application program, and the effective configuration does not influence the configuration information in the system network proxy configuration page, namely, other application programs are not influenced to select the configuration of the system network proxy configuration page for network access.
For example, under the scheme of the present application, if there are two applications in a certain system, one of which uses the network proxy configuration page of the application to configure the proxy device a, and the other uses the system network proxy configuration page to configure the proxy device B, the two applications may use the proxy device a and the proxy device B to perform network communication simultaneously, respectively.
In this embodiment, after the network API of the system is called according to the network configuration information of the target proxy device, the application may access the target proxy device through the network parameter defined by the network information, and then transmit data through the target proxy device and the data server. The data server may provide services for applications on the system, with proxy services provided by the target proxy device between the system and the data server.
According to the method provided by the embodiment of the application program, the target agent equipment is determined through the network agent configuration page of the application program, then the network configuration corresponding to the application program can be set through the target network agent configuration information of the target agent equipment, and the set network configuration is used for connecting the agent equipment to transmit data with the data server, so that the purpose of flexibly, rapidly and efficiently switching network environments is achieved.
As an alternative example, as shown in fig. 2, searching for the target network proxy configuration information of the target proxy device from the plurality of network proxy configuration information includes:
s202, when a network proxy configuration page is displayed, searching a plurality of network proxy configuration information from a storage area corresponding to the network proxy configuration page in a local storage, and determining target network proxy configuration information from the searched plurality of network proxy configuration information;
S204, under the condition that the local storage does not comprise a plurality of network agent configuration information, acquiring an imported configuration file, and determining target network agent configuration information from the plurality of network agent configuration information in the configuration file; or in the case that the local storage does not include a plurality of network proxy configuration information, acquiring the input target network proxy configuration information.
In this embodiment, the network proxy configuration information may be stored locally in advance, or imported by way of an import file. If pre-stored locally, the target network proxy configuration information may be looked up locally. If the network proxy configuration information is not stored locally, the user may be notified to conduct the file import. The file stores the proxy equipment and the corresponding network proxy configuration information. And searching the configuration information of the target network proxy through the imported file. If the network proxy configuration information is not stored locally and is not obtained by means of file import, the user can input the target network proxy configuration information in the page.
In this embodiment, the locally stored network proxy configuration information may have different storage areas according to different network proxy configuration pages of the application program, so as to implement that different application program configuration pages correspond to different network proxy configuration information (or network proxy configuration files).
As an optional example, after obtaining the imported configuration file, the method further includes: traversing the code in the configuration file; under the condition of traversing to the first character string, determining the character string with the first length after the first character string as a device network address in the network agent configuration information; under the condition of traversing to the second character string, determining the character string with the second length after the second character string as a port number in the network proxy configuration information; and in the case of traversing to the third character string, determining the character string with the third length after the third character string as the most recently used time point of the network agent configuration information.
In this embodiment, if the network proxy configuration information is not locally provided, but is imported by importing the network proxy configuration information in a file importing manner, the imported configuration file is traversed, and the code therein is traversed, so as to obtain the network proxy configuration information.
In the process of traversing the code, the keyword can be traversed, and the keyword is used for marking whether the character after the keyword is a network address, a port number, a latest use time point or other codes. If the network proxy configuration information traverses to the keywords for marking the network address, the port number and the latest use time point, the character strings with the corresponding lengths are obtained from the keywords and used as the network proxy configuration information. The network address, port number, and the length of the most recently used time point are different. For example, the port number may be a 4-bit number such as XXXX, the network address may be a four-segment number such as XXX.XXX.X.X.
As an alternative example, as shown in fig. 3, determining a target agent device through a web agent configuration page of an application program includes:
s302, displaying unique identifiers of the proxy equipment on a network proxy configuration page according to the priority, wherein the closer the latest use time point of the network proxy configuration information of the proxy equipment is to the current time point, the higher the priority of the unique identifiers of the proxy equipment is;
s304, when receiving the selection instruction, determining the proxy device indicated by the selection instruction as a target proxy device.
In this embodiment, the unique identifier of the proxy device may be displayed in the network proxy configuration page, where the unique identifier may be a unique identifier number of the proxy device, an image identifier of the proxy device, or an icon identifier of the proxy device. By displaying the unique identification by priority, one proxy device can be selected by the user as the target proxy device. The priority may be sorted from front to back or back to front by the most recently used time point, or sorted by name, etc.
As an alternative example, invoking the network API of the system in which the application is located in accordance with the target network proxy configuration information includes: under the condition of receiving a connection request, calling a system network configuration API according to the network address of the proxy equipment and the port number of the proxy equipment in the target network proxy configuration information; or under the condition of receiving the save and connect request, calling a system network configuration API according to the network address of the proxy equipment and the port number of the proxy equipment in the target network proxy configuration information, and saving the network address of the proxy equipment and the port number of the proxy equipment into a configuration file, namely saving the network address and the port number of the proxy equipment into the network proxy configuration information (or the network proxy configuration file) corresponding to the application program.
In this embodiment, after the target network proxy device is determined, and the target network proxy configuration information is also determined, the target proxy device may be connected through the target network proxy configuration information. When the target proxy device is connected, the network address of the proxy device in the network configuration corresponding to the application program can be replaced by the target network address in the target network proxy configuration information, and the port number of the proxy device in the network configuration corresponding to the application program can be replaced by the target port number in the target network proxy configuration information. The network address and port number in the network configuration corresponding to the application may be different from the system network proxy configuration of the system in which the application is located. The user can also choose to use the system network agent to perform network communication, namely, the network agent configuration information is set through the setting function of the system, the two settings are mutually independent, mutually exclusive (only one can perform network communication) for the same application program, and compatible (different application programs respectively select two settings to perform network communication) for different application programs.
After the application network proxy configuration page determines the target network proxy configuration information, the user may select a connection and store the connection, if the connection is selected, use the corresponding network configuration to perform network communication, and if the connection is selected and store the connection, use the corresponding network configuration to perform network communication and store the target network proxy configuration information into a local configuration file.
As an alternative example, after calling the network API of the system where the application program is located according to the target network proxy configuration information, the method further includes: in the process of displaying the network proxy configuration page, under the condition that a first deleting instruction of the unique identifier of any proxy device in the network proxy configuration page is received, deleting the unique identifier of any proxy device in the network proxy configuration page, and storing 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; under the condition that a first recovery instruction for the unique identification of any proxy equipment is received, recovering the unique identification according to the network proxy configuration information in the configuration file, wherein the recovered unique identification is displayed in a network proxy configuration page; and deleting the network proxy configuration information of any proxy device in the configuration file under the condition that the first recovery instruction is not received within a period of time.
In this embodiment, the unique identifier of the proxy device in the network proxy configuration page may be managed. Management includes adding, deleting, checking and modifying. The network proxy configuration information can be input by the adding operation, the unique identification is added, the network proxy configuration information can be stored in a local configuration file, the searching operation can be inquired through a keyword, and the modifying operation is to modify the configuration information in the configuration file or modify the unique identification. The deleting operation can delete the unique identifier, and the user cannot see the unique identifier in the foreground, so that the network proxy configuration information corresponding to the unique identifier is not determined to be the target network proxy configuration information. But deleting the unique identifier may preserve the network proxy configuration information in the configuration file, and if an instruction to restore the unique identifier is received, restore the unique identifier. The recovered unique identification may be displayed in a network proxy configuration page. If no recovery instruction is received within a period of time, the user is indicated to delete the unique identification and the corresponding network agent configuration information. The network proxy configuration information corresponding to the unique identification in the local configuration file is deleted.
As an optional example, after setting the target network proxy configuration information to the network configuration of the system in which the application program is located, the method further includes: in the process of displaying the network proxy configuration page, under the condition that a second deleting instruction of the unique identification of any proxy equipment in the network proxy configuration page is received, displaying the unique identification of any proxy equipment in the network proxy configuration page in different display modes, and deleting the network proxy configuration information of any proxy equipment in the configuration file; under the condition that a second recovery instruction for the unique identification of any proxy equipment is received, recovering the unique identification of any proxy equipment to the original display mode, and storing the network proxy configuration information of any proxy equipment into a configuration file; and deleting the unique identification of any proxy device under the condition that the second recovery instruction is not received within a period of time.
In this embodiment, the network proxy configuration information in the configuration file may be deleted. If the network proxy configuration information in the configuration file is deleted, the unique identification in the network proxy configuration page is displayed in a different pattern from the other unique identifications, thereby prompting 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 local configuration file does not have corresponding network proxy configuration information. User input or importation is required. If the user recovers the network agent configuration information corresponding to the unique identifier within a period of time, the display form of the unique identifier is recovered to be the same, and the network agent configuration information corresponding to the unique identifier is stored in the configuration file. If the network proxy configuration information corresponding to the unique identifier is not recovered within a period of time, the unique identifier is also deleted.
As an alternative example, the method further includes: when the proxy configuration corresponding to the application program is not used through the network proxy configuration page, determining the proxy configuration of the system, connecting the proxy equipment of the system through the proxy configuration of the system, and carrying out data transmission on the data server; or when the network proxy configuration page determines that the proxy configuration corresponding to the application program is not used, the data transmission is performed through direct connection with the data server.
In this embodiment, the user may choose not to use the proxy configuration corresponding to the application program, for example, use the system proxy configuration, and may access the system proxy device through the system configuration information, so as to transmit data through the system proxy device and the data server. Or may connect directly with the data server for network communication if the application's corresponding proxy configuration is not used. Taking three application programs as an example, the application program 1 determines the target agent device through a network agent configuration page in the application program, and obtains the target network agent configuration information of the target agent device, so that the application program 1 can call the network API of the system through the target network agent configuration information, and access the target agent device corresponding to the target network agent configuration information through the network API. And the application 2 accesses the corresponding system agent device through the system agent configuration information using the system agent configuration information. The application 3 does not use a proxy device but chooses to connect directly to the data server. It should be noted that, the application programs 2 and 3 may call the same network API as the application program 1 or may call a different network API to implement access connection with the proxy device/data server, and if the same API is called, different processes of the same API are started to provide network services for different application programs. The 3 applications may interact data with the data server in parallel.
As an alternative example, the method further includes: under the condition that the test instruction is received, determining the proxy equipment in the proxy equipment list corresponding to the test instruction as current proxy equipment, and executing the following operations one by one: determining network proxy configuration information of the current proxy equipment as target network proxy configuration information; the control application program transmits data with the data server through the current proxy equipment according to the test sequence and/or test time period of the current proxy equipment in the test instruction; and executing the packet grabbing operation on the application program.
In this embodiment, a plurality of agent devices may be tested by one key. The user can select a plurality of proxy devices, and after the plurality of proxy devices are selected, each proxy device can be tested according to the sequence and/or time period decided by the user, namely, each proxy device is used as a target proxy device to transmit data with the data server, and the packet grabbing operation is performed on the application program in the process. Thereby generating a test result for each proxy device.
As an alternative example, the controlling the application program to transmit data with the data server through the current proxy device according to the test sequence and/or the test period of the current proxy device in the test instruction includes: the size of the data transmitted through the current proxy device and the data server is determined based on the capabilities of the current proxy device.
In this embodiment, when testing the proxy device, the size of the transmitted data packet for testing may be determined according to the performance of the proxy device, where the sizes of the data packets are different if the performance is different. The data packet may be provided with a minimum value and a maximum value, and the data packet may be appropriately sized between the maximum value and the minimum value according to the performance.
As an alternative example, before determining the size of the data transmitted through the current proxy device and the data server according to the performance of the current proxy device, the method further includes: forwarding a predetermined number of test data packets of a predetermined size to the data server by the current proxy device; recording the average forwarding time length of the current proxy equipment; and determining the performance of the current proxy equipment according to the average forwarding time length.
In this embodiment, the performance of the proxy device may be determined by sending test packets. For a predetermined number of test packets of a predetermined size, forwarding may be performed by the proxy device and the forwarding duration of each test packet may be recorded. And (5) averaging the forwarding time to obtain the average forwarding time. An average forwarding duration for a size of data packet may be determined. The average forwarding time length of the data packets with different sizes is different, and the data packet size with the shortest average forwarding time length is selected as the forwarded data packet size used in the packet grabbing operation. In addition, the size of the data packet corresponding to the specific forwarding time length of the average forwarding time length can be selected, for example, the size of the data packet with the average forwarding time length of 10 milliseconds, or the size of the data packet with the minimum ratio of the data packet size to the forwarding time length.
As an alternative example, before determining the size of the data transmitted through the current proxy device and the data server according to the performance of the current proxy device, the method further includes: forwarding a predetermined number of test data packets with different sizes to a data server through the current proxy equipment; recording the forwarding time length of the current proxy equipment for each size of test data packet; and determining the performance of the current proxy equipment according to the forwarding time length.
In this embodiment, the performance of the proxy device may be determined by sending test packets. For test data packets with different sizes, respectively recording the forwarding time length of each size, and selecting the data packet with the minimum forwarding time length or the data packet with the forwarding time length of a certain specific value as the size of the forwarded data packet in the packet grabbing operation process.
Fig. 4 is a schematic diagram of an alternative system of the present embodiment. Taking Application as mobile phone Application, system as apple operating system (IOS), the Application is to interact with service end, when using proxy device, selecting one proxy device from multiple proxy devices, then determining configuration information of selected proxy device from local proxy device IP address list information, finally calling network API of system where Application program is located according to configuration information of selected proxy device to access proxy device, sending data to proxy device, and forwarding data to data service end by proxy device.
With this embodiment, the user does not need to jump to the system setup page, but rather starts the network proxy configuration directly at the in-application network proxy configuration page. Assuming that proxy device a is to be connected to fulfill the packet-grabbing request, the application proxy configuration page loads a locally-saved, previously-connected proxy configuration list, and the latest-used proxy configuration information is preferentially displayed according to the use time of network configuration in the list. If the local does not have proxy configuration information, the application proxy configuration list also supports external import, the import file is in json format, the format content is as follows, the whole is the format of a device array, proxyName represents the name of proxy device, ip represents the device network address, port device proxy software port, lastUsedTime is the last proxy software use time.
If the current configuration list contains the address and port of the proxy device A device, the network proxy connection can be automatically completed by directly selecting the configuration information. If the current list does not contain information for the A device, the user is required to manually enter the address and port of the A device. After the IP address and port of the A device are input, the options of 'connection' and 'save and connect' are displayed, the information of the A device cannot be saved by clicking the options, and the IP address and port information of the A agent and the current time for using the A agent are saved in a local agent configuration list by clicking the options of saving and connecting.
The application may use code to make a network proxy setting of the proxy IP address through an application programming interface (Application Programming Interface, API) provided by the iOS system.
let proxyhost= "proxy a address"
let proxyport= "proxy a port"
sessionConfig=URLSessionConfiguration.default
sessionConfig.connectionProxyDictionary=[
kCFNetworkProxiesHTTPEnable:true,
kCFNetworkProxiesHTTPProxy:proxyHost,
kCFNetworkProxiesHTTPPort:proxyPort,
"HTTPSEnable":true,
"HTTPSProxy":proxyHost,
"HTTPSPort":proxyPort
]
The user may choose to connect to another proxy device through the process described above. If the user wants to delete a certain proxy configuration information, after reading the proxy configuration information list permanently stored locally, the user can delete the certain configuration information in the current list, then delete the information in the local configuration list, and the next time the user loads the proxy information which is deleted before in the local list again. The deletion form of the plurality of unique identifiers or the network agent configuration information is also included, and is described above and not described herein.
If the user does not want to use the network agent configuration information in the application, the user is also provided with the option of using the system agent if the user wants to select the system agent, which can be configured directly by the following code.
var sessionConfig=URLSessionConfiguration.default
If the user wants to bypass the agent of the current network, the user can select the option of directly connecting the agent, which can be specifically configured by the following codes. The direct connection can be directly connected with the data server without forwarding by proxy equipment.
var sessionConfig=URLSessionConfiguration.default
configuration.connectionProxyDictionary=[:]
All of the above operations are done directly within the application and do not require a jump to the system settings for configuration. By providing the mode of configuration in the application and closing the HTTP network proxy, the complex process of repeatedly jumping to the system setting for configuration is simplified, and meanwhile, the proxy is only enabled to take effect aiming at the current application, so that the network proxy configuration is more flexible. In addition, by providing a local caching mechanism for the input proxy address and a mode of importing configuration information externally, the problem that the user repeatedly inputs the same IP address and port when repeatedly using the same proxy is solved, and the user can directly fill the input proxy information by clicking the input proxy information. And the system proxy can be automatically saved and the one-key switching proxy address is supported, so that the user can quickly switch back and forth in a plurality of proxy configurations, and finally, the system proxy and the direct connection mode are provided, so that the application can walk the system proxy and bypass the system proxy to directly connect the proxy.
Fig. 5 is a schematic structural diagram of a network configuration device of an application according to an embodiment of the present application. As shown in fig. 5, the network configuration device of the application program includes:
A determining module 502, configured to determine, through a network proxy configuration page of an application program, a target proxy device, where the network proxy configuration page of the application program is independent of a system network proxy configuration page of a system where the application program is located;
a searching module 504, configured to search target network proxy configuration information of the target proxy device from a plurality of network proxy configuration information, where the network proxy configuration information at least includes a network address of the proxy device and a port number of the proxy device;
and the setting module 506 is configured to call a network API of a system where the application program is located according to the target network proxy configuration information, so that the application program transmits data with the data server through the target proxy device.
In this embodiment, the network proxy configuration page of the application is independent of the system network proxy configuration page of the system where the application is located. The network proxy configuration page may be one of the pages of the application program, or may be a page that can be jumped to by the application program, on which the target proxy device may be selected. The selection target proxy device may select one from a plurality of proxy devices for the user. When the selected target proxy device is determined, the background may look up the target network proxy configuration information of the target proxy device from the network proxy configuration information. Each proxy device corresponds to network proxy configuration information, and the network proxy configuration information may include a network address, a port number, a latest use time point, and the like of the proxy device. After the target network proxy configuration information of the target proxy equipment is found, the network API of the system where the application program is located is called according to the target network proxy configuration information. The system where the application program is located may be a physical terminal or an operating system on a cloud host. Accessing the target proxy device according to the target network proxy configuration information, and transmitting data through the target proxy device and the data server.
In general, the network proxy configuration of an application is implemented through a system network proxy configuration page of the system in which the application is located, and the configuration implemented in the system network proxy configuration page will be effective for all applications of the system, i.e. all applications running on the system will use proxy information of the page to perform network communication. In the method, a network proxy configuration page which is only effective for a certain application program is provided outside the system network proxy configuration page, and the configuration of the network proxy configuration page is only effective for the application program, namely, when the configuration of the configuration page is selected for network access, the corresponding proxy configuration is only effective for the certain application program, and the effective configuration does not influence the configuration information in the system network proxy configuration page, namely, other application programs are not influenced to select the configuration of the system network proxy configuration page for network access.
For example, under the scheme of the present application, if there are two applications in a certain system, one of which uses the network proxy configuration page of the application to configure the proxy device a, and the other uses the system network proxy configuration page to configure the proxy device B, the two applications may use the proxy device a and the proxy device B to perform network communication simultaneously, respectively.
In this embodiment, after the network API of the system is called according to the network configuration information of the target proxy device, the application may access the target proxy device through the network parameter defined by the network information, and then transmit data through the target proxy device and the data server. The data server may provide services for applications on the system, with proxy services provided by the target proxy device between the system and the data server.
According to the method provided by the embodiment of the application program, the target agent equipment is determined through the network agent configuration page of the application program, then the network configuration corresponding to the application program can be set through the target network agent configuration information of the target agent equipment, and the set network configuration is used for connecting the agent equipment to transmit data with the data server, so that the purpose of flexibly, rapidly and efficiently switching network environments is achieved.
For other examples of this embodiment, please refer to the above method examples, and further description is omitted herein.
As shown in fig. 6, the embodiment of the present application provides an electronic device, which includes 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 perform communication with each other through the communication bus 114,
A memory 113 for storing a computer program;
in one embodiment of the present application, the processor 111 is configured to implement the network configuration method of the application program provided in any one of the foregoing method embodiments when executing the program stored in the memory 113, where the method includes:
determining target agent equipment through a network agent configuration page of an application program, wherein the network agent configuration page of the application program is independent of a system agent configuration page of a system in which the application program is positioned;
searching target network proxy configuration information of target proxy equipment from a plurality of network proxy configuration information, wherein the network proxy configuration information at least comprises a network address of the proxy equipment and a port number of the proxy equipment;
and calling a network API of a system where the application program is located according to the target network proxy configuration information so that the application program transmits data with the data server through the target proxy equipment.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a network configuration method of providing an application program according to any of the method embodiments described above.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
From the above description of embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus a general purpose hardware platform, or may be implemented by hardware. Based on such understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the related art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the method described in the respective embodiments or some parts of the embodiments.
It is to be understood that the terminology used herein is for the purpose of describing particular example embodiments only, and is not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises," "comprising," "includes," "including," and "having" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and/or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order described or illustrated, unless an order of performance is explicitly stated. It should also be appreciated that additional or alternative steps may be used.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A network configuration method of an application program, comprising:
determining target agent equipment through a network agent configuration page of an application program, wherein the network agent configuration page of the application program is independent of a system network agent configuration page of a system where the application program is located;
searching target network proxy configuration information of the target proxy equipment from a plurality of network proxy configuration information, wherein the network proxy configuration information at least comprises a network address of the proxy equipment and a port number of the proxy equipment;
and calling a network API of a system where the application program is located according to the target network proxy configuration information so that the application program transmits data with a data server through the target proxy equipment.
2. The method of claim 1, wherein the searching for the target network proxy configuration information of the target proxy device from the plurality of network proxy configuration information comprises:
searching a plurality of network proxy configuration information from a storage area corresponding to the network proxy configuration page in a local storage when the network proxy configuration page is displayed, and determining the target network proxy configuration information from the searched plurality of network proxy configuration information;
under the condition that the local storage does not comprise the plurality of network agent configuration information, acquiring an imported configuration file, and determining the target network agent configuration information from the plurality of network agent configuration information in the configuration file; or if the local storage does not include the plurality of network proxy configuration information, acquiring the input target network proxy configuration information.
3. The method of claim 2, wherein after obtaining the imported configuration file, the method further comprises:
traversing the codes in the configuration file;
under the condition of traversing to a first character string, determining the character string with a first length after the first character string as a device network address in network agent configuration information;
Under the condition of traversing to a second character string, determining the character string with a second length after the second character string as a port number in the network agent configuration information;
and in the case of traversing to the third character string, determining the character string with the third length after the third character string as the most recently used time point of the network agent configuration information.
4. The method of claim 1, wherein the invoking the network API of the system in which the application is located based on the target network proxy configuration information comprises:
under the condition of receiving a connection request, calling a system network API according to the network address of the proxy equipment and the port number of the proxy equipment in the target network proxy configuration information; or alternatively
And under the condition of receiving a save and connect request, calling a system network API according to the network address of the proxy equipment and the port number of the proxy equipment in the target network proxy configuration information, and saving the network address of the proxy equipment and the port number of the proxy equipment into a configuration file.
5. The method of claim 1, wherein after invoking the network API of the system in which the application is located in accordance with the target network proxy configuration information, the method further comprises:
In the process of displaying the network proxy configuration page, under the condition that a first deleting instruction of a unique identifier of any proxy device in the network proxy configuration page is received, deleting the unique identifier of any proxy device in the network proxy configuration page, and storing network proxy configuration information of any proxy device in a configuration file, wherein the deleted unique identifier is not displayed in the network proxy configuration page;
recovering the unique identifier according to the network proxy configuration information in the configuration file under the condition that a first recovery instruction for the unique identifier of any proxy device is received, wherein the recovered unique identifier is displayed in the network proxy configuration page;
and deleting the network proxy configuration information of any proxy equipment in the configuration file under the condition that the first recovery instruction is not received within a period of time.
6. The method of claim 1, wherein after invoking the network API of the system in which the application is located in accordance with the target network proxy configuration information, the method further comprises:
in the process of displaying the network proxy configuration page, under the condition that a second deleting instruction of the unique identification of any proxy equipment in the network proxy configuration page is received, displaying the unique identification of any proxy equipment in the network proxy configuration page in different display modes, and deleting the network proxy configuration information of any proxy equipment in a configuration file;
Under the condition that a second recovery instruction for the unique identification of any proxy equipment is received, recovering the unique identification of the any proxy equipment to an original display mode, and storing network proxy configuration information of the any proxy equipment into the configuration file;
and deleting the unique identification of any proxy equipment under the condition that the second recovery instruction is not received within a period of time.
7. The method according to claim 1, wherein the method further comprises:
under the condition that a test instruction is received, determining the proxy equipment in the proxy equipment list corresponding to the test instruction as current proxy equipment, and executing the following operations one by one:
determining network proxy configuration information of the current proxy equipment as the target network proxy configuration information;
controlling the application program to transmit data with the data server through the current proxy equipment according to the test sequence and/or test time period of the current proxy equipment in the test instruction;
and executing the packet grabbing operation on the application program.
8. A network configuration apparatus for an application program, comprising:
the system comprises a determining module, a target agent device and a target agent device, wherein the determining module is used for determining the target agent device through a network agent configuration page of an application program, and the network agent configuration page of the application program is independent of a system network agent configuration page of a system where the application program is positioned;
The searching module is used for searching the target network proxy configuration information of the target proxy equipment from a plurality of network proxy configuration information, wherein the network proxy configuration information at least comprises a network address of the proxy equipment and a port number of the proxy equipment;
and the setting module is used for calling a network API of a system where the application program is located according to the target network proxy configuration information so that the application program can transmit data with the data server through the target proxy equipment.
9. 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 coupled to the at least one bus; at least one memory connected to the at least one bus, wherein the memory has a computer program stored therein, the processor implementing the method of any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing computer-executable instructions for performing the method of any one of claims 1 to 7 of the present application.
CN202310834903.9A 2023-07-07 2023-07-07 Network configuration method and device of application program, storage medium and electronic equipment Pending CN117714283A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310834903.9A CN117714283A (en) 2023-07-07 2023-07-07 Network configuration method and device of application program, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310834903.9A CN117714283A (en) 2023-07-07 2023-07-07 Network configuration method and device of application program, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117714283A true CN117714283A (en) 2024-03-15

Family

ID=90144922

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310834903.9A Pending CN117714283A (en) 2023-07-07 2023-07-07 Network configuration method and device of application program, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117714283A (en)

Similar Documents

Publication Publication Date Title
CN110221872B (en) Page jump method and device, electronic equipment and storage medium
CN104202360B (en) The method of accessed web page, device and router
US8112548B2 (en) Method for providing a clip for viewing at a remote device
CN102521284B (en) Page screenshot processing method and device based on mobile terminal browser
CN105376107B (en) Terminal testing method and proxy server
CN109408132A (en) A kind of configuration file processing method and server, user terminal, storage medium
CN104092787B (en) Based on Network Access Method and the system of DNS
CN102819461A (en) Desktop synchronization method, device, equipment and system
CN102783119A (en) Access control method and system, and access terminal
MX2007013141A (en) A shortcut generator for services accessible via a messaging service system.
CN104410660A (en) Method and device of downloading multimedia resources as well as router and server
CN104333598A (en) Two-dimension code and network adaption based mobile terminal and web terminal interconnection method
CN109033302A (en) A kind of method for page jump, device, terminal and storage medium
CN106534957A (en) Intelligent electric appliance network setting method and system
CN106686752A (en) Method and device for establishing wireless connection through first application on user device
CN113014681A (en) Network card binding method and device of multi-network card server, electronic equipment and storage medium
CN114158030B (en) Session binding method, system and storage medium
CN102904935B (en) Downloading method, downloading device and downloading system based on home gateway
CN108304515A (en) Map-indication method, device, server based on browser and storage medium
CN111026995A (en) Method and device for information association between applications and storage medium
CN117714283A (en) Network configuration method and device of application program, storage medium and electronic equipment
CN110928547A (en) Public file extraction method, device, terminal and storage medium
US20090216864A1 (en) Methods, apparatuses, and computer program products, for automatically finding configuration settings for services
JP7481369B2 (en) Method, device and readable storage medium for setting an access point name
CN107888772A (en) A kind of method, apparatus and storage medium for determining configuration information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination