Disclosure of Invention
The invention provides a method, a device, electronic equipment and a storage medium for reducing occupation of extranet resources, which are used for solving the defects that in the prior art, downloading data from an extranet by intranet equipment may influence the use of extranet resources by other intranet services and influence the normal operation of intranet services, avoiding influence of the downloading data by the intranet equipment on the use of extranet resources by other intranet services, and being beneficial to ensuring the normal operation of the intranet services.
The invention provides a method for reducing the occupation of external network resources, which comprises the following steps:
generating prompt information according to target data stored in the intranet server; the prompt information is used for prompting the intranet equipment that the target data are stored in the intranet server;
and sending the prompt information to the intranet equipment so that the intranet equipment acquires the target data from the intranet server according to the prompt information.
On the basis, the device for reducing the occupation of the resources of the external network generates the prompt information according to the target data stored in the internal network server, and comprises the following steps:
and generating a download link for downloading the target data according to the storage position of the target data in the intranet server, wherein the download link is used as the prompt information.
On the basis, before generating a download link for downloading the target data according to the storage location of the target data in the intranet server, the method for reducing the occupation of resources of an external network further includes:
determining a target encryption value of the target data according to a preset encryption algorithm; the preset encryption algorithm comprises at least one of the following: md5 encryption algorithm, sha1 encryption algorithm;
according to the target encryption value, searching a subdirectory matched with the target encryption value under a root directory corresponding to a storage area for storing the target data to serve as a matched subdirectory;
determining a storage position for storing the target data according to the matching subdirectory;
and the subdirectories under the root directory are named by characters in the preset encryption algorithm encryption value.
On the basis, searching a subdirectory matched with the target encryption value under a root directory corresponding to a storage area for storing the target data according to the target encryption value to serve as a matching subdirectory, and the method for reducing the occupation of external network resources comprises the following steps:
circularly executing the searching operation according to the target encryption value until the subdirectory does not exist under the subdirectory searched for this time, and taking the subdirectory searched for this time as the matching subdirectory;
wherein the lookup operation comprises:
when the target encryption value is executed for the first time, searching a subdirectory named by the first character of the target encryption value under the root directory as the subdirectory searched for this time;
and when the program is not executed for the first time, determining the subdirectory number corresponding to the subdirectory searched for the previous time, acquiring characters with the number of digits equal to the subdirectory number from the target encryption value to be used as the name of the subdirectory of the current time, and searching the subdirectory named by the name of the subdirectory of the current time under the subdirectory searched for the previous time to be used as the subdirectory searched for the current time.
The invention provides a method for reducing the occupation of external network resources, wherein on the basis, the step of determining the storage position for storing the target data according to the matching subdirectory comprises the following steps:
if the number of files contained in the matching subdirectory is larger than a preset threshold value, creating a new subdirectory under the matching subdirectory according to the target encryption value, and taking a storage position corresponding to the new subdirectory as a storage position for storing the target data;
and if the number of the files contained in the matching subdirectory is less than or equal to the preset threshold, taking the storage position corresponding to the matching subdirectory as the storage position for storing the target data.
The invention provides a method for reducing occupation of resources of an external network, and on the basis, the sending of the prompt information to the internal network equipment comprises the following steps:
and sending the prompt information to the intranet equipment through the heartbeat connection between the intranet server and the intranet equipment.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of any one of the above methods for reducing the occupation of the external network resources.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method for reducing occupation of external network resources as described in any of the above.
The present invention also provides a computer program which, when executed by a processor, performs the steps of the method for reducing occupation of resources of an external network as described in any of the above.
The invention provides a method, a device, electronic equipment and a storage medium for reducing occupation of external network resources, wherein an intranet server generates prompt information according to stored target data, so that the intranet equipment can download required target data from the intranet server according to the prompt information, the target data does not need to be downloaded through an external network, the influence of the data downloaded by the intranet equipment on the use of the external network resources by other intranet services is avoided, and the normal operation of intranet services is favorably ensured.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
In contrast, fig. 1 is a schematic diagram of a conventional network architecture provided in this embodiment, and referring to fig. 1, in the conventional network architecture, when a device of a local area network a and a device of a local area network B (i.e., an intranet device) want to search and download software, a server connected to an external software provider through a company internal network (i.e., an intranet) is required. The entity and information downloaded by the software are transmitted through the bandwidth of the extranet of the company. Under the condition that the number of intranet devices is large, huge flow can be generated, and the access of a normal intranet to an extranet is blocked.
To solve the technical problem, fig. 2 is a schematic diagram of an improved network architecture provided in this embodiment, and compared with the existing network architecture, a local information server (i.e., an intranet server for providing data to an intranet device) is installed in an intranet. The terminal requests data (e.g. software) to acquire the desired data (e.g. software) by only requesting the intranet server (i.e. intranet server) without passing through the extranet, so that occupation of extranet resources is avoided, and normal operation of intranet services is guaranteed.
The following describes a process of downloading target data through an intranet:
fig. 3 is a schematic flowchart of a method for reducing occupation of resources of an external network according to this embodiment, where the method for reducing occupation of resources of the external network may be executed by an intranet server, and referring to fig. 3, the method for reducing occupation of resources of the external network includes:
step 301: generating prompt information according to target data stored in the intranet server; the prompt information is used for prompting the intranet equipment that the target data are stored in the intranet server;
step 302: and sending the prompt information to the intranet equipment so that the intranet equipment acquires the target data from the intranet server according to the prompt information.
The target data may be data that any intranet device needs to obtain from an extranet, such as data of files, software, and the like. The intranet may include at least one local area network. The prompt information is used for prompting the target data stored in the intranet server of the intranet equipment, so that the intranet equipment does not need to download the target data through an extranet, and occupation of extranet resources is avoided.
It can be understood that, after receiving the prompt information, the intranet device may directly request the target data from the intranet server through the intranet, or may download the target data according to a download link obtained by the prompt information, which is not specifically limited in this embodiment.
According to the method for reducing occupation of the resources of the external network, the internal network server generates the prompt information according to the stored target data, so that the internal network equipment can download the required target data from the internal network server according to the prompt information, the target data does not need to be downloaded through the external network, the situation that the internal network equipment downloads the data to influence the use of other internal network services on the resources of the external network is avoided, and the normal operation of the internal network services is favorably ensured.
Further, on the basis of the above embodiment, the generating of the prompt information according to the target data stored in the intranet server includes:
and generating a download link for downloading the target data according to the storage position of the target data in the intranet server, wherein the download link is used as the prompt information.
In this embodiment, the download link of the target data can be directly used as the prompt information, and the download link is pushed to the intranet terminal, so that the intranet terminal can directly download the target data based on the download link, and an approach for the intranet terminal to quickly download the target data is provided.
Further, on the basis of the foregoing embodiments, before generating a download link for downloading the target data according to the storage location of the target data in the intranet server, the method further includes:
determining a target encryption value of the target data according to a preset encryption algorithm; the preset encryption algorithm comprises at least one of the following: md5 encryption algorithm, sha1 encryption algorithm;
according to the target encryption value, searching a subdirectory matched with the target encryption value under a root directory corresponding to a storage area for storing the target data to serve as a matched subdirectory;
and determining a storage position for storing the target data according to the matching subdirectory.
In order to improve the efficiency of searching the target data, subdirectories named by characters forming the encryption value of the preset encryption algorithm can be established under the root directory of the stored data, and the target data is stored in the corresponding storage positions of the subdirectories. In the subsequent process of searching for a certain target data, the target data can be quickly searched directly through the encrypted value of the target data.
For example, if the characters composing the encryption value of md5 include letters, numbers, etc., then a certain letter (e.g., a) or a certain number (e.g., 3) can be used as the name of a certain subdirectory under the root directory. When the target data is stored, the subdirectory for storing the target data can be determined according to the target encryption value of the target data, and correspondingly, when the target data needs to be searched, the target data can be quickly and directly searched through the target encryption value.
In the embodiment, the subdirectory is named by the characters forming the encryption value of the preset encryption algorithm, and the data stored under the root directory is stored according to the encryption value sub-directory, so that the query range can be reduced according to the target encryption value when the data under the root directory is queried, and the query efficiency is improved.
Further, on the basis of the foregoing embodiments, the searching, according to the target encryption value, for a subdirectory matched with the target encryption value under a root directory corresponding to a storage area for storing the target data, as a matched subdirectory, includes:
circularly executing the searching operation according to the target encryption value until the subdirectory does not exist under the subdirectory searched for this time, and taking the subdirectory searched for this time as the matching subdirectory;
wherein the lookup operation comprises:
when the target encryption value is executed for the first time, searching a subdirectory named by the first character of the target encryption value under the root directory as the subdirectory searched for this time;
and when the program is not executed for the first time, determining the subdirectory number corresponding to the subdirectory searched for the previous time, acquiring characters with the number of digits equal to the subdirectory number from the target encryption value to be used as the name of the subdirectory of the current time, and searching the subdirectory named by the name of the subdirectory of the current time under the subdirectory searched for the previous time to be used as the subdirectory searched for the current time.
In the present embodiment, the following rules are substantially set: the characters naming any subdirectory in any subdirectory level are the same as the characters where the median of a certain encryption value is equal to the level of any subdirectory. That is, the characters in level 1 subdirectories represent the 1 st bit character of the cryptographic value, the characters in level 2 subdirectories represent the 2 nd bit character of the cryptographic value, and so on. For example, the subdirectory query process corresponding to the cryptographic value "ABGR … …" may include: the subdirectory named A in the level 1 subdirectory is queried in turn, the subdirectory named B is queried under the subdirectory named A, the subdirectory named G is queried under the subdirectory named B, the subdirectory named R is queried under the subdirectory named G, and so on.
Accordingly, the target data stored through the above process may be generated in the following form when the download link is generated: the first bit of the download path/destination cryptographic value/the second bit of the destination cryptographic value/… … corresponding to the root directory.
Fig. 4 is a schematic diagram of a download link generation process provided in this embodiment, and referring to fig. 4, the process includes:
taking the predetermined encryption algorithm md5 as an example, when the administrator of the intranet server has uploaded the target data (e.g., a piece of local software), the piece of software is saved in the intranet server. And generating a download link according to the md5 encrypted value and the storage path of the software.
The process of generating the download link may include:
the md5 encryption value of the software is calculated, and the md5 encryption value is a unique character string consisting of 32-bit characters.
In order to clearly locate the software, the download link is spliced with the first, second, third, etc. encrypted values of md5 of the software by the backslash number according to the download file path (corresponding to the root directory) configured in the configuration file. I.e. can be generated according to the following formula: download link (configurable)/md 5 encryption value first bit/md 5 encryption value second bit/… ….
In the embodiment, when the target data is stored, the matching subdirectories are searched and determined layer by layer according to the target encryption value, the storage position of the target data is determined according to the matching subdirectories, and then the subdirectories can be inquired layer by layer according to the target encryption value in the process of inquiring the target data, so that the subdirectories in which the target data is stored can be rapidly positioned.
Further, on the basis of the foregoing embodiments, the determining, according to the matching sub-directory, a storage location for storing the target data includes:
if the number of files contained in the matching subdirectory is greater than a preset threshold value, creating a new subdirectory under the matching subdirectory according to the target encryption value, and taking a storage position corresponding to the new subdirectory as a storage position for storing the target data;
and if the number of the files contained in the matching subdirectory is less than or equal to the preset threshold, taking the storage position corresponding to the matching subdirectory as the storage position for storing the target data.
When the target data is stored, after a certain sub-matching directory is matched, the target data can be directly stored in the matching sub-directory, or a new sub-directory is created, and the target data is stored in the new sub-directory.
Whether the new subdirectory is used for storing the target data is determined mainly according to the number of files stored in the matching subdirectory, for example, when the number of files in the matching subdirectory is large, the new subdirectory can be used for storing the target data, so that the time for searching the target data in the matching subdirectory with large number of files is saved, and the efficiency for searching the target data is improved.
In this embodiment, when the target data is stored, the new subdirectory is created under the matching subdirectory, so that the target data can be prevented from being stored in the matching subdirectory with a large number of files, and the query efficiency of subsequently querying the target data is improved.
Further, on the basis of the foregoing embodiments, the sending the prompt information to the intranet device includes:
and sending the prompt information to the intranet equipment through the heartbeat connection between the intranet server and the intranet equipment.
Intranet server and intranet equipment can guarantee through the heartbeat connection that intranet server and intranet equipment can keep long-time connection to after having updated the target data in intranet server, can in time inform intranet equipment through the heartbeat connection.
In this embodiment, the prompt information is sent to the intranet equipment through heartbeat connection, so that the intranet equipment can obtain the prompt information in time, and the target data can be obtained in time after the intranet server updates the target data.
With software as target data, fig. 5 is a schematic diagram of a distribution process of the software provided in this embodiment, referring to fig. 5, when the software is distributed, an administrator connects the download link for downloading the software with the heartbeat of the intranet device through the software server (i.e., the intranet server), and notifies the intranet device that a piece of software needs to be downloaded, and the intranet device requests the local software through the download link. The software downloading is completed through the intranet flow instead of the external internet, so that the extranet flow is greatly saved.
The invention distributes and downloads the local software, can save the occupation of the external network flow, thereby reducing the occupation of the bandwidth to the maximum extent under the condition of insufficient internal network bandwidth of a company and not influencing the development of main services.
Fig. 6 is a block diagram of a structure of an apparatus for reducing occupation of external network resources according to this embodiment, and referring to fig. 6, the apparatus for reducing occupation of external network resources includes a generating module 601 and a sending module 602, wherein,
a generating module 601, configured to generate a prompt message according to target data stored in the intranet server; the prompt information is used for prompting the intranet equipment that the target data are stored in the intranet server;
a sending module 602, configured to send the prompt information to the intranet device, so that the intranet device obtains the target data from the intranet server according to the prompt information.
The method for reducing occupation of external network resources provided in this embodiment is applicable to the method for reducing occupation of external network resources provided in the foregoing embodiments, and is not described herein again.
The invention provides a device for reducing occupation of resources of an external network, wherein an internal network server generates prompt information according to stored target data, so that internal network equipment can download required target data from the internal network server according to the prompt information, the target data does not need to be downloaded through the external network, the influence of the data downloaded by the internal network equipment on the use of the resources of the external network by other internal network services is avoided, and the normal operation of the internal network services is favorably ensured.
On the basis, the device for reducing the occupation of the resources of the external network generates the prompt information according to the target data stored in the internal network server, and comprises the following steps:
and generating a download link for downloading the target data according to the storage position of the target data in the intranet server, wherein the download link is used as the prompt information.
On the basis, before generating a download link for downloading the target data according to the storage location of the target data in the intranet server, the apparatus for reducing the occupation of resources of an external network further includes:
determining a target encryption value of the target data according to a preset encryption algorithm; the preset encryption algorithm comprises at least one of the following: md5 encryption algorithm, sha1 encryption algorithm;
according to the target encryption value, searching a subdirectory matched with the target encryption value under a root directory corresponding to a storage area for storing the target data to serve as a matched subdirectory;
determining a storage position for storing the target data according to the matching subdirectory;
and the subdirectories under the root directory are named by characters in the preset encryption algorithm encryption value.
On the basis, the device for reducing the occupation of external network resources searches subdirectories matched with the target encryption value under a root directory corresponding to a storage area for storing the target data according to the target encryption value, and the device used for searching the subdirectories matched with the target encryption value as the matched subdirectories comprises the following steps:
circularly executing the searching operation according to the target encryption value until the subdirectory does not exist under the subdirectory searched for this time, and taking the subdirectory searched for this time as the matching subdirectory;
wherein the lookup operation comprises:
when the target encryption value is executed for the first time, searching a subdirectory named by the first character of the target encryption value under the root directory as the subdirectory searched for this time;
and when the program is not executed for the first time, determining the subdirectory number corresponding to the subdirectory searched for the previous time, acquiring characters with the number of digits equal to the subdirectory number from the target encryption value to be used as the name of the subdirectory of the current time, and searching the subdirectory named by the name of the subdirectory of the current time under the subdirectory searched for the previous time to be used as the subdirectory searched for the current time.
The invention provides a device for reducing the occupation of external network resources, wherein on the basis, the determining of the storage position for storing the target data according to the matching subdirectory comprises the following steps:
if the number of files contained in the matching subdirectory is greater than a preset threshold value, creating a new subdirectory under the matching subdirectory according to the target encryption value, and taking a storage position corresponding to the new subdirectory as a storage position for storing the target data;
and if the number of the files contained in the matching subdirectory is less than or equal to the preset threshold, taking the storage position corresponding to the matching subdirectory as the storage position for storing the target data.
The invention provides a device for reducing occupation of resources of an external network, and on the basis, the sending of the prompt information to the internal network equipment comprises the following steps:
and sending the prompt information to the intranet equipment through the heartbeat connection between the intranet server and the intranet equipment.
Fig. 7 illustrates a physical structure diagram of an electronic device, and as shown in fig. 7, the electronic device may include: a processor (processor)710, a communication Interface (Communications Interface)720, a memory (memory)730, and a communication bus 740, wherein the processor 710, the communication Interface 720, and the memory 730 communicate with each other via the communication bus 740. Processor 710 may invoke logic instructions in memory 730 to perform a method for reducing occupation of resources of an external network, the method comprising:
generating prompt information according to target data stored in the intranet server; the prompt information is used for prompting the intranet equipment that the target data are stored in the intranet server;
and sending the prompt information to the intranet equipment so that the intranet equipment acquires the target data from the intranet server according to the prompt information.
In addition, the logic instructions in the memory 730 can be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, which when executed by a computer, enable the computer to perform the method for reducing occupation of external network resources provided by the above methods, the method comprising:
generating prompt information according to target data stored in the intranet server; the prompt information is used for prompting the intranet equipment that the target data are stored in the intranet server;
and sending the prompt information to the intranet equipment so that the intranet equipment acquires the target data from the intranet server according to the prompt information.
In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, can implement the method for reducing occupation of external network resources provided by the above methods, where the method includes:
generating prompt information according to target data stored in the intranet server; the prompt information is used for prompting the intranet equipment that the target data are stored in the intranet server;
and sending the prompt information to the intranet equipment so that the intranet equipment acquires the target data from the intranet server according to the prompt information.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.