CN114040025A - Method and device for controlling switching of network environment and electronic equipment - Google Patents

Method and device for controlling switching of network environment and electronic equipment Download PDF

Info

Publication number
CN114040025A
CN114040025A CN202010707240.0A CN202010707240A CN114040025A CN 114040025 A CN114040025 A CN 114040025A CN 202010707240 A CN202010707240 A CN 202010707240A CN 114040025 A CN114040025 A CN 114040025A
Authority
CN
China
Prior art keywords
network
address information
domain name
target application
network environment
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.)
Granted
Application number
CN202010707240.0A
Other languages
Chinese (zh)
Other versions
CN114040025B (en
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.)
Shenzhen Tencent Domain Computer Network Co Ltd
Original Assignee
Shenzhen Tencent Domain Computer Network 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 Shenzhen Tencent Domain Computer Network Co Ltd filed Critical Shenzhen Tencent Domain Computer Network Co Ltd
Priority to CN202010707240.0A priority Critical patent/CN114040025B/en
Publication of CN114040025A publication Critical patent/CN114040025A/en
Application granted granted Critical
Publication of CN114040025B publication Critical patent/CN114040025B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/255Maintenance or indexing of mapping tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a method and a device for controlling switching of a network environment and electronic equipment, relates to the technical field of computers, and aims to improve switching efficiency of the network environment. The method comprises the following steps: acquiring an access request which is initiated by a target application client in terminal equipment and used for requesting to access a first network environment, wherein the access request comprises first domain name information corresponding to the first network environment, and the first network environment is a network environment corresponding to an installation version of the target application client in the terminal equipment; determining second IP address information corresponding to a second network environment which needs to be accessed by the target application client according to a network switching corresponding relation and the first domain name information corresponding to the target application client, wherein the network switching corresponding relation comprises the first network address information and the corresponding second network address information; and configuring the second IP address information to the target application client so that the target application client accesses the second network environment according to the second IP address information.

Description

