Resource acquisition method and device
By using the resource configuration table in the proxy gateway to convert the target information and proxy address information, the complex configuration, high cost and complex architecture problems in multi-terminal resource access docking are solved, and the simplicity and low cost of resource acquisition are achieved.
Patent Information
- Application Number
- CN202411456885.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-17
AI Technical Summary
The prior art has problems such as complex configuration, high cost and complex architecture in multi-end resource access docking, especially in proxy solutions and storage solutions.
By using the resource configuration table in the proxy gateway to convert the target information and proxy address information, resource users can obtain the resources of different resource providers through the proxy gateway, solving the problem of multi-terminal resource access docking.
It realizes the configuration and architecture of resource acquisition, reduces the implementation cost, and avoids the high cost and architectural complexity of complex configurations of reverse proxy routing rules and storage solutions.
Smart Images

Figure CN119484631A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a resource acquisition method and device. Background Art
[0002] In actual applications, when a resource user connects to multiple resource providers, there will be problems with multi-terminal resource access connection due to the inconsistency of the resource access methods provided by each resource provider.
[0003] In the related art, a proxy solution or a storage solution is mainly used to solve the multi-terminal resource access docking problem, so that resource users can obtain resources from different resource providers.
[0004] However, since the proxy solution requires the configuration of complex reverse proxy routing rules, and the storage solution requires redundant storage of proxy resources and additional deployment of streaming media services, the current resource acquisition method has problems such as complex configuration, high cost and complex architecture. Summary of the invention
[0005] In view of the above problems, the embodiments of the present application provide a resource acquisition method and device to overcome the above problems or at least partially solve the above problems.
[0006] In a first aspect of an embodiment of the present application, a resource acquisition method is provided, which is applied to a proxy gateway, and the method includes: Receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; Obtaining the identifier of the resource provider and the type of the target resource; According to the identifier of the resource provider and the type of the target resource, target resource configuration data is obtained from a pre-established resource configuration table, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; Generate proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; The proxy address information is sent to a resource user, so that the resource user generates and sends a first resource request carrying the proxy address information, where the first resource request is used to obtain the target resource through a proxy service provided by the proxy gateway.
[0007] A second aspect of the embodiments of the present application provides a resource acquisition method, which is applied to a resource user, and the method includes: Receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; Obtaining the identifier of the resource provider and the type of the target resource; According to the identifier of the resource provider and the type of the target resource, target resource configuration data is obtained from a resource configuration table of the proxy gateway, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; Generate proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; A first resource request carrying the proxy address information is generated and sent, where the first resource request is used to obtain the target resource through a proxy service provided by the proxy gateway.
[0008] According to a third aspect of the embodiments of the present application, a resource acquisition device is provided, which is applied to a proxy gateway. The device includes: A first receiving module is used to receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; A first acquisition module, used to acquire the identifier of the resource provider and the type of the target resource; A second acquisition module is used to acquire target resource configuration data from a pre-established resource configuration table according to the identifier of the resource provider and the type of the target resource, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; A first generating module, configured to generate proxy address information corresponding to the target resource according to a target encoding string in the target resource configuration data, a preset data transmission protocol, and external address information and port information of the proxy gateway; The first sending module is used to send the proxy address information to the resource user, so that the resource user generates and sends a first resource request carrying the proxy address information, and the first resource request is used to obtain the target resource through the proxy service provided by the proxy gateway.
[0009] In a fourth aspect of the embodiments of the present application, a resource acquisition device is provided, which is applied to a resource user, and the device includes: An information receiving module, used to receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; A data acquisition module, used to acquire the identifier of the resource provider and the type of the target resource; A configuration acquisition module, used to acquire target resource configuration data from a resource configuration table of a proxy gateway according to the identifier of the resource provider and the type of the target resource, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; A proxy address generation module, used to generate the proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; The resource request module is used to generate and send a first resource request carrying the proxy address information, wherein the first resource request is used to obtain the target resource through the proxy service provided by the proxy gateway.
[0010] According to a fifth aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the resource acquisition method described in the first aspect or the second aspect are implemented.
[0011] In a sixth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the resource acquisition method described in the first aspect or the second aspect are implemented.
[0012] The embodiments of the present application include the following advantages: the proxy gateway queries the resource configuration data for different types of resources of different resource providers in the resource configuration table, finds the target resource configuration data, and then generates the proxy address information according to the target encoding character string in the target resource configuration data, thereby avoiding the configuration complexity problem caused by introducing the reverse proxy routing rule; and by converting the target information into proxy address information that conforms to the preset data transmission protocol and the external address information and port information of the proxy gateway, and sending the proxy address information to the resource user, the resource user can uniformly obtain resources from different resource providers through the proxy service provided by the proxy gateway, thereby solving the problem of multi-terminal resource access docking of the resource user, and avoiding the high cost and complex architecture problems caused by introducing the storage solution, thereby realizing a resource acquisition solution with simple configuration and architecture and low implementation cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0014] Figure 1 is an implementation flow chart of a resource acquisition method in an embodiment of the present application; Figure 2 It is a schematic diagram of a multi-terminal view proxy implementation process in an embodiment of the present application; Figure 3 It is a schematic diagram of another multi-terminal view proxy implementation process in an embodiment of the present application; Figure 4 is a schematic diagram of a resource acquisition related resource request in an embodiment of the present application; Figure 5 This is a schematic diagram of a resource acquisition implementation process in an embodiment of the present application; Figure 6 is a schematic diagram of a different proxy scenario in an embodiment of the present application; Figure 7 is an implementation flow chart of another resource acquisition method in an embodiment of the present application; Figure 8 is a structural diagram of a resource acquisition device in an embodiment of the present application; Fig. 9 is a structural diagram of another resource acquisition device in an embodiment of the present application; Fig.10 It is a schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0015] To facilitate understanding of the technical solutions provided by the present application, the main technical concepts involved in the embodiments of the present application are briefly described below.
[0016] Web side: applications or services accessed and used by browsers.
[0017] Proxy gateway: a network intermediary that acts as an intermediary between the client and the server, performing multiple functions to improve network security, privacy protection, performance optimization, and protocol conversion, and can shield differences in server resource access.
[0018] Uniform Resource Locator (URL): is a string used to identify and locate resources on the Internet. It provides a standardized way to represent the address of resources so that browsers or other client software can find and access these resources. URLs can point to various types of resources such as web pages, images, videos, files, etc.
[0019] Real Time Streaming Protocol (RTSP) is an application layer protocol in the Transmission Control Protocol / Internet Protocol (TCP / IP) protocol system. This protocol defines how one-to-many applications can effectively transmit multimedia data over IP networks.
[0020] FTPS: is an extended protocol that adds support for Transport Layer Security and Secure Sockets Layer encryption protocols to the commonly used file transfer protocol.
[0021] Reverse proxy routing rules: The core is to forward and process requests through the location directive and proxy_pass directive in the Nginx configuration file. The proxy_pass directive is used to specify the target address for request forwarding, and the location directive is used to match the URL requested by the client and execute the corresponding processing logic based on the matching result. The matching modes of the location directive include exact matching, prefix matching, and regular matching.
[0022] In actual applications, a resource user may need to connect to multiple resource providers. Taking the video image comprehensive application platform (hereinafter referred to as the video comprehensive platform) as a resource user as an example, a video comprehensive platform usually needs to connect to multiple subordinate viewing systems to obtain resources such as pictures and videos distributed and stored in these subordinate viewing systems, and then realize unified aggregation and presentation of the resources of these subordinate viewing systems.
[0023] The resource access methods (i.e., the resource access types supported) provided by different resource providers may be different. For example, some subordinate view systems will provide Hypertext Transfer Protocol (HTTP) or File Transfer Protocol (FTP) addresses (i.e., access address information) associated with URL extensions such as ".jpg / .png / .mp4 / .avi / ..." for the visual platform to obtain resources such as images or offline videos; while other subordinate view systems will provide transmission interface information (such as private protocol network interfaces) based on real-time data transmission protocols (such as HTTP, RTSP, etc.) for the visual platform to obtain resources such as images or online videos. If the resource access methods provided by the various resource providers connected to the resource user are not unified, multi-terminal resource access connection problems will arise, such as interface access authentication, address format differences, interface call differences, and complex cross-protocol, cross-network, and cross-domain configurations.
[0024] In the related art, proxy solutions or storage solutions are mainly used to solve the multi-terminal resource access docking problem, so that resource users can obtain resources from different resource providers. The following takes the resource user as the visual platform as the resource user and the subordinate view system as the resource provider as an example to illustrate the proxy solution and the storage solution.
[0025] Proxy solution: Based on the reverse proxy module configured by itself, the visual platform configures multiple reverse proxy routing rules for the URL-related access methods provided by each subordinate view system. It usually supports the conversion of HTTP and FTP access methods. For the conversion of access methods of other protocols or access methods related to transmission interfaces, it is necessary to develop customized codes separately according to specific differences. It can be seen that the proxy solution based on reverse proxy routing rules and customized codes has the following main problems: 1. Complex configuration, high development and maintenance costs and difficulty; 2. Insufficient compatibility. When there are special protocol access methods or access methods related to transmission interfaces, custom codes need to be developed, which is labor-intensive and has poor expansion flexibility. 3. The customization method based on rules and codes is not flexible enough and the docking efficiency is low.
[0026] Storage solution: The video platform pulls the resources stored in each subordinate view system to the video platform domain for storage (i.e. redundant storage) to generate the access URL of the video platform domain; for online media access methods such as RTSP (i.e. access methods related to the transmission interface), an independent streaming media service needs to be set up for docking. It can be seen that the storage solution based on redundant storage and streaming media services has the following main problems: 1. Additional storage resources will cause high costs, difficult management and maintenance; 2. Additional deployment of streaming media services will increase the complexity and weight of system architecture interactions.
[0027] In response to the problems existing in the related technologies, the present application provides a resource acquisition method and device, and designs a proxy gateway to convert between target information and proxy address information based on a resource configuration table, so that the resource user can obtain resources from different resource providers based on the proxy address information through the proxy service provided by the proxy gateway, thereby solving the problem of multi-terminal resource access docking, and has good compatibility with URL-related access types (corresponding to the case where the target information is the access address information of the resource) and transmission interface-related access types (corresponding to the case where the target information is the transmission interface information), and the proxy capability of the proxy gateway can be expanded later by writing new resource configuration data to the resource configuration table. In this way, the problems of complex configuration and poor expansion flexibility of the proxy solution, as well as the high cost and complex architecture of the storage solution can be solved, thereby realizing a simplified and lightweight resource acquisition solution that is compatible with URL and transmission interface-related access types.
[0028] In conjunction with the accompanying drawings, a resource acquisition method and device provided by an embodiment of the present application are described in detail through some embodiments and their application scenarios.
[0029] First, refer to Figure 1 As shown, it is a flowchart of an implementation of a resource acquisition method provided in an embodiment of the present application. The resource acquisition method is applied to a proxy gateway. The method may include the following steps: Step S11: receiving target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource.
[0030] The target resource may be a resource of the type of a web page, a picture, a video or a file, and the target information may be associated with a data transmission protocol such as HTTP, Hypertext Transfer Protocol Secure (HTTPS), FTP, FTPS or RTSP.
[0031] In specific implementation, the proxy gateway can periodically obtain target information from the resource provider, or receive target information actively reported by the resource provider, and use the resources associated with the received target information (such as image resources collected by the camera configured by the resource provider) as the target resources.
[0032] Step S12: Obtain the identifier of the resource provider and the type of the target resource.
[0033] In a specific implementation, the proxy gateway may send an information query request to the resource provider to obtain the identifier of the resource provider and the type of the target resource; alternatively, the proxy gateway may obtain the identifier of the resource provider and the type of the target resource by parsing the target information. For example, the proxy gateway may parse the host information (such as IP and port) and the resource extension associated with the URL (such as jpg, jpeg, png, mp4, avi, etc.) from the access address information, and then determine the identifier of the resource provider and the type of the target resource based on a preset mapping relationship between the host information and the identifier of the resource provider and a preset mapping relationship between the resource extension and the type of the resource.
[0034] Step S13: According to the identifier of the resource provider and the type of the target resource, the target resource configuration data is obtained from a pre-established resource configuration table, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data contain different target encoding strings and resource access related data.
[0035] The resource configuration data includes: resource-related information required for mutual conversion between target information and proxy address information, which can be regarded as an abstract expression of proxy rules (ie, conversion rules between target information and proxy address information related to a specific resource type).
[0036] In the specific implementation, the proxy gateway matches the identifier of the resource provider and the type of the target resource with the various resource configuration data in the resource configuration table, for example, searches whether there is resource configuration data containing the identifier of the resource provider and the type of the target resource, and uses the resource configuration data found (i.e., successfully matched) as the target resource configuration data.
[0037] Step S14: Generate proxy address information corresponding to the target resource according to the target encoding character string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway.
[0038] In the specific implementation, it is selected to generate the proxy address information (such as HTTP address or FTP address, etc.) according to the target encoding character string, so that when the proxy address information needs to be converted into the target information later, the target resource configuration data required for the information conversion can be quickly found based on the target encoding character string; it is selected to generate the proxy address information according to the preset data transmission protocol (which the user can freely set according to the needs, such as HTTP or FTP, etc.) and the external address information and port information of the proxy gateway, so that the proxy gateway can provide a unified resource access method for the resource user, that is, the resource user can use a unified resource access method to obtain different types of resources from different resource providers from the proxy gateway, thereby solving the problem of multi-terminal resource access docking of the resource user (such as interface access authentication, address format differences, interface call differences, and complex cross-protocol, cross-network, and cross-domain configuration).
[0039] Step S15: Send the proxy address information to the resource user, so that the resource user generates and sends a first resource request carrying the proxy address information, where the first resource request is used to obtain the target resource through the proxy service provided by the proxy gateway.
[0040] In a specific implementation, the proxy gateway may send the proxy address information to the resource user immediately after generating the proxy address information, or may periodically send the most recently generated proxy address information to the resource user in batches.
[0041] By adopting the technical solution of the embodiment of the present application, the proxy gateway queries the resource configuration data for different types of resources of different resource providers in the resource configuration table, finds the target resource configuration data, and then generates the proxy address information according to the target encoding character string in the target resource configuration data, thereby avoiding the configuration complexity problem caused by introducing the reverse proxy routing rule; and by converting the target information into proxy address information that conforms to the preset data transmission protocol and the external address information and port information of the proxy gateway, and sending the proxy address information to the resource user, the resource user can uniformly obtain resources from different resource providers through the proxy service provided by the proxy gateway, thereby solving the problem of multi-terminal resource access docking of the resource user, and avoiding the high cost and complex architecture problems caused by the introduction of the storage solution, thereby realizing a resource acquisition solution with simple configuration and architecture and low implementation cost.
[0042] As a possible implementation, the method further includes: Step S21: receiving resource access related data for different types of resources of different resource providers sent by resource users, and / or generating resource access related data for different types of resources of different resource providers according to resource related information sent by different resource providers.
[0043] The resource access related data at least includes: an identifier of a resource provider, an identifier of the resource access related data itself, a resource type, and a resource access type.
[0044] In specific implementation, refer to Figure 2 The schematic diagram of a multi-terminal view proxy implementation process shown is that the proxy gateway can provide relevant configuration interfaces for resource users, so that resource users (such as visual platforms) can generate resource access related data corresponding to different types of resources according to their own needs, that is, different types of resources from different resource providers that they need to obtain resources through the proxy service provided by the proxy gateway, and transmit the generated resource access related data to the proxy gateway through the configuration interface, so that the proxy gateway can generate corresponding resource configuration data, thereby achieving accurate configuration for the resource types required by the resource user, which is conducive to reducing the resource configuration data required to be stored in the resource configuration table. Optionally, after receiving the target information, the resource user generates the proxy address information of the relevant resources based on the resource configuration table of the proxy gateway.
[0045] Reference Figure 3 The schematic diagram of another multi-terminal view proxy implementation process shown is that the proxy gateway can also be used as a data collection gateway to receive resource-related information such as resource URLs and target information sent by different resource providers on behalf of resource users, and automatically generate resource access-related data based on the received resource-related information, and then generate corresponding resource configuration data. In this way, dynamic configuration can be achieved for the resource types reported by the resource providers, which is conducive to reducing the configuration work of resource users.
[0046] Step S22: generating different target encoding character strings for the different resource access related data according to the identification of the resource access related data itself.
[0047] In specific implementations, the proxy gateway may directly use the identifier of the resource access-related data itself as the corresponding target encoding string; or it may encode the identifier of the resource access-related data itself and other information (set according to actual needs), so that the obtained target encoding string can additionally serve as an information transmission carrier for the other information.
[0048] Step S23: writing the different resource access related data and their corresponding target encoding character strings into the resource configuration table as different resource configuration data for storage.
[0049] In this implementation, resource users can send resource access related data to achieve accurate configuration for the resource types they need to proxy; the proxy gateway can also serve as a data acquisition gateway to receive resource-related information sent by different resource providers on behalf of resource users, and then achieve dynamic configuration for the resource types reported by the resource providers. It can be understood that at this time the proxy gateway will be responsible for the configuration work and the generation of proxy address information, that is, the resource user only needs to acquire resources based on the proxy address information returned by the proxy gateway, thereby achieving the advantage of the resource user's unconscious business processing for resource acquisition.
[0050] Optionally, generating different target encoding character strings for different resource access related data according to the identifier of the resource access related data itself includes: For each resource access related data, the identifier of the resource access related data itself, the resource type and the resource access type in the resource access related data are encoded to obtain the target encoding character string.
[0051] In specific implementation, the identifier of the resource access related data itself, the resource type and the resource access type in the resource access related data can be encoded into a target encoding string that conforms to the set string format. For example, the string "x1ere2" corresponding to the identifier of the resource access related data itself, the string "image" corresponding to the resource type and the string "url" corresponding to the resource access type are encoded according to the set string format of {identifier}-{resource type}-{access type} to obtain the target encoding string "x1ere2-image-url". In this way, the resource type and resource access type of the related resources can be quickly known through the target encoding string, which is conducive to improving processing efficiency.
[0052] As a possible implementation mode, the resource configuration table is stored in a database; after sending the proxy address information to the resource user, the method further includes: Step S31: intercepting the first resource request sent by the resource user.
[0053] In specific implementation, refer to Figure 4 The schematic diagram of resource acquisition related resource request shown in the figure, the resource user can use the Web terminal to access the proxy address information (corresponding to the URL address information), thereby sending a first resource request carrying the proxy address information. The proxy gateway can implement resource proxy services and request interception services based on Openresty, lua, Java and other technology stacks, so that it meets the requirements of lightweight architecture and has the characteristics of easy maintenance, high performance and scalability.
[0054] It is understandable that resource users can obtain resources based on proxy address information, which can hide the real address of the backend and shield the differences in the backend private protocols, thereby solving cross-protocol problems and improving the security of resource acquisition.
[0055] Step S32: acquiring target resource configuration data corresponding to the target resource from the cache of the proxy gateway or the database according to the target encoding character string in the proxy address information carried in the first resource request.
[0056] The cache data acquisition priority is higher than the database data acquisition priority, and the target resource configuration data also includes: the host information of the resource provider, the proxy data transmission protocol and at least one of the resource extension associated with the uniform resource locator URL.
[0057] In the specific implementation, the resource configuration data corresponding to the target encoding string (i.e., the target resource configuration data) is obtained from the cache of the proxy gateway first to improve the data acquisition efficiency. If the target resource configuration data does not exist in the cache, the target resource configuration data is obtained from the resource configuration table, and the obtained target resource configuration data is stored in the cache of the proxy gateway for subsequent use.
[0058] Step S33: Determine the target information of the target resource according to the target resource configuration data and the proxy address information corresponding to the target resource.
[0059] In specific implementation, refer to Figure 5 As shown in the schematic diagram of the implementation process of resource acquisition, after intercepting the first resource request, the proxy gateway uses a preset regular expression (corresponding to the location configuration) according to the configured information parsing interface to parse the proxy address information in the first resource request, specifically, to parse the context of the target string, and to splice out the target information in combination with the relevant field values in the target resource configuration data, that is, to splice out the actual URL address (i.e., access address information) or transmission interface information of the target resource.
[0060] Step S34: Generate and send a second resource request carrying the target information, and forward the acquired target resource to the resource user, where the second resource request is used to acquire the target resource from the resource provider.
[0061] In this implementation, the embodiment of the present application can provide a unified resource access method for resource users (such as uniformly providing proxy address information based on fixed protocols such as HTTP or RTSP), and has good compatibility with different access addresses and transmission interfaces. Figure 6The schematic diagrams of different proxy scenarios shown in the figure show that the proxy gateway in the embodiment of the present application is compatible with the resource access addresses of HTTP and FTP, and supports dynamic conversion and reverse proxy of HTTP to HTTP URL, supports forwarding proxy of HTTP to FTP URL, supports proxy conversion of image download transmission interface, supports RTSP to refresh RTSP address and redirect proxy according to private protocol interface, and supports providing fixed proxy address information in fixed format of protocols such as HTTP and RTSP to the outside world. Figure 6 The target information and proxy address information related to the four proxy scenarios are shown in Table 1 below, where url is used to identify resources that need to be accessed through a URL address (corresponding to URL-related resource access types), and req is used to identify resources that need to be accessed through a request download / transmission interface (corresponding to a transmission interface-related resource access type).
[0062] Table 1 Target information and proxy address information related to four proxy scenarios
[0063] Optionally, the target resource configuration data further includes authentication information; and the generating and sending a second resource request carrying the target information includes: Generate and send a second resource request carrying the target information and the authentication information, wherein the recognition information may include a user account and a user password, etc., to support secure access control of a resource provider.
[0064] As a possible implementation mode, generating the proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway includes: extracting the URL from the target information when the target information conforms to the URL-related access type; In the case where the target information conforms to the access type related to the transmission interface, extracting the resource unique identification code from the target information; The target encoding string in the target resource configuration data, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information are spliced according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0065] In specific implementation, the proxy address format can be flexibly set by the user according to actual needs. For example, the proxy address format can be expressed as follows: [protocol]: / / [proxy_ip:proxy_port] / imgateway / [rule_key] / {[path]}|{ / stream / [resource_id]} Among them, the content in [ ] represents replacement variables, and the content in {} represents optional variables; protocol represents the proxy protocol (i.e., the preset data transmission protocol); proxy_ip represents the external address information of the proxy gateway (i.e., IP), and proxy_port represents the external port information of the proxy gateway; rule_key represents the target encoding string; path represents the original access address information of the resource (i.e., the original URL address); stream is a fixed identifier used to identify related resources of the req type (i.e., the resource access type related to the transmission interface), such as the view resource accessed through the download interface; resource_id represents the unique identification code of the resource accessed through the transmission interface.
[0066] Taking the resource user as the visual platform and the resource provider as the lower-level view system as an example, the structure example of the resource configuration table and the resource configuration data example in the resource configuration table are shown in Tables 2 and 3 below.
[0067] Table 2 Example of the structure of the resource configuration table
[0068] Table 3 Example of resource configuration data in the resource configuration table
[0069] Second, refer to Figure 7 As shown, it is an implementation flow chart of another resource acquisition method provided in an embodiment of the present application. The resource acquisition method is applied to a resource user, and the method may include the following steps: Step S71: receiving target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; Step S72: Obtain the identifier of the resource provider and the type of the target resource; Step S73: acquiring target resource configuration data from a resource configuration table of a proxy gateway according to the identifier of the resource provider and the type of the target resource, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; Step S74: Generate proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; Step S75: Generate and send a first resource request carrying the proxy address information, where the first resource request is used to obtain the target resource through the proxy service provided by the proxy gateway.
[0070] By adopting the technical solution of the embodiment of the present application, the proxy gateway queries the resource configuration data for different types of resources of different resource providers in the resource configuration table, finds the target resource configuration data, and then generates the proxy address information according to the target encoding character string in the target resource configuration data, thereby avoiding the configuration complexity problem caused by introducing the reverse proxy routing rule; and by converting the target information into proxy address information that conforms to the preset data transmission protocol and the external address information and port information of the proxy gateway, and sending the proxy address information to the resource user, the resource user can uniformly obtain resources from different resource providers through the proxy service provided by the proxy gateway, thereby solving the problem of multi-terminal resource access docking of the resource user, and avoiding the high cost and complex architecture problems caused by the introduction of the storage solution, thereby realizing a resource acquisition solution with simple configuration and architecture and low implementation cost.
[0071] As a possible implementation, the method further includes: Determine different types of resources from different resource providers that need to be acquired through the proxy service provided by the proxy gateway; Generate and send resource access related data corresponding to the different types of resources, so that the proxy gateway generates different target encoding strings for the received different resource access related data, and writes the different resource access related data and their corresponding target encoding strings as different resource configuration data into the resource configuration table for storage; The resource access related data at least includes: an identifier of a resource provider, an identifier of the resource access related data itself, a resource type, and a resource access type.
[0072] As a possible implementation mode, generating the proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway includes: extracting the URL from the target information when the target information conforms to the URL-related access type; In the case where the target information conforms to the access type related to the transmission interface, extracting the resource unique identification code from the target information; The target encoding string in the target resource configuration data, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information are spliced according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0073] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0074] Thirdly, Figure 8 : is a structural diagram of a resource acquisition device according to an embodiment of the present application, wherein the resource acquisition device is applied to a proxy gateway, and the device comprises: The first receiving module 810 is used to receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; A first acquisition module 820 is used to acquire the identifier of the resource provider and the type of the target resource; A second acquisition module 830 is used to acquire target resource configuration data from a pre-established resource configuration table according to the identifier of the resource provider and the type of the target resource, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; A first generating module 840 is used to generate the proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; The first sending module 850 is used to send the proxy address information to the resource user, so that the resource user generates and sends a first resource request carrying the proxy address information, and the first resource request is used to obtain the target resource through the proxy service provided by the proxy gateway.
[0075] By adopting the technical solution of the embodiment of the present application, the proxy gateway queries the resource configuration data for different types of resources of different resource providers in the resource configuration table, finds the target resource configuration data, and then generates the proxy address information according to the target encoding character string in the target resource configuration data, thereby avoiding the configuration complexity problem caused by introducing the reverse proxy routing rule; and by converting the target information into proxy address information that conforms to the preset data transmission protocol and the external address information and port information of the proxy gateway, and sending the proxy address information to the resource user, the resource user can uniformly obtain resources from different resource providers through the proxy service provided by the proxy gateway, thereby solving the problem of multi-terminal resource access docking of the resource user, and avoiding the high cost and complex architecture problems caused by the introduction of the storage solution, thereby realizing a resource acquisition solution with simple configuration and architecture and low implementation cost.
[0076] Optionally, the device further comprises: A first processing module is used to receive resource access related data for different types of resources of different resource providers sent by a resource user, and / or, based on the resource related information sent by different resource providers, generate resource access related data for different types of resources of different resource providers, wherein the resource access related data at least includes: an identifier of the resource provider, an identifier of the resource access related data itself, a resource type, and a resource access type; A second generating module, configured to generate different target encoding character strings for different resource access related data according to the identifier of the resource access related data itself; The first storage module is used to write the different resource access related data and their corresponding target encoding character strings into the resource configuration table as different resource configuration data for storage.
[0077] Optionally, the second generating module is further configured to perform the following steps: For each resource access related data, the identifier of the resource access related data itself, the resource type and the resource access type in the resource access related data are encoded to obtain the target encoding character string.
[0078] Optionally, the resource configuration table is stored in a database; the device further comprises: A first interception module, used to intercept the first resource request sent by the resource user; a third acquisition module, configured to acquire target resource configuration data corresponding to the target resource from the cache of the proxy gateway or the database according to the target encoding character string in the proxy address information carried by the first resource request, wherein the data acquisition priority of the cache is higher than the data acquisition priority of the database, and the target resource configuration data further includes: host information of the resource provider, the proxy data transmission protocol, and at least one of the resource extension associated with the uniform resource locator URL; A second processing module, configured to determine target information of the target resource according to the target resource configuration data and the proxy address information corresponding to the target resource; The second sending module is used to generate and send a second resource request carrying the target information, and forward the acquired target resource to the resource user, wherein the second resource request is used to acquire the target resource from the resource provider.
[0079] Optionally, the target resource configuration data further includes authentication information; and the second sending module is further used to: Generate and send a second resource request carrying the target information and the authentication information.
[0080] Optionally, the first generating module 840 is further configured to perform the following steps: extracting the URL from the target information when the target information conforms to the URL-related access type; In the case where the target information conforms to the access type related to the transmission interface, extracting the resource unique identification code from the target information; The target encoding string in the target resource configuration data, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information are spliced according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0081] Fourthly, Fig. 9 : is a schematic diagram of the structure of another resource acquisition device in an embodiment of the present application, wherein the resource acquisition device is applied to a resource user, and the device includes: The information receiving module 910 is used to receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; A data acquisition module 920 is used to acquire the identifier of the resource provider and the type of the target resource; Configuration acquisition module 930, used to acquire target resource configuration data from the resource configuration table of the proxy gateway according to the identifier of the resource provider and the type of the target resource, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; The proxy address generation module 940 is used to generate the proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; The resource request module 950 is used to generate and send a first resource request carrying the proxy address information, where the first resource request is used to obtain the target resource through the proxy service provided by the proxy gateway.
[0082] By adopting the technical solution of the embodiment of the present application, the proxy gateway queries the resource configuration data for different types of resources of different resource providers in the resource configuration table, finds the target resource configuration data, and then generates the proxy address information according to the target encoding character string in the target resource configuration data, thereby avoiding the configuration complexity problem caused by introducing the reverse proxy routing rule; and by converting the target information into proxy address information that conforms to the preset data transmission protocol and the external address information and port information of the proxy gateway, and sending the proxy address information to the resource user, the resource user can uniformly obtain resources from different resource providers through the proxy service provided by the proxy gateway, thereby solving the problem of multi-terminal resource access docking of the resource user, and avoiding the high cost and complex architecture problems caused by the introduction of the storage solution, thereby realizing a resource acquisition solution with simple configuration and architecture and low implementation cost.
[0083] Optionally, the device further comprises: An agent demand determination module, used to determine different types of resources from different resource providers that need to be acquired through the agent service provided by the agent gateway; A resource configuration module, used to generate and send resource access related data corresponding to each of the different types of resources, so that the proxy gateway generates different target encoding strings for the different resource access related data received, and writes the different resource access related data and their corresponding target encoding strings as different resource configuration data into the resource configuration table for storage; The resource access related data at least includes: an identifier of a resource provider, an identifier of the resource access related data itself, a resource type, and a resource access type.
[0084] Optionally, the proxy address generation module 940 is further configured to perform the following steps: extracting the URL from the target information when the target information conforms to the URL-related access type; In the case where the target information conforms to the access type related to the transmission interface, extracting the resource unique identification code from the target information; The target encoding string in the target resource configuration data, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information are spliced according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0085] It should be noted that the device embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.
[0086] The present application also provides an electronic device, referring to Fig.10 , Fig.10 Schematic diagram of an electronic device proposed in an embodiment of the present application. Fig.10 As shown, the electronic device 100 includes: a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus communication. A computer program is stored in the memory 110. The computer program can be run on the processor 120 to implement the steps in the resource acquisition method disclosed in the embodiment of the present application.
[0087] The embodiment of the present application also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the resource acquisition method disclosed in the embodiment of the present application is implemented.
[0088] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the resource acquisition method disclosed in the embodiment of the present application.
[0089] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0090] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0091] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, systems, devices, storage media, and program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0092] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0093] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0094] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0095] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0096] The resource acquisition method and device provided by the present application are introduced in detail above. The principles and implementation methods of the present application are explained in this article using specific examples. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A resource acquisition method, characterized in that: Applied to a proxy gateway, the method comprises: Receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; Obtaining the identifier of the resource provider and the type of the target resource; According to the identifier of the resource provider and the type of the target resource, target resource configuration data is obtained from a pre-established resource configuration table, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; Generate proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; The proxy address information is sent to a resource user, so that the resource user generates and sends a first resource request carrying the proxy address information, where the first resource request is used to obtain the target resource through a proxy service provided by the proxy gateway.
2. The method according to claim 1, characterized in that The method further comprises: Receiving resource access related data for different types of resources of different resource providers sent by a resource user, and / or, based on the resource related information sent by different resource providers, generating resource access related data for different types of resources of different resource providers, wherein the resource access related data at least includes: an identifier of the resource provider, an identifier of the resource access related data itself, a resource type, and a resource access type; generating different target encoding character strings for the different resource access related data according to the identifier of the resource access related data itself; The different resource access related data and their corresponding target encoding character strings are written into the resource configuration table as different resource configuration data for storage.
3. The method according to claim 2, characterized in that The generating different target encoding strings for the different resource access related data according to the identification of the resource access related data itself includes: For each resource access related data, the identifier of the resource access related data itself, the resource type and the resource access type in the resource access related data are encoded to obtain the target encoding character string.
4. The method according to claim 2, characterized in that: The resource configuration table is stored in a database; after sending the proxy address information to the resource user, the method further includes: intercepting the first resource request sent by the resource user; According to the target encoding character string in the proxy address information carried by the first resource request, the target resource configuration data corresponding to the target resource is obtained from the cache of the proxy gateway or the database, the data acquisition priority of the cache is higher than the data acquisition priority of the database, and the target resource configuration data also includes: the host information of the resource provider, the proxy data transmission protocol, and at least one of the resource extension name associated with the uniform resource locator URL; Determining target information of the target resource according to the target resource configuration data and the proxy address information corresponding to the target resource; Generate and send a second resource request carrying the target information, and forward the acquired target resource to the resource user, wherein the second resource request is used to acquire the target resource from the resource provider.
5. The method according to claim 3, characterized in that: The target resource configuration data also includes authentication information; the generating and sending a second resource request carrying the target information includes: Generate and send a second resource request carrying the target information and the authentication information.
6. The method according to any one of claims 1 to 5, characterized in that: The generating of the proxy address information corresponding to the target resource according to the target encoding character string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway comprises: extracting the URL from the target information when the target information conforms to the URL-related access type; In the case where the target information conforms to the access type related to the transmission interface, extracting the resource unique identification code from the target information; The target encoding string in the target resource configuration data, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information are spliced according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
7. A resource acquisition method, characterized in that: Applied to a resource user, the method includes: Receive target information of a target resource sent by a resource provider, wherein the target information includes: access address information or transmission interface information of the resource; Obtaining the identifier of the resource provider and the type of the target resource; According to the identifier of the resource provider and the type of the target resource, target resource configuration data is obtained from a resource configuration table of the proxy gateway, wherein the resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data includes different target encoding strings and resource access related data; Generate proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway; A first resource request carrying the proxy address information is generated and sent, where the first resource request is used to obtain the target resource through a proxy service provided by the proxy gateway.
8. The method according to claim 7, characterized in that The method further comprises: Determine different types of resources from different resource providers that need to be acquired through the proxy service provided by the proxy gateway; Generate and send resource access related data corresponding to the different types of resources, so that the proxy gateway generates different target encoding strings for the received different resource access related data, and writes the different resource access related data and their corresponding target encoding strings as different resource configuration data into the resource configuration table for storage; The resource access related data at least includes: an identifier of a resource provider, an identifier of the resource access related data itself, a resource type, and a resource access type.
9. The method according to claim 7 or 8, characterized in that: The generating of the proxy address information corresponding to the target resource according to the target encoding character string in the target resource configuration data, the preset data transmission protocol, and the external address information and port information of the proxy gateway comprises: extracting the URL from the target information when the target information conforms to the URL-related access type; In the case where the target information conforms to the access type related to the transmission interface, extracting the resource unique identification code from the target information; The target encoding string in the target resource configuration data, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information are spliced according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
10. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the resource acquisition method according to any one of claims 1 to 6, or to implement the resource acquisition method according to any one of claims 7 to 9.
Citation Information
Patent Citations
Media service proxy method, device and system thereof
CN107534598A
Data processing method and device based on dynamic proxy and computer equipment
CN112822284A
Request processing method and device, electronic equipment and computer readable medium
CN113468445A
Resource access control method and device
CN115622742A
Methods, Systems, and Computer Program Products for Accessing a Service Via a Proxy Communications Agent
US20140172999A1