A resource acquisition method and device
Through the proxy gateway, the resource configuration table is used to convert resource access addresses, the problem of multi-terminal resource access docking is solved, simplified configuration and low-cost resource acquisition are achieved, compatible with different access types, and the efficiency and security of resource acquisition are improved.
Patent Information
- Application Number
- CN202411456885.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-10-17
AI Technical Summary
In the prior art, when resource users connect to multiple resource providers, the resource access methods provided by each resource provider are not unified, resulting in multi-terminal resource access docking problems, and there are problems of complex configuration, high cost and complex architecture.
The proxy gateway converts the target information and the proxy address information based on the resource configuration table, so that resource users can uniformly obtain resources from different resource providers through the proxy services provided by the proxy gateway, solving the problem of multi-terminal resource access docking, avoiding the configuration complexity of reverse proxy routing rules and the high cost of storage solutions.
It realizes a simple configuration, lightweight and low-cost solution for resource acquisition, compatible with different resource access types, and improves the efficiency and security of resource acquisition.
Smart Images

Figure CN119484631B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a resource acquisition method and device. Background Art
[0002] In practical applications, when a resource user docks with multiple resource providers, problems with multi-terminal resource access docking may occur due to inconsistent resource access methods provided by each resource provider.
[0003] In related technologies, mainly a proxy solution or a storage solution is adopted to solve the multi-terminal resource access docking problem, so that the resource user can obtain resources from different resource providers.
[0004] However, since the proxy solution requires complex reverse proxy routing rules to be configured, and the storage solution requires redundant storage of proxy resources and additional deployment of streaming media services, the current resource acquisition methods have problems of complex configuration, high cost, and complex architecture. Summary of the Invention
[0005] In view of the above problems, embodiments of this application provide a resource acquisition method and device to overcome or at least partially solve the above problems.
[0006] In a first aspect of an embodiment of this application, a resource acquisition method is provided, which is applied to a proxy gateway, and the method includes:
[0007] Receiving target information of a target resource sent by a resource provider, where the target information includes: access address information or transmission interface information of the resource;
[0008] Obtaining an identifier of the resource provider and a type of the target resource;
[0009] According to the identifier of the resource provider and the type of the target resource, obtaining target resource configuration data from a pre-established resource configuration table, where 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;
[0010] Generating proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, a preset data transmission protocol, and address information and port information of the proxy gateway to the outside;
[0011] Sending the proxy address information 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.
[0012] In the second aspect of the embodiments of the present application, a resource acquisition method is provided, which is applied to a resource user, and the method includes:
[0013] Receiving target information of a target resource sent by a resource provider, where the target information includes: access address information or transmission interface information of the resource;
[0014] Obtaining the identifier of the resource provider and the type of the target resource;
[0015] According to the identifier of the resource provider and the type of the target resource, obtaining target resource configuration data from a resource configuration table of a proxy gateway, where 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;
[0016] Generating proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, a preset data transmission protocol, and the external address information and port information of the proxy gateway;
[0017] Generating and sending 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.
[0018] In the third aspect of the embodiments of the present application, a resource acquisition device is provided, which is applied to a proxy gateway, and the device includes:
[0019] A first receiving module, configured to receive target information of a target resource sent by a resource provider, where the target information includes: access address information or transmission interface information of the resource;
[0020] A first obtaining module, configured to obtain the identifier of the resource provider and the type of the target resource;
[0021] A second obtaining module, configured to obtain 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, where 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;
[0022] A first generating module, configured to generate proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, a preset data transmission protocol, and the external address information and port information of the proxy gateway;
[0023] A first sending module, configured to send the proxy address information 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 the proxy service provided by the proxy gateway.
[0024] In a fourth aspect of the embodiments of the present application, a resource acquisition device is provided, which is applied to a resource user. The device includes:
[0025] An information receiving module, configured to receive target information of a target resource sent by a resource provider, where the target information includes: access address information or transmission interface information of the resource;
[0026] A data acquisition module, configured to acquire an identifier of the resource provider and a type of the target resource;
[0027] A configuration acquisition module, configured 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, where 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 coding strings and resource access-related data;
[0028] A proxy address generation module, configured to generate proxy address information corresponding to the target resource according to the target coding string in the target resource configuration data, a preset data transmission protocol, and the external address information and port information of the proxy gateway;
[0029] A resource request module, configured 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.
[0030] In a fifth aspect of the embodiments of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the resource acquisition method described in the first aspect or the second aspect are implemented.
[0031] In a sixth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program / instructions is stored. When the computer program / instructions is executed by a processor, the steps of the resource acquisition method described in the first aspect or the second aspect are implemented.
[0032] The embodiments of the present application have the following advantages: The proxy gateway queries the resource configuration data of different types of resources for different resource providers in the resource configuration table, finds the target resource configuration data, and then generates proxy address information based on the target encoding string in the target resource configuration data, which can avoid the complex configuration problem caused by introducing reverse proxy routing rules; 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, thus solving the problem of multi-terminal resource access docking for resource users, and can avoid the high cost and complex architecture problems caused by introducing a storage scheme, thereby realizing a resource acquisition scheme with simple configuration and architecture and low implementation cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0034] Figure 1 is the flowchart of an embodiment of a resource acquisition method in the embodiments of the present application;
[0035] Figure 2 is the schematic diagram of an embodiment process of multi-terminal view proxy in the embodiments of the present application;
[0036] Figure 3 is the schematic diagram of another embodiment process of multi-terminal view proxy in the embodiments of the present application;
[0037] Figure 4 is the schematic diagram of a resource acquisition related resource request in the embodiments of the present application;
[0038] Figure 5 is the schematic diagram of an implementation process of resource acquisition in the embodiments of the present application;
[0039] Figure 6 is the schematic diagram of different proxy scenarios in the embodiments of the present application;
[0040] Figure 7 is the flowchart of another embodiment of a resource acquisition method in the embodiments of the present application;
[0041] Figure 8 is the schematic diagram of the structure of a resource acquisition device in the embodiments of the present application;
[0042] Figure 9 It is a schematic structural diagram of another resource acquisition device in the embodiments of the present application;
[0043] Figure 10 It is a schematic diagram of an electronic device in the embodiments of the present application. Specific embodiments
[0044] To facilitate the understanding of the technical solutions provided by the present application, the following briefly describes the main technical concepts involved in the embodiments of the present application.
[0045] Web side: An application or service accessed and used by a browser.
[0046] Proxy gateway: A network intermediary that acts as an intermediary between the client and the server, performing various functions to improve network security, privacy protection, performance optimization, and protocol conversion, and can shield the resource access differences of the server.
[0047] Uniform Resource Locator (URL): A string used to identify and locate resources on the Internet. It provides a standardized way to represent the address of a resource, enabling browsers or other client software to find and access these resources. URLs can point to various types of resources such as web pages, images, videos, files, etc.
[0048] Real Time Streaming Protocol (RTSP): 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 an IP network.
[0049] FTPS: An extended protocol that adds support for transport layer security and Secure Sockets Layer encryption protocols to the commonly used File Transfer Protocol.
[0050] Reverse proxy routing rules: The core lies in implementing the forwarding and processing of 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 of the client request and execute the corresponding processing logic according to the matching result. The matching modes of the location directive include exact matching, prefix matching, and regular matching, etc.
[0051] In practical applications, a resource user may need to interface with multiple resource providers. Taking the video image comprehensive application platform (hereinafter referred to as the video comprehensive platform) as an example of a resource user, a video comprehensive platform usually needs to interface with multiple subordinate view systems to obtain resources such as pictures and videos distributed and stored in these subordinate view systems, and then achieve unified aggregation and presentation of the resources of these subordinate view systems.
[0052] The resource access methods (i.e., the supported resource access types) 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 ending extensions such as ".jpg / .png / .mp4 / .avi / ..." for the video comprehensive platform to obtain resources such as pictures or offline videos; while some other subordinate view systems will provide transmission interface information (such as a private protocol network interface) based on real-time data transmission protocols (such as HTTP, RTSP, etc.) for the video comprehensive platform to obtain resources such as pictures or online videos. If the resource access methods provided by the various resource providers interfaced by the resource user are not unified, there will be multiple resource access docking problems such as interface access authentication, address format differences, interface call differences, and complex cross-protocol, cross-network, and cross-domain configurations.
[0053] In related technologies, a proxy solution or a storage solution is mainly adopted to solve the above-mentioned multi-end resource access docking problem, so that the resource user can obtain the resources of different resource providers. Taking the video comprehensive platform as the resource user and the subordinate view system as the resource provider as an example, the proxy solution and the storage solution will be described below.
[0054] Proxy solution: Based on the reverse proxy module configured by itself, the video comprehensive platform separately configures multiple reverse proxy routing rules for the access methods related to the URLs provided by each subordinate view system. It usually supports the conversion of access methods for HTTP and FTP. For the conversion of access methods for other protocols or access methods related to transmission interfaces, customized code needs to be developed separately according to specific differences. It can be seen that the proxy solution implemented based on reverse proxy routing rules and customized code mainly has the following problems:
[0055] 1. The configuration is complex, and the development, maintenance cost and difficulty are high;
[0056] 2. The compatibility is insufficient. When there are special protocol access methods or access methods related to transmission interfaces, customized code needs to be developed, the workload is large, and the expansion flexibility is poor;
[0057] 3. The implementation based on rule- and code-based customization methods lacks flexibility and has low docking efficiency.
[0058] Storage solution: The Visual Comprehensive Platform pulls the resources stored in each subordinate view system to the local domain of the Visual Comprehensive Platform for storage (i.e., redundant storage) to generate the access URL of the local domain of the Visual Comprehensive Platform; 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 service mainly has the following problems:
[0059] 1. The resources stored additionally will cause problems such as high costs, difficult management and maintenance;
[0060] 2. The additionally deployed streaming media service will increase the complexity and weight of the system architecture interaction.
[0061] In view of the problems existing in the related technologies, the present application provides a resource acquisition method and device. The designed proxy gateway performs conversion between target information and proxy address information based on a resource configuration table, so that the resource user can uniformly obtain resources from different resource providers through the proxy service provided by the proxy gateway based on the proxy address information, thereby solving the problem of multi-terminal resource access docking. Moreover, it has good compatibility with the access types related to URLs (corresponding to the case where the target information is the access address information of the resource) and the access types related to the transmission interface (corresponding to the case where the target information is the transmission interface information), and subsequently, the proxy ability of the proxy gateway can be extended by writing new resource configuration data into the resource configuration table. In this way, problems such as complex configuration and poor expansion flexibility of the proxy solution and high costs and complex architecture of the storage solution can be solved, thus realizing a resource acquisition solution that is compatible with access types related to URLs and transmission interfaces, simplified and lightweight.
[0062] Next, in conjunction with the accompanying drawings, a resource acquisition method and device provided by an embodiment of the present application will be described in detail through some embodiments and their application scenarios.
[0063] In the first aspect, as shown in Figure 1 the following is a flowchart of the implementation of a resource acquisition method provided by an embodiment of the present application. The resource acquisition method is applied to a proxy gateway, and the method may include the following steps:
[0064] Step S11: Receive the target information of the target resource sent by the resource provider, where the target information includes: the access address information of the resource or the transmission interface information.
[0065] Among them, the target resource can be a resource of types such as web page, picture, video or file, and the target information can be associated with data transfer protocols such as HTTP, Hypertext Transfer Protocol Secure (HTTPS), FTP, FTPS or RTSP.
[0066] In specific implementation, the proxy gateway can regularly obtain the target information from the resource provider, or receive the target information actively reported by the resource provider, and use the resource associated with the received target information (such as the picture resource collected by the camera configured by the resource provider) as the target resource.
[0067] Step S12: Obtain the identifier of the resource provider and the type of the target resource.
[0068] In specific implementation, the proxy gateway can send an information query request to the resource provider to obtain the identifier of the resource provider and the type of the target resource; or, the proxy gateway can parse the target information to obtain the identifier of the resource provider and the type of the target resource. For example, the proxy gateway can parse the host information (such as IP and port) and the resource extension name 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 according to the preset mapping relationship between the host information and the identifier of the resource provider and the preset mapping relationship between the resource extension name and the type of the resource.
[0069] Step S13: Obtain the target resource configuration data from the pre-established resource configuration table according to the identifier of the resource provider and the type of the target resource. The resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data contains different target encoding strings and resource access-related data.
[0070] Among them, the resource configuration data includes: resource-related information required for mutual conversion between the target information and the proxy address information, which can be regarded as an abstract expression of the proxy rule (that is, the conversion rule between the target information related to a specific resource type and the proxy address information).
[0071] In specific implementation, the proxy gateway matches the identifier of the resource provider and the type of the target resource with each resource configuration data in the resource configuration table. For example, it checks whether there is resource configuration data containing the identifier of the resource provider and the type of the target resource, and uses the found (i.e., successfully matched) resource configuration data as the target resource configuration data.
[0072] Step S14: 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.
[0073] In specific implementation, select to generate proxy address information (such as HTTP address or FTP address, etc.) based on the target encoding string, so that when the proxy address information needs to be converted into target information subsequently, the target resource configuration data required for information conversion can be quickly found based on the target encoding string; select to generate proxy address information based on the preset data transmission protocol (which can be freely set by the user, 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 resource users, that is, enable resource users to use a unified resource access method to obtain different types of resources from different resource providers through the proxy gateway, thereby solving the problem of multi-terminal resource access docking for resource users (such as interface access authentication, address format differences, interface call differences, and complex cross-protocol, cross-network, and cross-domain configurations, etc.).
[0074] 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, and the first resource request is used to obtain the target resource through the proxy service provided by the proxy gateway.
[0075] In specific implementation, after generating the proxy address information, the proxy gateway can immediately send the proxy address information to the resource user, or periodically send the recently generated proxy address information in batches to the resource user.
[0076] Adopting the technical solution of the embodiment of the present application, the proxy gateway queries the resource configuration data of different types of resources for different resource providers in the resource configuration table, finds the target resource configuration data, and then generates proxy address information based on the target encoding string in the target resource configuration data, which can avoid the complex configuration problem caused by introducing reverse proxy routing rules; 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 for resource users, and can avoid the high cost and complex architecture problems caused by introducing a storage scheme, thus realizing a resource acquisition scheme with simple configuration and architecture and low implementation cost.
[0077] As a possible implementation manner, the method further includes:
[0078] Step S21: Receive resource access-related data of different types of resources for different resource providers sent by a resource user, and / or generate resource access-related data of different types of resources for different resource providers according to resource-related information sent by different resource providers.
[0079] Wherein, 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.
[0080] In specific implementation, referring to Figure 2 the schematic diagram of an implementation process of a multi-terminal view proxy shown, the proxy gateway can provide a relevant configuration interface for the resource user, so that the resource user (such as a video and comprehensive platform) can, according to its own needs, that is, according to its own needs, generate resource access-related data corresponding to different types of resources of different resource providers 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 for the proxy gateway to generate corresponding resource configuration data, thereby enabling precise configuration for the resource types that the resource user needs to proxy, which is beneficial 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 proxy address information of relevant resources based on the resource configuration table of the proxy gateway.
[0081] Referring to Figure 3 the schematic diagram of another implementation process of a multi-terminal view proxy shown, the proxy gateway can also act 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 the resource user, and automatically generate resource access-related data based on the received resource-related information, and then generate corresponding resource configuration data, thereby enabling dynamic configuration for the resource types reported by the resource provider, which is beneficial to reducing the configuration work of the resource user.
[0082] Step S22: Generate different target encoding strings for the different resource access-related data according to the identifier of the resource access-related data itself.
[0083] In specific implementation, the proxy gateway can directly use the identifier of the resource access-related data itself as the corresponding target encoding string; or encode the identifier of the resource access-related data itself with 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.
[0084] Step S23: Write the different resource access related data and their corresponding target encoding strings into the resource configuration table as different resource configuration data for storage.
[0085] In this embodiment, the resource user can achieve precise configuration for the resource types it needs to proxy by sending resource access related data; the proxy gateway can also act as a data collection gateway to receive resource related information sent by different resource providers on behalf of the resource user, 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 obtain resources based on the proxy address information returned by the proxy gateway, thereby realizing the advantage that the resource user is unaware of the business processing of resource acquisition.
[0086] Optionally, the generating different target encoding strings for the different resource access related data according to the identifier of the resource access related data itself includes:
[0087] For each of the resource access related data, encode the identifier of the resource access related data itself, the resource type, and the resource access type in the resource access related data to obtain the target encoding string.
[0088] 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 a set string format. For example, encode 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 according to the set string format of {identifier}-{resource type}-{access type} to obtain the target encoding string "x1ere2-image-url". Thus, the resource type and resource access type of the relevant resources can be quickly known through the target encoding string, which is beneficial to improving the processing efficiency.
[0089] As a possible implementation manner, the resource configuration table is stored in a database; after sending the proxy address information to the resource user, the method further includes:
[0090] Step S31: Intercept the first resource request sent by the resource user.
[0091] In specific implementation, refer to Figure 4Schematic diagram of a resource request related to resource acquisition. The resource user can access the proxy address information (corresponding to the URL address information) through the Web side, so as to send a first resource request carrying the proxy address information. The proxy gateway can implement resource proxy services and request interception services based on technology stacks such as Openresty, lua, and Java, so as to meet the requirements of a lightweight architecture and have the characteristics of easy maintenance, high performance, and scalability.
[0092] It can be understood that the resource user performs resource acquisition based on the proxy address information, which can hide the real address of the backend and shield the differences in the private protocols of the backend. Thus, the cross-protocol problem can be solved and the security of resource acquisition can be improved.
[0093] Step S32: According to the target encoding string in the proxy address information carried by the first resource request, obtain the target resource configuration data corresponding to the target resource from the cache of the proxy gateway or the database.
[0094] Among them, the priority of data acquisition from the cache is higher than that of data acquisition from the database. The target resource configuration data further includes at least one of the host information of the resource provider, the data transmission protocol to be proxied, and the resource extension name associated with the uniform resource locator URL.
[0095] In specific implementation, the resource configuration data (i.e., the target resource configuration data) corresponding to the target encoding string is preferentially obtained from the cache of the proxy gateway 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.
[0096] 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.
[0097] In specific implementation, referring to Figure 5 the schematic diagram of the implementation process of resource acquisition shown, after intercepting the first resource request, the proxy gateway uses a preset regular expression (corresponding to the location configuration) to parse the proxy address information in the first resource request according to the configured information parsing interface. Specifically, it parses the context of the target string, and combines the relevant field values in the target resource configuration data to splice the target information, that is, splices the actual URL address (i.e., the access address information) or the transmission interface information of the target resource.
[0098] Step S34: Generate and send a second resource request carrying the target information, and forward the obtained target resource to the resource user. The second resource request is used to obtain the target resource from the resource provider.
[0099] In this embodiment, the embodiments of the present application can provide a unified resource access method for the resource user (such as uniformly providing proxy address information based on fixed protocols such as HTTP or RTSP), and have good compatibility with different access addresses and transmission interfaces. Refer to Figure 6 the schematic diagrams of different proxy scenarios shown. The proxy gateway in the embodiments of the present application can be compatible with resource access addresses of HTTP and FTP, and supports dynamic conversion and reverse proxy from HTTP to HTTP URLs, forward proxy from HTTP to FTP URLs, proxy conversion of the picture download transmission interface, RTSP address refreshing and redirection proxy according to the private protocol interface, and supports providing fixed-format proxy address information of fixed protocols such as HTTP and RTSP externally. Figure 6 The target information and proxy address information related to the four proxy scenarios in
[0100] Table 1 Target information and proxy address information related to four proxy scenarios
[0101]
[0102] Optionally, the target resource configuration data further includes authentication information; the generating and sending a second resource request carrying the target information includes:
[0103] generating and sending a second resource request carrying the target information and the authentication information. The cognitive information may include a user account and a user password, etc., to support the security access control of the resource provider.
[0104] As a possible implementation manner, the generating the proxy address information corresponding to the target resource according to the target encoding string, the preset data transmission protocol, and the external address information and port information of the proxy gateway includes:
[0105] When the target information conforms to the access type related to the URL, extract the URL from the target information;
[0106] When the target information meets the access type related to the transmission interface, extract the resource unique identification code from the target information;
[0107] Concatenate 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 according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0108] 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:
[0109] [protocol]: / / [proxy_ip:proxy_port] / imgateway / [rule_key] / {[path]}|{ / stream / [resource_id]}
[0110] Among them, the content in [ ] represents a replacement variable, and the content in {} represents an optional variable; 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 (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 resources related to the req type (i.e., the resource access type related to the transmission interface), such as view resources accessed through the download interface; resource_id represents the unique identification code of the resource accessed through the transmission interface.
[0111] Taking the resource user as the visual synthesis platform and the resource provider as the lower-level view system as an example, the structure example of the resource configuration table and the example of the resource configuration data in the resource configuration table are shown in Tables 2 and 3 below.
[0112] Table 2 Structure example of the resource configuration table
[0113]
[0114] Table 3 Example of the resource configuration data in the resource configuration table
[0115]
[0116] Second aspect, as shown in Figure 7 is the implementation flowchart of another resource acquisition method provided by the embodiments of the present application. The resource acquisition method is applied to a resource user, and this method may include the following steps:
[0117] Step S71: Receive the target information of the target resource sent by the resource provider, where the target information includes: resource access address information or transmission interface information;
[0118] Step S72: Obtain the identifier of the resource provider and the type of the target resource;
[0119] Step S73: According to the identifier of the resource provider and the type of the target resource, obtain target resource configuration data from the resource configuration table of the proxy gateway, where 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;
[0120] 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;
[0121] 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.
[0122] Adopting the technical solution of the embodiment of the present application, the proxy gateway queries the resource configuration data of different types of resources of different resource providers in the resource configuration table, finds the target resource configuration data, and then generates proxy address information according to the target encoding string in the target resource configuration data, which can avoid the complex configuration problem caused by introducing reverse proxy routing rules; 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 can avoid the high cost and complex architecture problems caused by introducing a storage solution, thus realizing a resource acquisition solution with simple configuration and architecture and low implementation cost.
[0123] As a possible implementation manner, the method further includes:
[0124] Determine different types of resources of different resource providers that need to obtain resources through the proxy service provided by the proxy gateway;
[0125] Generate and send the 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 received different resource access related data, and writes the different resource access related data and their corresponding target encoding strings into the resource configuration table as different resource configuration data for storage;
[0126] Among them, the resource access related data at least includes: the identifier of the resource provider, the identifier of the resource access related data itself, the resource type, and the resource access type.
[0127] As a possible implementation manner, 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:
[0128] When the target information conforms to the access type related to the URL, extract the URL from the target information;
[0129] When the target information conforms to the access type related to the transmission interface, extract the resource unique identification code from the target information;
[0130] Splice 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 according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0131] For the method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know 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.
[0132] In a third aspect, Figure 8 is a schematic structural diagram of a resource acquisition device according to an embodiment of the present application. The resource acquisition device is applied to a proxy gateway, and the device includes:
[0133] A first receiving module 810, configured to receive the target information of the target resource sent by the resource provider, where the target information includes: the access address information or transmission interface information of the resource;
[0134] A first obtaining module 820, configured to obtain the identifier of the resource provider and the type of the target resource;
[0135] A second acquisition module 830, configured 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, where 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;
[0136] A first generation module 840, configured to generate proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, a preset data transmission protocol, and the external address information and port information of the proxy gateway;
[0137] A first sending module 850, configured to send the proxy address information 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 the proxy service provided by the proxy gateway.
[0138] 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 proxy address information according to the target encoding string in the target resource configuration data, which can avoid the complex configuration problem caused by introducing reverse proxy routing rules; 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 can avoid the high cost and complex architecture problems caused by introducing a storage scheme, thus realizing a resource acquisition scheme with simple configuration and architecture and low implementation cost.
[0139] Optionally, the device further includes:
[0140] A first processing module, configured to receive resource access-related data for different types of resources of different resource providers sent by a resource user, and / or generate resource access-related data for different types of resources of different resource providers according to resource-related information sent by different resource providers, where the resource access-related data at least includes: the identifier of the resource provider, the identifier of the resource access-related data itself, the resource type, and the resource access type;
[0141] A second generation module, configured to generate different target encoding strings for the different resource access-related data according to the identifier of the resource access-related data itself;
[0142] A first storage module, configured to write the different resource access related data and their corresponding target encoding strings as different resource configuration data into the resource configuration table for storage.
[0143] Optionally, the second generation module is further configured to perform the following steps:
[0144] For each of the resource access related data, encode the identifier, resource type, and resource access type of the resource access related data itself in the resource access related data to obtain the target encoding string.
[0145] Optionally, the resource configuration table is stored in a database; the apparatus further includes:
[0146] A first interception module, configured to intercept the first resource request sent by the resource user;
[0147] A third acquisition module, configured to obtain the target resource configuration data corresponding to the target resource from the cache of the proxy gateway or the database according to the target encoding string in the proxy address information carried in the first resource request, 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 at least one of the host information of the resource provider, the data transmission protocol to be proxied, and the resource extension name associated with the uniform resource locator (URL);
[0148] A second processing module, configured to 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;
[0149] A second sending module, configured to generate and send a second resource request carrying the target information, and forward the obtained target resource to the resource user, and the second resource request is used to obtain the target resource from the resource provider.
[0150] Optionally, the target resource configuration data further includes authentication information; the second sending module is further configured to:
[0151] Generate and send a second resource request carrying the target information and the authentication information.
[0152] Optionally, the first generation module 840 is further configured to perform the following steps:
[0153] In the case where the target information conforms to the access type related to the URL, extract the URL from the target information;
[0154] When the target information conforms to the access type related to the transmission interface, extract the resource unique identification code from the target information;
[0155] Concatenate 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 according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0156] Fourthly, Figure 9 It is a schematic structural diagram of another resource acquisition device according to an embodiment of the present application. The resource acquisition device is applied to a resource user, and the device includes:
[0157] [[ID= 11]]An information receiving module 910, configured to receive the target information of the target resource sent by the resource provider, where the target information includes: the access address information or transmission interface information of the resource;
[0158] A data acquisition module 920, configured to acquire the identifier of the resource provider and the type of the target resource;
[0159] A configuration acquisition module 930, configured 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. 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;
[0160] A proxy address generation module 940, configured 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;
[0161] A resource request module 950, configured 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.
[0162] By adopting the technical solution of the embodiment of the present application, the proxy gateway queries the resource configuration data of different types of resources for different resource providers in the resource configuration table, finds the target resource configuration data, and then generates proxy address information based on the target encoding string in the target resource configuration data, which can avoid the complex configuration problem caused by introducing reverse proxy routing rules; 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, thus solving the problem of multi-terminal resource access docking of the resource user, and can avoid the high cost and complex architecture problems caused by introducing a storage scheme, thereby realizing a resource acquisition scheme with simple configuration and architecture and low implementation cost.
[0163] Optionally, the apparatus further includes:
[0164] A proxy requirement determination module, configured to determine different types of resources of different resource providers that need to obtain resources through the proxy service provided by the proxy gateway;
[0165] A resource configuration module, configured 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 received different resource access-related data, and writes the different resource access-related data and their corresponding target encoding strings into the resource configuration table as different resource configuration data for storage;
[0166] 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.
[0167] Optionally, the proxy address generation module 940 is further configured to perform the following steps:
[0168] In the case where the target information conforms to the access type related to the URL, extract the URL from the target information;
[0169] In the case where the target information conforms to the access type related to the transport interface, extract the resource unique identifier from the target information;
[0170] Splice 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 according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
[0171] It should be noted that the device embodiments are similar to the method embodiments, so the description is relatively simple. For related parts, please refer to the method embodiments.
[0172] An embodiment of the present application also provides an electronic device. Refer to Figure 10 , Figure 10 which is a schematic diagram of the electronic device proposed in the embodiment of the present application. As Figure 10 shown, the electronic device 100 includes: a memory 110 and a processor 120. The memory 110 is communicatively connected to the processor 120 via a bus. A computer program is stored in the memory 110, and the computer program can run on the processor 120, thereby implementing the steps in the resource acquisition method disclosed in the embodiment of the present application.
[0173] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program / instructions are stored. When the computer program / instructions are executed by a processor, the resource acquisition method disclosed in the embodiment of the present application is implemented.
[0174] An embodiment of the present application also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the resource acquisition method disclosed in the embodiment of the present application is implemented.
[0175] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other.
[0176] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application can take the form of completely hardware embodiments, completely software embodiments, or embodiments combining software and hardware aspects. Moreover, the embodiments of the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0177] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of 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 block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate for implementing in the process Figure 1 one process or multiple processes and / or blocksFigure 1 means for the functions specified in one or more boxes.
[0178] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the functions specified in one Figure 1 process or more processes and / or boxes Figure 1 means for the functions specified in one or more boxes.
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operation steps are performed on the computer or other programmable terminal device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one Figure 1 process or more processes and / or boxes Figure 1 means for the functions specified in one or more boxes.
[0180] Although the preferred embodiments of the embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the embodiments of the present application.
[0181] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or terminal device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or terminal device including the said element.
[0182] The above has introduced in detail a resource acquisition method and device provided by the present application. Specific examples are used in this text to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A resource acquisition method, characterized in that, Applied to a proxy gateway, the method includes: Receiving target information of a target resource sent by a resource provider, where 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, obtaining target resource configuration data from a pre-established resource configuration table. The resource configuration table includes resource configuration data for different types of resources of different resource providers, and different resource configuration data contains different target encoding strings and resource access-related data; wherein, the target encoding string is generated by encoding the identifier of the resource access-related data itself, the resource type, and the resource access type in the corresponding resource access-related data; Generating proxy address information corresponding to the target resource according to the target encoding string in the target resource configuration data, a preset data transmission protocol, and the external address information and port information of the proxy gateway; Sending the proxy address information to a 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; The sending the proxy address information to the resource user includes: Instantly sending the proxy address information to the resource user, or batch-sending the proxy address information generated within a preset period to the resource user.
2. The method according to claim 1, wherein The method further includes: Receiving resource access-related data for different types of resources of different resource providers sent by a resource user, 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. The resource access-related data at least includes: the identifier of the resource provider, the identifier of the resource access-related data itself, the resource type, and the resource access type; Generating different target encoding strings for the different resource access-related data according to the identifier of the resource access-related data itself; Writing the different resource access-related data and their corresponding target encoding strings into the resource configuration table as different resource configuration data for storage.
3. The method according to claim 2, wherein 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 string in the proxy address information carried by the first resource request, obtaining the target resource configuration data corresponding to the target resource from the cache of the proxy gateway or the database. The data acquisition priority of the cache is higher than that of the database. The target resource configuration data further includes at least one of the host information of the resource provider, the data transmission protocol to be proxied, and the resource extension name associated with the uniform resource locator (URL); Determining the 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 obtained target resource to the resource user, where the second resource request is used to obtain the target resource from the resource provider.
4. The method according to claim 3, characterized in that The target resource configuration data further 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.
5. The method according to any one of claims 1-4, characterized in that, The generating the proxy address information corresponding to the target resource according to the target encoding string, the preset data transmission protocol, and the external address information and port information of the proxy gateway includes: When the target information conforms to the access type related to the URL, extract the URL from the target information; When the target information conforms to the access type related to the transmission interface, extract the resource unique identifier from the target information; Concatenate the target encoding string, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
6. A resource acquisition method, characterized in that, Applied to the resource user, the method includes: Receive the target information of the target resource sent by the resource provider, where the target information includes: the access address information or transmission interface information of the resource; Obtain 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, obtain the target resource configuration data from the resource configuration table of the proxy gateway, where the resource configuration table includes the resource configuration data for different types of resources of different resource providers, and different resource configuration data contains different target encoding strings and resource access related data; where the target encoding string is generated by encoding the resource access related data itself, the resource type, and the resource access type in the corresponding resource access related data; Generate the proxy address information corresponding to the target resource according to the target encoding string, the preset data transmission protocol, and the external address information and port information of the proxy gateway; 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; Further includes: Receive the proxy address information instantaneously generated by the proxy gateway, or batch receive the proxy address information generated by the proxy gateway within a preset period.
7. The method according to claim 6, characterized in that, The method further includes: Determine the different types of resources of different resource providers that need to obtain resources through the proxy service provided by the proxy gateway; Generate and send the resource access related data corresponding to the different types of resources respectively, so that the proxy gateway generates different target encoding strings for the received different resource access related data, and write the different resource access related data and their corresponding target encoding strings into the resource configuration table as different resource configuration data for storage; Among them, the resource access related data at least includes: the identifier of the resource provider, the identifier of the resource access related data itself, the resource type, and the resource access type.
8. The method according to claim 6 or 7, characterized in that, The generating the proxy address information corresponding to the target resource according to the target encoding string, the preset data transmission protocol, and the external address information and port information of the proxy gateway in the target resource configuration data includes: When the target information conforms to the access type related to the URL, extracting the URL from the target information; When the target information conforms to the access type related to the transmission interface, extracting the resource unique identification code from the target information; Splicing the target encoding string, the preset data transmission protocol, the external address information and port information of the proxy gateway, and the information extracted from the target information in the target resource configuration data according to the preset proxy address format to obtain the proxy address information corresponding to the target resource.
9. An electronic device, comprising a memory, a processor, and a computer program stored on 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 5, or to implement the resource acquisition method according to any one of claims 6 to 8.
Citation Information
Patent Citations
Request processing method and device, electronic equipment and computer readable medium
CN113468445A