Method and device for controlling switching of network environment and electronic equipment
Technical Field
The application relates to the technical field of computers, and provides a method and a device for controlling switching of a network environment and electronic equipment.
Background
With the development of science and technology, application software becomes an essential part in the life of a user, and each application software is tested from development to formal online so as to repair Bug and ensure the normal operation of the application software.
At present, the test of the application software is mainly performed in a test environment, a pre-release environment and a gray scale release environment. Therefore, when a tester enters different network environments such as a test environment, a pre-release environment, a gray scale release environment and the like, only three or even more installation packages of the client of the application software can be installed respectively. And as the display image quality of the application software is higher and higher, the packet body is larger and larger, so that not only is the time for compiling the packet spent, but also the test progress of the functions of the application software can be influenced by repeatedly installing the installation packet of the client for a plurality of times for testing.
Therefore, the related art provides a technical scheme for entering different network environments through an installation package of a client of the same application software:
in the first method, for example, an application software determines which environment is entered by reading the content installed in a fixed file, but the method needs to modify the file. When a file is modified, a certain file needs to be copied to a certain fixed directory of the system, the file copying or modification is troublesome, the network environment switching is time-consuming, and the testing progress is influenced if the testing is performed.
In the second way, for example, some application software enters the formal environment by default, but can enter various network environments in the test process through special interface operation. Although the special interface operation is not easy to generate error touch, the operation is easy to be found by the outside, so that information leakage is caused, and the network environment cannot be changed when the special interface operation fails, so that the test progress is influenced.
In summary, the switching efficiency is low in the manner of changing the client file or performing a special interface operation on the interface of the client to switch the network environment accessed by the application software in the related art.
Disclosure of Invention
The embodiment of the application provides a method and a device for controlling switching of a network environment and electronic equipment, which are used for improving the switching efficiency of switching of the network environment accessed by an application.
In one aspect, a method for controlling a handover network environment is provided, the method comprising:
acquiring an access request which is initiated by a target application client in terminal equipment and used for requesting to access a first network environment, wherein the access request comprises first domain name information corresponding to the first network environment, and the first network environment is a network environment corresponding to an installation version of the target application client in the terminal equipment;
determining second IP address information corresponding to a second network environment which the target application client needs to access according to a network switching corresponding relation and the first domain name information corresponding to the target application client, wherein the network switching corresponding relation comprises first network address information and corresponding second network address information, the first network address information is network address information corresponding to the first network environment, and the second network address information is network address information corresponding to the second network environment;
and configuring the second IP address information to the target application client so that the target application client accesses the second network environment according to the second IP address information.
In one aspect, an apparatus for controlling a handover network environment is provided, the apparatus comprising:
an obtaining module, configured to obtain an access request, which is initiated by a target application client in a terminal device and used for requesting access to a first network environment, where the access request includes first domain name information corresponding to the first network environment, and the first network environment is a network environment corresponding to an installation version of the target application client in the terminal device;
a determining module, configured to determine, according to a network switching correspondence corresponding to the target application client and the first domain name information, second IP address information corresponding to a second network environment that the target application client needs to access, where the network switching correspondence includes first network address information and corresponding second network address information, the first network address information is network address information corresponding to the first network environment, and the second network address information is network address information corresponding to the second network environment;
and the configuration module is used for configuring the second IP address information to the target application client so that the target application client accesses the second network environment according to the second IP address information.
Optionally, the determining module is configured to:
determining second network address information corresponding to the first domain name information from the network switching corresponding relation;
determining second domain name information matched with the second network address information, and sending the second domain name information to a domain name system server to request the domain name system server to carry out domain name resolution on the second domain name information;
and receiving second IP address information which is returned by the domain name system server and corresponds to the second domain name information.
Optionally, the determining module is configured to:
sending the first domain name information to a domain name system server to request the domain name system server to carry out domain name resolution on the first domain name information;
receiving first IP address information corresponding to the first domain name information returned by the domain name system server;
and searching an IP address forwarding relation table to determine the IP address information to be forwarded corresponding to the first IP address information as the second IP address information, wherein the IP address forwarding relation table is determined according to the network switching corresponding relation.
Optionally, the determining module is configured to:
determining a first IP address and a first port corresponding to the first network address information, and determining a second IP address and a second port corresponding to the second network address information;
configuring the first IP address and the first port as inputs of an iptables forwarding table, and configuring the second IP address and the second port as outputs of the iptables forwarding table;
and determining the configured iptables forwarding table as the IP address translation relation table.
Optionally, the determining module is configured to:
when the network where the terminal equipment is located is detected to be switched, acquiring updated IP address information corresponding to the IP address information to be forwarded in the IP address forwarding relation table after the network is switched;
and replacing the corresponding IP address information to be forwarded with the updated IP address information so as to update the IP address forwarding relation table.
Optionally, the network switching correspondence is obtained according to an operation performed on a network client in the terminal device.
Optionally, the determining module is configured to:
responding to configuration triggering operation aiming at the target application client, and displaying a target conversion configuration interface corresponding to the target application client through the network client, wherein the target conversion configuration interface comprises a source input area and a target input area;
obtaining the first network address information in response to a first input operation for the source input area, and obtaining the second network address information in response to a second input operation for the destination input area;
and determining the network switching corresponding relation according to the first network address information and the second network address information.
In one aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the method for controlling a switching network environment described in the above various possible implementation manners includes the steps.
In one aspect, a storage medium is provided, which stores computer-executable instructions for causing a computer to perform the steps included in the method for controlling a handover network environment described in the above-mentioned various possible implementations.
In one aspect, a computer program product containing instructions is provided, which when run on a computer causes the computer to perform the steps included in the method for controlling a switching network environment described in the above various possible implementations.
In the embodiment of the application, when an access request for requesting access to a first network environment initiated by a target application client is obtained, IP address information (namely, second IP address information) corresponding to a second network environment to be switched can be obtained according to a preconfigured network switching correspondence and first domain name information corresponding to the first network environment, and then the obtained second IP address information is configured to the target application client, so that the target application client can access the second network environment according to the second IP address information, and thus, the network environment accessed by the target application client is switched. Therefore, files stored on the terminal do not need to be modified, and special interface operation is not needed, so that the switching efficiency of the network environment accessed by the application is improved, for example, the first network environment is a formal environment of the application installed in the terminal, the second network environment is a testing environment or a gray level environment, and the testing efficiency in the testing process can be improved by improving the switching effect of the network environment. In addition, in the switching process of the network environment, the target application client is unaware, so that the normal use of the target application client is not influenced.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a diagram illustrating a DNS recursive query in the related art;
fig. 2 is a schematic diagram of an application scenario provided in an embodiment of the present application;
fig. 3 is a schematic diagram of another application scenario provided in the embodiment of the present application;
FIG. 4 is a schematic diagram of a configuration interface provided by an embodiment of the present application;
fig. 5 is a flowchart of a method for controlling a network environment switching according to an embodiment of the present application;
fig. 6 is another flowchart of a method for controlling a network environment handover according to an embodiment of the present application;
fig. 7 is another flowchart of a method for controlling a network environment handover according to an embodiment of the present application;
fig. 8 is a schematic diagram illustrating comparison between before and after switching a network environment according to an embodiment of the present application;
fig. 9 is a block diagram illustrating an apparatus for controlling a handover network environment according to an embodiment of the present disclosure;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solution and advantages of the present application more clearly and clearly understood, the technical solution in the embodiments of the present application will be described below in detail and completely with reference to the accompanying drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The following description is provided for illustrative purposes to facilitate understanding by those skilled in the art.
1. In a network environment, before formal online, a piece of application software needs to be subjected to the processes of application software development, application software testing, formal online use of the application software and the like, and when the application software is developed, developers carry out the development in a development environment, and the initially developed application software may have many bugs to cause that the application software cannot be formally operated, or has the problems of stagnation, poor image quality and the like in the operation process. Therefore, there is a need for further elaboration on the developed application software tests.
The application software testing is performed in a network environment in the testing process, the testing process of the application software is performed after the application software is developed and before formal online, and therefore the testing of the application software is mainly performed in a testing environment, a pre-release environment and a gray scale release environment. The testing environment is behind the development environment and mainly tests the developed application software to repair the Bug; after the test environment, entering a pre-release environment, wherein the pre-release environment is a network environment which is configured as the formal environment after the test environment and before the formal environment, and is used for verifying the Bug repair condition of the new version; after the pre-release environment and before the formal environment, a gray release environment is also included, wherein the gray release environment refers to an independent environment in which the version is released in a small range in an independent environment before the formal environment is on line, so that the problem of verifying the new version in advance is solved, and the direct influence of severe Bug on the users in the whole network is avoided.
After the application software is tested and modified, the application software is formally on-line after the application software can be formally used, and at the moment, the application software accesses a formal environment.
Therefore, the applied network environment includes a development environment, a test environment, a pre-release environment, a gray release environment, and a formal environment.
2. DNS (Domain Name Server) recursive query, and query of a terminal device to a Domain Name system Server generally adopts DNS recursive query. The so-called recursive query is: if the domain name system server inquired by the terminal device does not know the IP address corresponding to the inquired domain name, the domain name system server continuously sends an inquiry request to other root domain name system servers (namely continuously inquires for the terminal device) according to the identity of the DNS client, instead of making the terminal device perform the next inquiry. Therefore, the recursive query returns a query result of the IP address to be queried or an error indicating that the required IP address cannot be queried. A domain name system server (or DNS server) is a server that performs domain name (domain name) and IP address translation corresponding to the domain name, and the domain name translation into an IP address is also called a domain name resolution service.
As shown in fig. 1, which is a schematic diagram of DNS recursive query in the related art, a terminal device initiates a domain name resolution request carrying domain name information (e.g. first domain name information) to a domain name system server, and if the domain name system server finds an IP address corresponding to the first domain name information from local, returning the searched IP address to the terminal equipment, if the domain name system server fails to search the IP address corresponding to the first domain name information from local, a domain name resolution request carrying the first domain name information is sent to the root domain name system server to request the root domain name system server to carry out domain name resolution on the first domain name information, after the root domain name system server finds the IP address corresponding to the first domain name information from local, then the domain name resolution is returned to the domain name system server, and then the domain name system server returns the domain name resolution to the terminal equipment, thereby realizing the recursive query of domain name resolution.
3. Domain name hijacking is a mode of internet attack, and a domain name system server (DNS server) is attacked or a method of forging the DNS server is used for resolving a domain name of a target website to an incorrect IP address so as to achieve the purpose that a user cannot access the target website or the purpose that the user is deliberately or maliciously required to access an appointed IP address (website).
4. iptables, application software running in user space, manages the processing and forwarding of network packets by controlling a Linux kernel netfilter module.
An application scenario to which the technical solution of the present application is applicable is illustrated below.
Fig. 2 is a schematic view of an application scenario provided in the embodiment of the present application. The application scenario includes a plurality of terminals 20 and a plurality of servers 21.
The terminal 20 may be a Personal Computer (PC), a tablet PC, a Personal Digital Assistant (PDA), a notebook, a mobile phone, or a Computer with mobile terminal equipment, including various portable, pocket, hand-held, Computer-embedded or vehicle-mounted mobile devices, which can provide voice, data or voice and data connectivity to a user, and exchange voice, data or voice and data with a radio access network.
The server 21 includes application servers in different network environments, specifically including an application server in a formal environment, an application server in a test environment, an application server in a pre-release environment, an application server in a gray release environment, and the like, and the server 21 may further include a domain name system server, a root domain name system server, and the like.
Each server 21 may be independent, or may be any single background running device capable of providing internet services or a cluster or distributed system formed by a plurality of background running devices, or may be a device providing basic cloud computing services such as cloud services, a cloud database, cloud computing, a cloud function, cloud storage, Network services, cloud communication, middleware services, domain name services, security services, a Content Delivery Network (CDN), and a big data and artificial intelligence platform.
In practical applications, the terminal 20 and the server 21 are connected in communication, and the communication network may be, but is not limited to, a local area network, a metropolitan area network, a wide area network, or the like.
In a possible application scenario, the servers 21 may be deployed in different regions for reducing communication delay, or different servers 21 may serve the regions corresponding to the terminals 20 respectively for load balancing. The plurality of servers 21 can share data by using a blockchain, which is equivalent to a data sharing system composed of the plurality of servers 21.
Referring to fig. 3 again, fig. 3 includes a terminal, a domain name system server, and two application server clusters, where the two application server clusters respectively construct two network environments, one is a formal environment, and the other is a test environment, where the formal environment and the test environment are both network environments accessible to a target application corresponding to a target application client installed in a terminal device, and when the target application runs formally, the application service can be implemented by accessing the application server cluster in the formal environment, and when the target application needs to access the test environment, the corresponding application service can be implemented by accessing the application server cluster in the environment during test.
A plurality of application clients may be installed and run in the terminal device in fig. 3, taking a target application client as an example, the target application client may communicate with a Network control module in the terminal device, for example, a packet sent and received by the target application client through a Network may be controlled and forwarded by the Network control module, where the Network control module may be understood as a hardware Network device such as a Network card in the terminal device, or may also be understood as a Network client installed in the terminal device, for example, an installed Virtual Private Network (VPN) client, which is not limited in this embodiment of the present application.
It is assumed that, for a target application installed in a terminal device, an installation version currently installed in the terminal device is a version in a formal environment, that is, an installation package corresponding to a formal version of the target application is installed in the terminal device, so that a target application client corresponding to the target application can access an application server in the formal environment to provide an application service. In the process of accessing the formal environment, if the tester wants to access another network environment, taking game a as an example of the target application, the tester may start the VPN client to display a configuration interface corresponding to the VPN forwarding configuration of game a as shown in fig. 4, in the configuration interface, the tester may input a domain name corresponding to the formal environment currently accessed in an input area of a source domain name and a domain name corresponding to the network environment to be switched in an input area of a destination domain name, it can be seen that the source domain name input in fig. 4 is format.
Specifically, the network control module in the terminal device in fig. 3 may obtain forwarding configuration information obtained by the configuration in fig. 4, that is, it indicates that it is necessary to switch from the formal environment to the testing environment, when the target application client (for example, the aforementioned game a) initiates an access request to the application server in the formal environment, the access request includes domain name information (i.e., format.g., format.qq.com) corresponding to the formal environment, assuming that the IP address corresponding to format.qq.com is 1.1.1.1, the network control module may obtain the IP address (assumed to be 9.9.9.9) in the testing environment (i.e., network environment corresponding to test.format.qq.com) in a domain name hijacking manner or may forward the IP address through an IP address forwarding table, and the like, and configure the IP address in the testing environment to the target application client, so that the target application client may access the application server with the IP address of 9.9.9.9, that is to directly access the IP address corresponding to the application server in the testing environment, thereby realizing the switching of the network environment. In the conversion process, the target application client is not perceived, that is, the target application client is not influenced at all, installation packages under various network environments are not required to be installed as in the related technology, so that the installation and storage loads of the terminal are reduced, and meanwhile, the switching efficiency of the network environments can be improved.
To further illustrate the technical solutions provided by the embodiments of the present application, the following detailed description is made with reference to the accompanying drawings and the detailed description. Although the embodiments of the present application provide the method operation steps as shown in the following embodiments or figures, more or less operation steps may be included in the method based on the conventional or non-inventive labor. In steps where no necessary causal relationship exists logically, the order of execution of the steps is not limited to that provided by the embodiments of the present application. The method can be executed in sequence or in parallel according to the method shown in the embodiment or the figure when the method is executed in an actual processing procedure or a device.
An embodiment of the present application provides a method for controlling network environment switching, which may be applied to the terminal 20 in fig. 2 or the terminal device in fig. 3, and in particular, may be executed by a network control module in the terminal device in fig. 3, as shown in fig. 5, for a flowchart of the method for controlling network environment switching provided in the embodiment of the present application, the flowchart shown in fig. 5 is described as follows.
Step 501: the method comprises the steps of obtaining an access request which is initiated by a target application client in terminal equipment and used for requesting to access a first network environment, wherein the access request comprises first domain name information corresponding to the first network environment, and the first network environment is a network environment corresponding to an installation version of the target application client in the terminal equipment.
The network environment corresponding to the installation version currently installed in the terminal device by the target application client is called a first network environment, so the target application client may directly run in the first network environment, that is, the target application client may directly initiate an access request to the first network environment, specifically, for example, request to access an application server in the first network environment. When accessing the application server, the target application client generally accesses through the domain name, so the access request includes domain name information corresponding to the first network environment requesting the access, for example, the domain name information is referred to as first domain name information.
Step 502: and determining second IP address information corresponding to a second network environment which needs to be accessed by the target application client according to a network switching corresponding relation and the first domain name information corresponding to the target application client, wherein the network switching corresponding relation comprises first network address information and corresponding second network address information, the first network address information is network address information corresponding to the first network environment, and the second network address information is network address information corresponding to the second network environment.
The network switching correspondence is configured in the terminal device in advance, for example, is configured in the network client in the terminal device in advance, that is, the network switching correspondence is obtained according to an operation performed on the network client in the terminal device. The network switching correspondence is a correspondence of network addresses used for performing network environment switching, the first network address information included in the network switching correspondence is network address information corresponding to a network environment that can be accessed before the network environment switching, the second network address information is network address information corresponding to a network environment that can be accessed after the network environment switching, and the network address information may be a domain name, or may be an IP address, or may be a domain name + a network port number, or may be an IP address + a network port number, which is not limited in this embodiment of the present application.
When each application in the terminal device accesses the network, the initiated network access request generally passes through the network control module, and after the access request initiated by the target application client for requesting access to the first network environment is obtained, the network control module may first determine whether the target application client needs to switch the network environment, where the specific determination manner may be: whether a network switching corresponding relation comprising first network address information and corresponding second network address information is stored in the storage of the terminal device is judged, if yes, the fact that network environment switching is required for all access requests for accessing the first network environment, namely, the access to the second network environment is required to be switched, namely, the existence of the network switching corresponding relation comprising the first network address information and the second network address information can be used as a trigger condition for triggering network environment switching is judged.
The network switching corresponding relationship in the embodiment of the present application is configured in advance as described in the foregoing fig. 4, specifically, in response to the configuration triggering operation for the target application client, the target conversion configuration interface corresponding to the target application client is displayed by the network client, where the target conversion configuration interface includes the source input area and the destination input area, that is, the user may start the network client, for example, the VPN client in fig. 4, and the VPN client may support network switching configuration for multiple applications and also support deletion or addition of network switching configuration for a certain application, for example, as shown in fig. 4, clicking the "x" on the right side of the game a may delete the network switching configuration for the application a, and clicking the "+" on the right side of the game B may add the network switching configuration for other applications, taking the example that the target application corresponding to the target application client is game a, the user may perform a configuration triggering operation, such as clicking, on the text "game a" to trigger the VPN client to display the conversion configuration interface for game a as shown in fig. 4. The destination translation configuration interface may include a source input area and a destination input area, where an input area corresponding to a source domain name and a source port in fig. 4 is referred to as a source input area, an input area corresponding to a destination domain name and a destination port is referred to as a destination input area, the source input area is used for inputting network address information before switching of a network environment, and the destination input area is used for inputting network address information of a network environment desired to be switched.
Further, in response to the first input operation for the source input area, to obtain first network address information, such as "format.game.qq.com" and "12345" in fig. 4, and in response to the second input operation for the destination input area, to obtain second network address information, such as "test.game.qq.com" and "54321" in fig. 4, after obtaining the first network address information and the second network address information, the network switching correspondence corresponding to the target application client (i.e., game a) is obtained.
In a specific implementation process, the first network address information may be only a domain name or only an IP address, or may be a combination of a domain name and a network port number, or may also be a combination of an IP address and a network port number, which is not limited in this embodiment of the present application. The first network address information and the second network address information as shown in fig. 4 are each a combination of a domain name + a network port number. The network switching corresponding relation of the target application is configured through the interface configuration mode shown in fig. 4, and the method is intuitive and easy to operate, so that a user can rapidly configure the network environment switching only by simple input operation, and the switching efficiency of the network environment is improved conveniently. It should be noted that the network switching correspondence may be configured in advance before the network environment is switched, and the operation of storing the network switching correspondence may be understood as a trigger operation that triggers the network environment switching, that is, when it is detected that the network switching correspondence is stored, the VPN process may be started, so as to trigger the application unaware switching from the background to the network environment accessed by the target application.
In addition, in the embodiment of the present application, the network switching corresponding relationship corresponding to the target application client is configured by an independent network client, it can be understood that the network switching corresponding relationship may also be configured for other application clients (for example, an application client corresponding to game B) by the network client, and the network client and the application clients of each application are mutually independent clients, and the network client may be understood as a client corresponding to a network control module in the terminal device.
When determining that the target application client needs to switch the network environment, the network control module determines the IP address information corresponding to the network environment that needs to be switched according to the network switching correspondence corresponding to the target application client and the first domain name information included in the access request.
Step 503: and configuring the second IP address information to the target application client so that the target application client accesses the second network environment according to the second IP address information.
After the second IP address information corresponding to the second network environment is acquired, the network control module may configure the second IP address information to the target application client, so that the target client may directly access the application server corresponding to the second IP address information, that is, the application server in the second network environment, thereby switching the accessed network environment. However, for the target application client, the initiated access request is an access request for the first network environment, but the access request is the application server in the second network environment, that is, the application server corresponding to the second IP address information, so that for the target application client, the switching of the network environment is not aware, the network environment is controlled by the upper network control module to be switched, the operation of the target application client is not affected, and the target application client itself does not need to be modified.
In the embodiment of the present application, the second IP address information corresponding to the second network environment may be determined in two ways, namely, domain name hijacking and an IP address forwarding table, and a scheme for switching the network environments in the embodiment of the present application will be described below in correspondence to the two ways.
Referring to fig. 6, fig. 6 is a flowchart illustrating a scheme for controlling a network environment switching based on a domain name hijacking technique according to an embodiment of the present application, where the flowchart illustrated in fig. 6 is described as follows.
Step 601: a target application client in the terminal device initiates an access request carrying the first domain name information, and the access request is obtained by a network control module in the terminal device, that is, the network control module can obtain the access request carrying the first domain name information sent by the target application client.
The first domain name information is domain name information corresponding to a first network environment, taking the first network environment as a formal environment as an example, the first domain name information is, for example, a domain name in the formal environment, that is: formal.
Step 602: the network control module judges whether the triggering condition of the network environment switching is met.
As described above, one possible trigger condition is that the terminal device stores a network handover correspondence corresponding to the target application client, and another possible trigger condition is that the terminal device performs a saving operation after the first network address information and the second network address information are respectively input into the source input area and the destination input area of the target application client as shown in fig. 4.
Step 603: when the triggering condition of network environment switching is not met, the network control module directly sends the first domain name information to the domain name system server so as to request the domain name system server to carry out domain name resolution on the first domain name information.
When any possible trigger condition is not met, that is, the network environment accessed by the target application client does not need to be switched, that is, the target application client still wants to access the first network environment, the first domain name information can be sent to the domain name system server, and then the access is performed according to the existing access flow.
Step 604: the network control module receives a first IP address returned by the domain name system server.
Assuming that the obtained IP address corresponding to the first domain name information is the first IP address after the domain name system server resolves the first domain name information, for example, the first IP address is 1.1.1.1, that is, the IP address corresponding to the formal environment, the first IP address is returned to the network control module.
Step 605: the network control module configures the first IP address to the target application client.
Step 606: and the target application client accesses the application server under the first network environment according to the first IP address.
Step 607: and when the network environment is switched under the triggering condition, the network control module intercepts an access request initiated by the target client, determines second network address information corresponding to the first domain name information according to the network switching corresponding relation corresponding to the target application client, and determines second domain name information corresponding to the second network address information.
When any possible trigger condition is met, that is, it indicates that switching needs to be performed on the network environment accessed by the target application client, at this time, the network control module may intercept the first domain name information included in the access request based on a domain name hijack technique, and determine, according to a correspondence between the first network address information and the second network address information in the network correspondence, second domain name information belonging to the second network address information, where the second network address information shown in fig. 4 is a domain name, the second domain name information may be directly obtained, and it is assumed that the second domain name information is test.
Step 608: and the network control module sends the second domain name information to the domain name system server to request the domain name system server to carry out domain name resolution on the second domain name information.
Step 609: the network control module receives a second IP address obtained by analyzing the second domain name information by the domain name system server, and assumes that the second IP address is 9.9.9.9, that is, the IP address in the second network environment.
Step 610: and the network control module configures the second IP address to the target application client.
Step 611: and the target application client accesses the application server under the second network environment according to the second IP address, so that the switching access to the network environment is realized.
According to normal access, after a target application client initiates an access request containing format, qq.com, a network control module in a terminal can send format, qq.com to a domain name system server for domain name resolution, the domain name system server determines that an IP address corresponding to format, qq.com is 1.1.1.1 through domain name resolution, then 1.1.1.1 is returned to the network control module, and the network control module configures 1.1.1.1 to the target application client, so that the target application client can access an application server corresponding to the target application client through the IP address 1.1.1.1, namely the application server in the formal environment, thereby realizing access to the formal environment, namely the flow shown in step 603-step 606.
In the present application, since the network switching correspondence between format.g. qq.com and test.g. qq.com is configured in advance, the storage of the network switching correspondence can be used as a switching condition of the network environment for triggering the target application client to switch access, under this trigger, after the target application client initiates an access request containing format.g. qq.com, the network control module performs domain name hijacking on the correspondence, that is, the format.g. qq.com is intercepted, and sends the format.g. qq.com to the domain name system server for domain name resolution, the domain name system server determines that the IP address corresponding to the format.g. qq.com is 9.9.9.9 through domain name resolution, returns 9.9.9.9 to the network control module, and the network control module configures 9.9.9.9 to the target application client, so that the target application client accesses the application server corresponding to the IP address 9.9.9.9, that is the application server under test environment, thereby realizing the access to the test environment, to implement the access switch from the formal environment to the test environment, i.e., the flow shown in steps 607-611.
In the switching mode, the network environment can be switched rapidly by a domain name hijacking mode, for example, the formal environment is switched rapidly to a testing environment, only the installation package in the formal environment is needed to be installed, and the installation packages corresponding to the network environments are not needed to be installed, so that the storage and installation requirements of the terminal are reduced, and when the testing is performed, certain file contents on the terminal are not needed to be modified manually by testing, and the testing personnel can enter the testing environment by the client side in the formal environment without specific gesture operation, so that the testing steps of the testing personnel are optimized, and particularly, the testing efficiency can be greatly improved for the game application testing of the large package.
Referring to fig. 7 again, fig. 7 is a diagram illustrating a scheme for controlling a switching network environment provided in a manner based on an IP address forwarding table according to an embodiment of the present application, where a flow illustrated in fig. 7 is described as follows.
Step 701: a target application client in the terminal device initiates an access request carrying the first domain name information, and the access request is obtained by a network control module in the terminal device, that is, the network control module can obtain the access request carrying the first domain name information sent by the target application client.
The first domain name information is domain name information corresponding to a first network environment, taking the first network environment as a formal environment as an example, the first domain name information is, for example, a domain name in the formal environment, that is: formal.
Step 702: the network control module judges whether the triggering condition of the network environment switching is met.
As described above, one possible trigger condition is that the terminal device stores a network handover correspondence corresponding to the target application client, and another possible trigger condition is that the terminal device performs a saving operation after the first network address information and the second network address information are respectively input into the source input area and the destination input area of the target application client as shown in fig. 4.
Step 703: when the triggering condition of network environment switching is not met, the network control module directly sends the first domain name information to the domain name system server so as to request the domain name system server to carry out domain name resolution on the first domain name information.
When any possible trigger condition is not met, that is, the network environment accessed by the target application client does not need to be switched, that is, the target application client still wants to access the first network environment, the first domain name information can be sent to the domain name system server, and then the access is performed according to the existing access flow.
Step 704: the network control module receives a first IP address returned by the domain name system server.
Assuming that the obtained IP address corresponding to the first domain name information is the first IP address after the domain name system server resolves the first domain name information, for example, the first IP address is 1.1.1.1, that is, the IP address corresponding to the formal environment, the first IP address is returned to the network control module.
Step 705: the network control module configures the first IP address to the target application client.
Step 706: and the target application client accesses the application server under the first network environment according to the first IP address.
According to normal access, after a target application client initiates an access request containing format, qq.com, a network control module in a terminal may send format, qq.com to a domain name system server for domain name resolution, the domain name system server determines, through domain name resolution, that an IP address corresponding to format, qq.com is 1.1.1.1, then 1.1.1.1 is returned to the network control module, and the network control module configures 1.1.1.1 to the target application client, so that the target application client may access an application server corresponding to the target application client through the IP address 1.1.1.1, i.e., an application server in a formal environment, thereby implementing access to the formal environment, i.e., the flow shown in step 703-step 706.
Step 707: and when the network environment is switched under the triggering condition, the network control module still sends the first domain name information to the domain name system server.
Step 708: the network control module receives a first IP address returned by the domain name system server.
Step 709: the network control module searches an IP address forwarding relation table to determine the IP address to be forwarded corresponding to the first IP address information as second IP address information, and then obtains the second IP address.
In this manner, the IP address corresponding to the network environment that needs to be switched is obtained through the IP address forwarding relationship table locally stored in the terminal device, and is configured in a manner that the IP address of the currently accessed first network environment (i.e. the first IP address information) and the IP address are set as a relationship pair, where the IP address forwarding relationship table may be generated according to the aforementioned network switching correspondence, for example, after the network switching correspondence for the target application is configured in the manner shown in fig. 4, a corresponding IP address forwarding relationship table may be generated corresponding to the activated VPN process, as in the foregoing example, the IP address corresponding to the network switching correspondence is set as the IP address before switching in the IP address forwarding relationship table, and the IP address corresponding to the test. Thus, the corresponding relationship between the IP addresses is formed, and by looking up the IP address forwarding relationship table, it can be obtained that the IP address corresponding to 1.1.1.1 is 9.9.9.9, so 9.9.9.9 is determined to be the second IP address, and is configured to the target application client, so as to implement the switching of the accessed network environment.
In a specific implementation, the IP address forwarding relation table may be an iptables forwarding table, as shown in table 1, the iptables forwarding table includes an INPUT (INPUT) and an OUTPUT (OUTPUT), and the IP address information in the iptables forwarding table is expressed by a combination of an IP address + a network port number.
TABLE 1
Figure BDA0002595249880000191
For the configuration mode of the iptables forwarding table, first network address information and second network address information which are correspondingly paired in a network switching corresponding relation can be obtained, then a source IP address and a source port which correspond to the first network address information are obtained, and a destination IP address and a destination port which correspond to the second network address information are obtained; the source IP address and the source port acquired by the mouth week are configured as input of an iptables forwarding table, the destination IP address and the destination port acquired by the mouth week are configured as output of the iptables forwarding table, and the configured iptables forwarding table (for example, shown in table 1) is used as the IP address translation relation table.
In view of the fact that different operators have different IP addresses, in the embodiment of the present application, a network change of a terminal device may be detected in real time, and once it is determined that a network where the terminal device is located changes (for example, switching from 4G to wifi, or switching from wifi a to wifi b), and the like may cause a change of an operator, a VPN process may re-analyze test. By timely updating, timely and effective switching of the network environment is convenient to realize, and the effectiveness of switching of the network environment is ensured.
The background entry modification of the IP address is realized by an iptables forwarding table, the data which is sent to format.g.qq.com: 12345 is sent to test.g.qq.com: 54321, so as to realize the non-perception switching of the network environment, in the iptables forwarding mode, the forwarding from INPUT to OUTPUT can be realized based on the level of an IP + port number, the differentiated configuration of the forwarding by the port number is added, the number of forwarding configurations can be increased, the access switching to a specific application server in the network environment can be further refined on the basis of realizing the network environment switching, the granularity for switching is smaller, and the pertinence of switching is stronger.
In particular, considering that even the same operator and the background load balancing may also consider that there are multiple IPs, before configuration, it is required to first get all public network IPs of this domain name under the operator network environment where the terminal is currently located through httpdns request, for example, 1.1.1.1 and 2.2.2.2, and if there are multiple IPs, the destination domain name test. Thus, a plurality of rules can be configured in the iptables forwarding table, namely corresponding combinations between different source IP + source ports and different destination IP + destination ports.
After the above configuration hijacking, taking the game application as an example, the domain name format.game.qq.com of the formal environment accessed by the game client is resolved to the IP (9.9.9.9) of the testing environment, and at this time, the background of the game testing environment will return the data of the current login account in the testing environment, so that the user can perform various tests of the testing environment. Similarly, if the backend configures the IP of the formal environment specifically for this terminal as the IP of the pre-release environment (e.g., 8.8.8.8), then the game client of the formal environment may enter the pre-release environment.
Step 710: and the network control module configures the second IP address to the target application client.
Step 711: and the target application client accesses the application server under the second network environment according to the second IP address, so that the switching access to the network environment is realized.
With reference to the above example, as shown in fig. 8, the first network environment accessed by the target application client (game client) is a formal environment, and the second network environment desired to be switched is a testing environment, for example, the second IP address is an IP address of a large area list server in the testing environment, after the network environment is switched, at this time, after the game client (whether a game served by partitions or a game served by all partitions) is started, at this time, one large area list server is connected to perform logic such as large area list pull and client version check, so that the connected large area list server returns a large area list of the current environment (or currently available) to the game client for the game player to select, the game player can select a favorite large area or small area, after the game player selects a favorite large area or small area, the game player is connected to the game exchange server corresponding to the selected large area or small area, the game player can then obtain the main logic of the game to play the game.
In the embodiment of the application, when an access request for requesting access to a first network environment initiated by a target application client is obtained, IP address information (namely, second IP address information) corresponding to a second network environment to be switched can be obtained according to a preconfigured network switching correspondence and first domain name information corresponding to the first network environment, and then the obtained second IP address information is configured to the target application client, so that the target application client can access the second network environment according to the second IP address information, and thus, the network environment accessed by the target application client is switched. Therefore, files stored on the terminal do not need to be modified, and special interface operation is not needed, so that the switching efficiency of the network environment accessed by the application is improved, for example, the first network environment is a formal environment of the application installed in the terminal, the second network environment is a testing environment or a gray level environment, and the testing efficiency in the testing process can be improved by improving the switching effect of the network environment. In addition, in the switching process of the network environment, the target application client is unaware, so that the normal use of the target application client is not influenced.
Taking a game application as an example, compared with the existing game testing scheme, the embodiment of the application provides two modes of domain name hijacking and IP modification at a background entrance based on an IP address forwarding table, on one hand, certain file contents on a terminal do not need to be modified manually by testing, on the other hand, a tester can enable a client package in a formal environment to enter a testing environment without specific gesture operation, so that the testing steps of the tester are optimized, and particularly, the testing efficiency can be greatly improved for the game testing of large packages.
Based on the same inventive concept, the embodiment of the present application provides a device for controlling switching of a network environment, where the device for controlling switching of a network environment may be a hardware structure, a software module, or a hardware structure plus a software module. Referring to fig. 9, an apparatus for controlling a network environment switching in the embodiment of the present application includes an obtaining module 901, a determining module 902, and a configuring module 903, where:
an obtaining module 901, configured to obtain an access request, which is initiated by a target application client in a terminal device and used for requesting access to a first network environment, where the access request includes first domain name information corresponding to the first network environment, and the first network environment is a network environment corresponding to an installation version of the target application client in the terminal device;
a determining module 902, configured to determine, according to a network switching correspondence and first domain name information corresponding to a target application client, second IP address information corresponding to a second network environment that the target application client needs to access, where the network switching correspondence includes first network address information and corresponding second network address information, the first network address information is network address information corresponding to a first network environment, and the second network address information is network address information corresponding to a second network environment;
and the configuring module 903 is configured to configure the second IP address information to the target application client, so that the target application client accesses the second network environment according to the second IP address information.
In one possible implementation, the determining module 902 is configured to:
determining second network address information corresponding to the first domain name information from the network switching corresponding relation;
determining second domain name information matched with the second network address information, and sending the second domain name information to a domain name system server to request the domain name system server to carry out domain name resolution on the second domain name information;
and receiving second IP address information which is returned by the domain name system server and corresponds to the second domain name information.
In one possible implementation, the determining module 902 is configured to:
sending the first domain name information to a domain name system server to request the domain name system server to carry out domain name resolution on the first domain name information;
receiving first IP address information corresponding to the first domain name information returned by a domain name system server;
and searching an IP address forwarding relation table to determine the IP address information to be forwarded corresponding to the first IP address information as second IP address information, wherein the IP address forwarding relation table is determined according to the network switching corresponding relation.
In one possible implementation, the determining module 902 is configured to:
determining a first IP address and a first port corresponding to the first network address information, and determining a second IP address and a second port corresponding to the second network address information;
configuring a first IP address and a first port as the input of an iptables forwarding table, and configuring a second IP address and a second port as the output of the iptables forwarding table;
and determining the configured iptables forwarding table as an IP address translation relation table.
In one possible implementation, the determining module 902 is configured to:
when the network where the terminal equipment is located is detected to be switched, acquiring updated IP address information corresponding to the IP address information to be forwarded after the network is switched in an IP address forwarding relation table;
and replacing the corresponding IP address information to be forwarded with the updated IP address information so as to update the IP address forwarding relation table.
In a possible implementation, the network switching correspondence is obtained from an operation performed on a network client in the terminal device.
In one possible implementation, the determining module 902 is configured to:
responding to configuration triggering operation aiming at a target application client, and displaying a target conversion configuration interface corresponding to the target application client through a network client, wherein the target conversion configuration interface comprises a source input area and a target input area;
obtaining first network address information in response to a first input operation for a source input area, and obtaining second network address information in response to a second input operation for a destination input area;
and determining a network switching corresponding relation according to the first network address information and the second network address information.
All relevant contents of each step involved in the foregoing method for controlling switching of a network environment in an embodiment may be cited to the functional description of the functional module corresponding to the apparatus for controlling switching of a network environment in this application embodiment, and are not described herein again.
The division of the modules in the embodiments of the present application is schematic, and only one logical function division is provided, and in actual implementation, there may be another division manner, and in addition, each functional module in each embodiment of the present application may be integrated in one processor, may also exist alone physically, or may also be integrated in one module by two or more modules. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
Based on the same inventive concept, the embodiment of the present application further provides an electronic device, which is, for example, the terminal device in the foregoing method embodiment. Referring to fig. 10, the electronic device in the embodiment of the present application includes at least one processor 1001 and a memory 1002 connected to the at least one processor, and a specific connection medium between the processor 1001 and the memory 1002 is not limited in the embodiment of the present application, for example, the processor 1001 and the memory 1002 may be connected by a bus, and the bus may be divided into an address bus, a data bus, a control bus, and the like.
In the embodiment of the present application, the memory 1002 stores instructions executable by the at least one processor 1001, and the at least one processor 1001 may execute the steps included in the method for controlling switching network environment described above by executing the instructions stored in the memory 1002.
The Processor 1001 may be a general-purpose Processor, such as a Central Processing Unit (CPU), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic blocks disclosed in the embodiments of the present Application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in a processor.
Memory 1002, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory may include at least one type of storage medium, and may include, for example, a flash Memory, a hard disk, a multimedia card, a card-type Memory, a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Programmable Read Only Memory (PROM), a Read Only Memory (ROM), a charged Erasable Programmable Read Only Memory (EEPROM), a magnetic Memory, a magnetic disk, an optical disk, and so on. The memory is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 1002 in the embodiments of the present application may also be circuitry or any other device capable of performing a storage function for storing program instructions and/or data.
The processor 1001 is a control center of the electronic device, and may connect various portions of the entire electronic device through various interfaces and lines, and perform various functions and process data of the electronic device by executing or executing instructions stored in the memory 1002 and calling data stored in the memory 1002, thereby performing overall monitoring of the electronic device. Alternatively, the processor 1001 may include one or more processing units, and the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, an application program, and the like, and the modem processor mainly processes wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processor 1001. In some embodiments, the processor 1001 and the memory 1002 may be implemented on the same chip, or in some embodiments, they may be implemented separately on separate chips.
Further, the electronic device in this embodiment of the application may further include an input unit 1003, a display unit 1004, a radio frequency unit 1005, an audio circuit 1006, a speaker 1007, a microphone 1008, a Wireless Fidelity (WiFi) module 1009, a bluetooth module 1010, a power source 1011, an external interface 1012, an earphone jack 1013, and the like. It will be understood by those skilled in the art that fig. 10 is merely an example of an electronic device and is not intended to limit the electronic device, which may include more or fewer components than those shown, or some components may be combined, or different components.
The input unit 1003 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device. For example, the input unit 1003 may include a touch screen 1014 and other input devices 1015. The touch screen 1014 may collect touch operations by a user (e.g., operations by a user on or near the touch screen 1014 using any suitable object such as a finger, a joint, a stylus, etc.), i.e., the touch screen 1014 may be used to detect touch pressure and touch input position and touch input area, and drive the corresponding connection device according to a preset program. The touch screen 1014 can detect a touch operation of the touch screen 1014 by a user, convert the touch operation into a touch signal and send the touch signal to the processor 1001, or understand that touch information of the touch operation can be sent to the processor 1001 and can receive and execute a command sent by the processor 1001. The touch information may include at least one of pressure magnitude information and pressure duration information. The touch screen 1014 may provide an input interface and an output interface between the electronic device and a user. In addition, the touch screen 1014 can be implemented using various types, such as resistive, capacitive, infrared, and surface acoustic wave. The input unit 1003 may include other input devices 1015 in addition to the touch screen 1014. For example, other input devices 1015 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 1004 may be used to display information input by or provided to a user and various menus of the electronic device. Further, the touch screen 1014 may overlay the display unit 1004 and, when the touch screen 1014 detects a touch operation thereon or nearby, transmit to the processor 1001 pressure information of the touch operation determined. In the embodiment of the present application, the touch screen 1014 and the display unit 1004 may be integrated into one component to implement input, output, and display functions of the electronic device. For convenience of description, the embodiment of the present application is schematically illustrated by taking the touch screen 1014 as an example of the functional set of the touch screen 1014 and the display unit 1004, but of course, in some embodiments, the touch screen 1014 and the display unit 1004 may be taken as two separate components.
When the display unit 1004 and the touch panel are superimposed on each other in the form of layers to form the touch screen 1014, the display unit 1004 can function as an input device and an output device, and when functioning as an output device, can be used to display images, for example, to enable playing of various videos. The Display unit 1004 may include at least one of a Liquid Crystal Display (LCD), a Thin Film Transistor Liquid Crystal Display (TFT-LCD), an Organic Light Emitting Diode (OLED) Display, an Active Matrix Organic Light Emitting Diode (AMOLED) Display, an In-Plane Switching (IPS) Display, a flexible Display, a 3D Display, and the like. Some of these displays may be configured to be transparent to allow a user to view from the outside, which may be referred to as transparent displays, and the electronic device may include two or more display units (or other display devices) according to a particular desired embodiment, for example, the electronic device may include an external display unit (not shown in fig. 10) and an internal display unit (not shown in fig. 10).
The rf unit 1005 may be used for transceiving information or receiving and transmitting signals during a call. Typically, the radio frequency circuitry includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. Further, the radio frequency unit 1005 may also communicate with a network device and other devices through wireless communication.
The audio circuitry 1006, speaker 1007, microphone 1008 can provide an audio interface between a user and the electronic device. The audio circuit 1006 may transmit the converted electrical signal of the received audio data to the speaker 1007, and the converted electrical signal is converted into a sound signal by the speaker 1007 and output. On the other hand, the microphone 1008 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1006 and then converted into audio data, and then the audio data is processed by the audio data output processor 1001, and then sent to another electronic device through the radio frequency unit 1005, or the audio data is output to the memory 1002 for further processing.
WiFi belongs to a short-distance wireless transmission technology, and the electronic device can help the user send and receive e-mails, browse webpages, access streaming media, and the like through the WiFi module 1009, which provides the user with wireless broadband internet access. Although fig. 10 shows the WiFi module 1009, it is understood that it does not belong to the essential constitution of the electronic device, and may be omitted entirely as needed within the scope not changing the essence of the invention.
Bluetooth is a short-range wireless communication technology. By using the bluetooth technology, the communication between mobile communication electronic devices such as a palm computer, a notebook computer, a mobile phone and the like can be effectively simplified, the communication between the devices and the Internet (Internet) can also be successfully simplified, the data transmission between the electronic devices and the Internet becomes faster and more efficient through the bluetooth module 1010, and the way is widened for wireless communication. Bluetooth technology is an open solution that enables wireless transmission of voice and data. Although fig. 10 shows the bluetooth module 1010, it is understood that it does not belong to the essential constitution of the electronic device and may be omitted entirely as needed within the scope not changing the essence of the invention.
The electronic device may also include a power source 1011 (such as a battery) for receiving external power or powering various components within the electronic device. Preferably, the power source 1011 may be logically connected to the processor 901 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system.
The electronic device may further include an external interface 1012, where the external interface 1012 may include a standard Micro USB interface, and may also include a multi-pin connector, which may be used to connect the electronic device to communicate with other devices, and may also be used to connect a charger to charge the electronic device.
Although not shown, the electronic device in the embodiment of the present application may further include a camera, a flash, and other possible functional modules, which are not described herein again.
Based on the same inventive concept, the present application also provides a storage medium, which may be a computer-readable storage medium, and the storage medium stores computer instructions, which, when executed on a computer, cause the computer to execute the steps of the method for controlling switching network environment as described above.
Based on the same inventive concept, embodiments of the present application further provide a chip system, where the chip system includes a processor and may further include a memory, and is configured to implement the steps of the method for controlling switching of a network environment as described above, or implement the steps of the method for controlling switching of a network environment as described above. The chip system may be formed by a chip, and may also include a chip and other discrete devices.
In some possible embodiments, the aspects of the method for controlling switching network environment provided by the embodiments of the present application may also be implemented in the form of a program product including program code for causing a computer to perform the steps of the method for controlling switching network environment according to the various exemplary embodiments of the present application described above when the program product is run on a computer.
Wherein the program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable signal medium may be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method of controlling a handover network environment, the method comprising:
acquiring an access request which is initiated by a target application client in terminal equipment and used for requesting to access a first network environment, wherein the access request comprises first domain name information corresponding to the first network environment, and the first network environment is a network environment corresponding to an installation version of the target application client in the terminal equipment;
determining second IP address information corresponding to a second network environment which the target application client needs to access according to a network switching corresponding relation and the first domain name information corresponding to the target application client, wherein the network switching corresponding relation comprises first network address information and corresponding second network address information, the first network address information is network address information corresponding to the first network environment, and the second network address information is network address information corresponding to the second network environment;
and configuring the second IP address information to the target application client so that the target application client accesses the second network environment according to the second IP address information.
2. The method according to claim 1, wherein obtaining second IP address information corresponding to a second network environment that the target application client needs to access according to the network handover correspondence corresponding to the target application client and the first domain name information includes:
determining second network address information corresponding to the first domain name information from the network switching corresponding relation;
determining second domain name information matched with the second network address information, and sending the second domain name information to a domain name system server to request the domain name system server to carry out domain name resolution on the second domain name information;
and receiving second IP address information which is returned by the domain name system server and corresponds to the second domain name information.
3. The method according to claim 1, wherein obtaining second IP address information corresponding to a second network environment that the target application client needs to access according to the network handover correspondence corresponding to the target application client and the first domain name information includes:
sending the first domain name information to a domain name system server to request the domain name system server to carry out domain name resolution on the first domain name information;
receiving first IP address information corresponding to the first domain name information returned by the domain name system server;
and searching an IP address forwarding relation table to determine the IP address information to be forwarded corresponding to the first IP address information as the second IP address information, wherein the IP address forwarding relation table is determined according to the network switching corresponding relation.
4. The method of claim 3, wherein the method further comprises:
acquiring first network address information and corresponding second network address information in the network switching corresponding relation;
determining a first IP address and a first port corresponding to the first network address information, and determining a second IP address and a second port corresponding to the second network address information;
configuring the first IP address and the first port as inputs of an iptables forwarding table, and configuring the second IP address and the second port as outputs of the iptables forwarding table;
and determining the configured iptables forwarding table as the IP address translation relation table.
5. The method of claim 3, wherein the method further comprises:
when the network where the terminal equipment is located is detected to be switched, acquiring updated IP address information corresponding to the IP address information to be forwarded in the IP address forwarding relation table after the network is switched;
and replacing the corresponding IP address information to be forwarded with the updated IP address information so as to update the IP address forwarding relation table.
6. The method according to any of claims 1-5, wherein the network handover correspondence is derived from an operation performed on a network client in the terminal device.
7. The method of claim 6, wherein the network handover correspondence is obtained as follows:
responding to configuration triggering operation aiming at the target application client, and displaying a target conversion configuration interface corresponding to the target application client through the network client, wherein the target conversion configuration interface comprises a source input area and a target input area;
obtaining the first network address information in response to a first input operation for the source input area, and obtaining the second network address information in response to a second input operation for the destination input area;
and determining the network switching corresponding relation according to the first network address information and the second network address information.
8. An apparatus for controlling a handover network environment, the apparatus comprising:
an obtaining module, configured to obtain an access request, which is initiated by a target application client in a terminal device and used for requesting access to a first network environment, where the access request includes first domain name information corresponding to the first network environment, and the first network environment is a network environment corresponding to an installation version of the target application client in the terminal device;
a determining module, configured to determine, according to a network switching correspondence corresponding to the target application client and the first domain name information, second IP address information corresponding to a second network environment that the target application client needs to access, where the network switching correspondence includes first network address information and corresponding second network address information, the first network address information is network address information corresponding to the first network environment, and the second network address information is network address information corresponding to the second network environment;
and the configuration module is used for configuring the second IP address information to the target application client so that the target application client accesses the second network environment according to the second IP address information.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps comprised by the method according to any one of claims 1-7 when executing the computer program.
10. A storage medium storing computer-executable instructions for causing a computer to perform the steps comprising the method of any one of claims 1-7.
CN202010707240.0A 2020-07-21 2020-07-21 Method and device for controlling switching network environment and electronic equipment Active CN114040025B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010707240.0A CN114040025B (en) 2020-07-21 2020-07-21 Method and device for controlling switching network environment and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010707240.0A CN114040025B (en) 2020-07-21 2020-07-21 Method and device for controlling switching network environment and electronic equipment

Publications (2)

Publication Number Publication Date
CN114040025A true CN114040025A (en) 2022-02-11
CN114040025B CN114040025B (en) 2023-10-10

Family

ID=80134062

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010707240.0A Active CN114040025B (en) 2020-07-21 2020-07-21 Method and device for controlling switching network environment and electronic equipment

Country Status (1)

Country Link
CN (1) CN114040025B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114760298A (en) * 2022-03-18 2022-07-15 中国人寿保险股份有限公司 Service request response method and device, electronic equipment and storage medium
CN114785781A (en) * 2022-03-22 2022-07-22 阿里巴巴(中国)有限公司 Data access method and device
CN116662016A (en) * 2023-07-25 2023-08-29 太平金融科技服务(上海)有限公司 Port switching method, device, computer equipment, storage medium and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2806713A1 (en) * 2012-02-23 2013-08-23 Time Warner Cable, Inc. Apparatus and methods for content distribution to packet-enabled devices via a network bridge
CN105391811A (en) * 2014-08-29 2016-03-09 腾讯科技(深圳)有限公司 DNS (domain name resolution) method, access method for application server, and terminal
CN107634851A (en) * 2017-08-11 2018-01-26 珠海金山网络游戏科技有限公司 A kind of method of mobile terminal dynamic configuration server
CN109451084A (en) * 2018-09-14 2019-03-08 华为技术有限公司 A kind of service access method and device
CN109525679A (en) * 2019-01-08 2019-03-26 郑州云海信息技术有限公司 A kind of web file server test method based on http protocol

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2806713A1 (en) * 2012-02-23 2013-08-23 Time Warner Cable, Inc. Apparatus and methods for content distribution to packet-enabled devices via a network bridge
CN105391811A (en) * 2014-08-29 2016-03-09 腾讯科技(深圳)有限公司 DNS (domain name resolution) method, access method for application server, and terminal
CN107634851A (en) * 2017-08-11 2018-01-26 珠海金山网络游戏科技有限公司 A kind of method of mobile terminal dynamic configuration server
CN109451084A (en) * 2018-09-14 2019-03-08 华为技术有限公司 A kind of service access method and device
CN109525679A (en) * 2019-01-08 2019-03-26 郑州云海信息技术有限公司 A kind of web file server test method based on http protocol

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114760298A (en) * 2022-03-18 2022-07-15 中国人寿保险股份有限公司 Service request response method and device, electronic equipment and storage medium
CN114785781A (en) * 2022-03-22 2022-07-22 阿里巴巴(中国)有限公司 Data access method and device
CN114785781B (en) * 2022-03-22 2024-03-26 阿里巴巴(中国)有限公司 Data access method and device
CN116662016A (en) * 2023-07-25 2023-08-29 太平金融科技服务(上海)有限公司 Port switching method, device, computer equipment, storage medium and program product
CN116662016B (en) * 2023-07-25 2023-10-20 太平金融科技服务(上海)有限公司 Port switching method, device, computer equipment, storage medium and program product

Also Published As

Publication number Publication date
CN114040025B (en) 2023-10-10

Similar Documents

Publication Publication Date Title
CN114040025B (en) Method and device for controlling switching network environment and electronic equipment
WO2015135328A1 (en) Virtual machine migration control method and apparatus
CN108345543B (en) Data processing method, device, equipment and storage medium
US10824449B2 (en) Application running method and device
CN108595218B (en) Method and device for loading dynamic library of system
CN106502703B (en) Function calling method and device
US11579899B2 (en) Method and device for dynamically managing kernel node
CN106534281B (en) A kind of response method of request of data, apparatus and system
US10152660B2 (en) Smart card read/write method and apparatus
WO2019001348A1 (en) Object interception method, terminal, server and storage medium
US20190317783A1 (en) Methods, apparatus, and systems for providing access to serial ports of virtual machines in self-deployed virtual applications
EP3877845A1 (en) Preloading of application on a user device based on content received by the user device
CN109428839B (en) CDN scheduling method, device and system
US20200334317A1 (en) Methods and systems for caching and searching for search results
WO2013159632A1 (en) Method, firewall, terminal and readable storage medium for implementing security protection
WO2014169616A1 (en) Systems and methods for accessing network data
CN113965543B (en) Access method, device and storage medium of application server
CN111459609B (en) Virtual machine safety protection method and device and electronic equipment
US9442825B2 (en) Method and device for signing program crash
WO2015062326A1 (en) Page access control method, device and system
CN111400072B (en) Interface calling method, storage medium and related equipment
KR101614920B1 (en) Sharing input/output(I/O) resources across multiple computing systems and/or environments
US9904475B2 (en) Systems and methods for setting the operating system properties for a storage device
CN111475843B (en) Data processing method and related device
CN116089924A (en) Method, device, computer equipment and storage medium for accessing permission data

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
GR01 Patent grant
GR01 Patent grant