Movatterモバイル変換


[0]ホーム

URL:


CN118764429A - A multi-level proxy dynamic routing method, device and system based on wildcard domain name - Google Patents

A multi-level proxy dynamic routing method, device and system based on wildcard domain name
Download PDF

Info

Publication number
CN118764429A
CN118764429ACN202411180886.2ACN202411180886ACN118764429ACN 118764429 ACN118764429 ACN 118764429ACN 202411180886 ACN202411180886 ACN 202411180886ACN 118764429 ACN118764429 ACN 118764429A
Authority
CN
China
Prior art keywords
target
domain name
proxy
gateway
address information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411180886.2A
Other languages
Chinese (zh)
Inventor
成立龙
龚京静
欧雅男
郭峻宏
郎泽东
覃业金
吴松
韩昌雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Qianhe Information Technology Co ltd
Original Assignee
Shenzhen Qianhe Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhe Information Technology Co ltdfiledCriticalShenzhen Qianhe Information Technology Co ltd
Priority to CN202411180886.2ApriorityCriticalpatent/CN118764429A/en
Publication of CN118764429ApublicationCriticalpatent/CN118764429A/en
Pendinglegal-statusCriticalCurrent

Links

Landscapes

Abstract

Translated fromChinese

本申请提供一种基于泛域名的多层级代理动态路由方法、装置及系统,方法包括:网关端依据目标泛域名和泛域名解析规则确定目标第一域名段和目标第二域名段;网关端依据目标第一域名段和第一对应关系确定目标代理地址信息;网关端依据目标第二域名段和第二对应关系确定目标服务地址信息;网关端通过目标代理地址信息发送访问请求和目标服务地址信息至代理端;代理端用于通过目标服务地址信息发送访问请求至服务端;服务端用于依据访问请求确定请求结果,以及返回请求结果至用户端。本申请解决了现有技术维护域名与IP地址之间的对应关系不利于开发人员进行访问的问题,达到了通过多层级的动态路由实现请求转发的技术效果。

The present application provides a multi-level proxy dynamic routing method, device and system based on wildcard domain names, the method comprising: the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule; the gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship; the gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship; the gateway sends the access request and the target service address information to the proxy through the target proxy address information; the proxy is used to send the access request to the server through the target service address information; the server is used to determine the request result according to the access request, and return the request result to the user. The present application solves the problem that the prior art maintains the correspondence between the domain name and the IP address, which is not conducive to the developer's access, and achieves the technical effect of request forwarding through multi-level dynamic routing.

Description

Translated fromChinese
一种基于泛域名的多层级代理动态路由方法、装置及系统A multi-level proxy dynamic routing method, device and system based on wildcard domain name

技术领域Technical Field

本申请涉及通信技术领域,特别是涉及一种基于泛域名的多层级代理动态路由方法、装置及系统。The present application relates to the field of communication technology, and in particular to a multi-level proxy dynamic routing method, device and system based on wildcard domain names.

背景技术Background Art

服务的请求转发通常需要依靠代理服务器维护域名与IP地址之间的对应关系来进行路由,例如,此处引述公开号为CN112637346A的专利文件,其公开了一种代理方法、装置、代理服务器及存储介质,当接收到客户端发送的访问请求时,代理服务器获取该访问请求携带的目标域名,并根据预存的域名与IP地址的对应关系,获得目标域名对应的目标IP地址;之后,将访问请求转发给目标IP地址对应的目标业务服务器,以使目标业务服务器响应访问请求返回请求结果;再由代理服务器将请求结果反馈至客户端。The forwarding of service requests usually requires the proxy server to maintain the correspondence between the domain name and the IP address for routing. For example, the patent document with publication number CN112637346A is cited here, which discloses a proxy method, device, proxy server and storage medium. When receiving an access request sent by a client, the proxy server obtains the target domain name carried by the access request, and obtains the target IP address corresponding to the target domain name based on the pre-stored correspondence between the domain name and the IP address; then, the access request is forwarded to the target business server corresponding to the target IP address, so that the target business server responds to the access request and returns the request result; the proxy server then feeds back the request result to the client.

然而,域名通常具有较长的字符串,现有技术维护域名与IP地址之间的对应关系会带来繁重的配置管理或代码修改负担,也不利于开发人员进行访问。However, domain names usually have long character strings. The existing technology for maintaining the correspondence between domain names and IP addresses will bring heavy configuration management or code modification burdens and is not conducive to access by developers.

发明内容Summary of the invention

鉴于上述问题,提出了本申请以便提供克服上述问题或者至少部分解决上述问题的一种基于泛域名的多层级代理动态路由方法、装置及系统。In view of the above problems, the present application is proposed to provide a multi-level proxy dynamic routing method, device and system based on wildcard domain names that overcome the above problems or at least partially solve the above problems.

本申请公开一种基于泛域名的多层级代理动态路由方法,所述方法涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;The present application discloses a multi-level proxy dynamic routing method based on wildcard domain names, the method involves a user end, a gateway end, a proxy end and a service end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;

所述方法包括:The method comprises:

当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;When receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;

所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;The gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship;

所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;The gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship;

所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The gateway sends the access request and the target service address information to the proxy via the target proxy address information; the proxy sends the access request to the server via the target service address information; the server determines the request result based on the access request and returns the request result to the user.

进一步地,所述泛域名解析规则包括域名分隔符和域名段次序;Furthermore, the wildcard domain name resolution rules include domain name separators and domain name segment order;

所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段的步骤,包括:The step of determining the target first domain name segment and the target second domain name segment by the gateway according to the target wildcard domain name and the wildcard domain name resolution rule comprises:

所述网关端依据所述目标泛域名确定有效信息字符串;The gateway determines a valid information string according to the target wildcard domain name;

所述网关端依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段。The gateway determines the target first domain name segment and the target second domain name segment according to the valid information string, the domain name separator and the domain name segment order.

进一步地,所述网关端依据所述目标泛域名确定有效信息字符串的步骤,包括:Furthermore, the step of determining a valid information string according to the target wildcard domain name by the gateway includes:

所述网关端依据所述目标泛域名去除主域名信息,并截取有效信息字符串。The gateway removes the primary domain name information according to the target wildcard domain name, and intercepts a valid information character string.

进一步地,所述网关端依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段的步骤,包括:Furthermore, the gateway determines the target first domain name segment and the target second domain name segment according to the valid information string, the domain name separator and the domain name segment order, including:

所述网关端依据所述域名分隔符切分所述有效信息字符串并依次排列确定字符串序列;The gateway divides the valid information string according to the domain name separator and arranges them in sequence to determine a string sequence;

所述网关端依据所述字符串序列和所述域名段次序确定目标第一域名段和目标第二域名段。The gateway determines the target first domain name segment and the target second domain name segment according to the character string sequence and the order of the domain name segments.

进一步地,所述目标第一域名段包括目标机房名称;Furthermore, the target first domain name segment includes a target computer room name;

所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息的步骤,包括:The step of determining the target proxy address information by the gateway according to the target first domain name segment and the first corresponding relationship includes:

所述网关端依据所述目标机房名称和所述第一对应关系确定目标代理地址信息。The gateway determines the target proxy address information according to the target computer room name and the first corresponding relationship.

进一步地,所述目标第二域名段包括目标服务名称、目标环境名称和目标业务线名称;Further, the target second domain name segment includes a target service name, a target environment name, and a target business line name;

所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息的步骤,包括:The step of determining the target service address information by the gateway according to the target second domain name segment and the second corresponding relationship includes:

所述网关端依据所述目标服务名称、所述目标环境名称、所述目标业务线名称和所述第二对应关系确定目标服务地址信息。The gateway determines the target service address information according to the target service name, the target environment name, the target business line name and the second corresponding relationship.

进一步地,所述目标第二域名段包括:目标IP地址和目标端口号;Furthermore, the target second domain name segment includes: a target IP address and a target port number;

所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息的步骤,包括:The step of determining the target service address information by the gateway according to the target second domain name segment and the second corresponding relationship includes:

所述网关端依据所述目标IP地址、所述目标端口号和所述第二对应关系确定目标服务地址信息。The gateway determines the target service address information according to the target IP address, the target port number and the second corresponding relationship.

本申请还公开一种基于泛域名的多层级代理动态路由装置,所述装置涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;The present application also discloses a multi-level proxy dynamic routing device based on wildcard domain names, the device involves a user end, a gateway end, a proxy end and a service end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;

所述装置包括:The device comprises:

泛域名解析模块,用于依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;A wildcard domain name resolution module, used to determine a target first domain name segment and a target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;

代理地址信息确定模块,用于依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;A proxy address information determination module, configured to determine target proxy address information according to the target first domain name segment and the first corresponding relationship;

服务地址信息确定模块,用于依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;A service address information determination module, used to determine target service address information according to the target second domain name segment and the second corresponding relationship;

发送模块,用于通过所述目标代理地址信息发送所述访问请求和目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。A sending module is used to send the access request and target service address information to the proxy end through the target proxy address information; the proxy end is used to send the access request to the server end through the target service address information; the server end is used to determine the request result based on the access request, and return the request result to the user end.

本申请还公开一种基于泛域名的多层级代理动态路由系统,所述系统包括用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;The present application also discloses a multi-level proxy dynamic routing system based on wildcard domain names, the system comprising a user end, a gateway end, a proxy end and a server end; the gateway end pre-stores wildcard domain name resolution rules; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information;

所述系统包括:The system comprises:

所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;The user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;

所述网关端用于依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段,以及依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息,以及依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息,以及通过所述目标代理地址信息发送所述访问请求和目标服务地址信息至所述代理端;The gateway end is used to determine the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule, and to determine the target proxy address information according to the target first domain name segment and the first corresponding relationship, and to determine the target service address information according to the target second domain name segment and the second corresponding relationship, and to send the access request and the target service address information to the proxy end through the target proxy address information;

所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;The proxy end is used to send the access request to the server end through the target service address information;

所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The server is used to determine a request result according to the access request, and return the request result to the client.

进一步地,所述代理端包括至少两个;所述服务端包括至少两个;所述代理端和所述服务端一一对应;Furthermore, the proxy terminals include at least two; the server terminals include at least two; the proxy terminals correspond to the server terminals one by one;

所述网关端包括OpenResty服务器,所述代理端包括OpenResty Proxy代理服务器;所述网关端通过IP白名单访问或VPN访问与所述代理端通讯连接。The gateway end includes an OpenResty server, and the proxy end includes an OpenResty Proxy proxy server; the gateway end is connected to the proxy end through IP whitelist access or VPN access.

本申请具有以下优点:This application has the following advantages:

在本申请的实施例中,相对于现有技术维护域名与IP地址之间的对应关系会带来繁重的配置管理或代码修改负担,也不利于开发人员进行访问,本申请提供了一种基于泛域名的多层级代理动态路由方法、装置及系统,所述方法涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;所述方法包括:当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。本申请解决了现有技术维护域名与IP地址之间的对应关系不利于开发人员进行访问的问题,达到了通过多层级的动态路由实现请求转发的技术效果。In the embodiments of the present application, compared with the prior art, maintaining the correspondence between domain names and IP addresses will bring heavy configuration management or code modification burdens, and is not conducive to developer access. The present application provides a multi-level proxy dynamic routing method, device and system based on wildcard domain names, the method involving a user end, a gateway end, a proxy end and a server end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name; the method includes: when receiving When receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule; the gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship; the gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship; the gateway sends the access request and the target service address information to the proxy through the target proxy address information; the proxy is used to send the access request to the server through the target service address information; the server is used to determine the request result according to the access request, and return the request result to the user. This application solves the problem that the prior art maintains the correspondence between domain names and IP addresses, which is not conducive to developers' access, and achieves the technical effect of realizing request forwarding through multi-level dynamic routing.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请的技术方案,下面将对本申请的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description 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.

图1是本申请一实施例提供的一种基于泛域名的多层级代理动态路由方法的步骤流程图;FIG1 is a flowchart of a multi-level proxy dynamic routing method based on wildcard domain names provided in an embodiment of the present application;

图2是本申请一实施例提供的一种基于泛域名的多层级代理动态路由装置的结构示意图;FIG2 is a schematic diagram of the structure of a multi-level proxy dynamic routing device based on wildcard domain names provided in an embodiment of the present application;

图3是本申请一实施例提供的一种基于泛域名的多层级代理动态路由系统的第一结构框图;FIG3 is a first structural block diagram of a multi-level proxy dynamic routing system based on wildcard domain names provided in an embodiment of the present application;

图4是本申请一实施例提供的一种基于泛域名的多层级代理动态路由系统的第二结构框图;FIG4 is a second structural block diagram of a multi-level proxy dynamic routing system based on wildcard domain names provided in an embodiment of the present application;

图5是本申请一实施例提供的一种基于泛域名的多层级代理动态路由方法的第一数据传输结构示意图;5 is a schematic diagram of a first data transmission structure of a multi-level proxy dynamic routing method based on wildcard domain names provided by an embodiment of the present application;

图6是本申请一实施例提供的一种基于泛域名的多层级代理动态路由方法的第二数据传输结构示意图;6 is a schematic diagram of a second data transmission structure of a multi-level proxy dynamic routing method based on wildcard domain names provided by an embodiment of the present application;

图7是本申请一实施例提供的一种计算机设备的结构示意图。FIG. 7 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

为使本申请的所述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the objects, features and advantages of the present application more obvious and understandable, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

发明人通过分析现有技术发现:域名通常具有较长的字符串,维护域名与IP地址之间的对应关系会带来繁重的配置管理或代码修改负担,也不利于开发人员进行访问。同时,对于较为复杂的业务场景,单个服务端(机房)下可以有多个环境,一个环境内可以有多个业务线,故同个服务端下的目标IP地址就有多个,现有技术则会从多个目标IP地址中选一个,并将访问请求转发给选定的目标IP地址对应的目标服务端,而无法直接从域名访问到具体的服务。现有技术在域名配置以及进行访问时的路由过程灵活性均较差。The inventors found through analyzing the prior art that domain names usually have long character strings, and maintaining the correspondence between domain names and IP addresses will bring about a heavy burden of configuration management or code modification, and is not conducive to developer access. At the same time, for more complex business scenarios, a single server (computer room) can have multiple environments, and an environment can have multiple business lines, so there are multiple target IP addresses under the same server. The prior art will select one from the multiple target IP addresses and forward the access request to the target server corresponding to the selected target IP address, and it is impossible to directly access the specific service from the domain name. The prior art has poor flexibility in domain name configuration and the routing process when performing access.

为解决以上技术问题,本申请的核心技术构思之一在于,在多层级业务场景下引入泛域名机制,以泛域名的形式携带多层级的路由信息,从而实现服务的请求转发。泛域名是一种特殊的互联网域名,它被用于指代一个特定领域内的多个子网站或页面。例如,一个企业可以使用泛域名将其不同产品或服务的网页归纳为一个大类,并在该泛域名下建立各自的子域名。泛域名中的通配符可以将所有相关的子域名都串联起来,方便用户访问和管理。To solve the above technical problems, one of the core technical concepts of this application is to introduce a wildcard domain name mechanism in a multi-level business scenario, carrying multi-level routing information in the form of a wildcard domain name, thereby realizing service request forwarding. A wildcard domain name is a special Internet domain name that is used to refer to multiple sub-websites or pages in a specific field. For example, a company can use a wildcard domain name to group the web pages of its different products or services into a large category and establish their own subdomains under the wildcard domain name. The wildcard in the wildcard domain name can connect all related subdomains in series, making it easier for users to access and manage.

需要说明的是,在本申请所公开的实施例中,除非特别限定,任一特征均可被其他等效或具有类似目的的替代特征进行替换;本申请实施例中的特征和/或步骤,除了互相排斥的特征和/或步骤以外,均可以任何方式进行组合。It should be noted that, in the embodiments disclosed in the present application, unless otherwise specified, any feature may be replaced by other alternative features that are equivalent or have similar purposes; the features and/or steps in the embodiments of the present application, except for mutually exclusive features and/or steps, may be combined in any way.

参照图1,示出了本申请一实施例提供的一种基于泛域名的多层级代理动态路由方法,所述方法涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;1, a multi-level proxy dynamic routing method based on wildcard domain names provided by an embodiment of the present application is shown, the method involves a user end, a gateway end, a proxy end and a server end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;

所述方法包括:The method comprises:

S110、当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;S110, when receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;

S120、所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;S120, the gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship;

S130、所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;S130, the gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship;

S140、所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。S140, the gateway sends the access request and the target service address information to the proxy through the target proxy address information; the proxy sends the access request to the server through the target service address information; the server determines the request result based on the access request, and returns the request result to the user.

在本申请的实施例中,相对于现有技术维护域名与IP地址之间的对应关系会带来繁重的配置管理或代码修改负担,也不利于开发人员进行访问,本申请提供了一种基于泛域名的多层级代理动态路由方法、装置及系统,所述方法涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;所述方法包括:当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。本申请解决了现有技术维护域名与IP地址之间的对应关系不利于开发人员进行访问的问题,达到了通过多层级的动态路由实现请求转发的技术效果。In the embodiments of the present application, compared with the prior art, maintaining the correspondence between domain names and IP addresses will bring heavy configuration management or code modification burdens, and is not conducive to developer access. The present application provides a multi-level proxy dynamic routing method, device and system based on wildcard domain names, the method involving a user end, a gateway end, a proxy end and a server end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name; the method includes: when receiving When receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule; the gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship; the gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship; the gateway sends the access request and the target service address information to the proxy through the target proxy address information; the proxy is used to send the access request to the server through the target service address information; the server is used to determine the request result according to the access request, and return the request result to the user. This application solves the problem that the prior art maintains the correspondence between domain names and IP addresses, which is not conducive to developers' access, and achieves the technical effect of realizing request forwarding through multi-level dynamic routing.

下面,将对本示例性实施例中一种基于泛域名的多层级代理动态路由方法作进一步地说明。Next, a multi-level proxy dynamic routing method based on wildcard domain names in this exemplary embodiment will be further described.

需要说明的是,所述网关端可以是一种基于OpenResty框架开发的web运维平台,简称OpenResty运维平台。OpenResty是一个基于Nginx与Lua的高性能Web平台,其内部集成了大量精良的Lua库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态Web应用、Web服务和动态网关。OpenResty运维平台可供用户添加域名中特定标识与后端服务地址的对应关系,即可通过这些特定标识唯一确定后端服务的地址,OpenResty运维平台相当于为对应的具体服务自动生成了一个域名,将这些特定标识所代表的路由信息直接放置在一个标准规则下的域名中(对应于OpenResty运维平台的主域名)。OpenResty运维平台能够在进行请求转发前可从泛域名中快速获取到路由信息,进而完成请求的正确转发,因此,用户端需要以泛域名向OpenResty运维平台发起访问请求。It should be noted that the gateway end can be a web operation and maintenance platform developed based on the OpenResty framework, referred to as the OpenResty operation and maintenance platform. OpenResty is a high-performance Web platform based on Nginx and Lua, which integrates a large number of sophisticated Lua libraries, third-party modules and most dependencies. It is used to easily build dynamic Web applications, Web services and dynamic gateways that can handle ultra-high concurrency and high scalability. The OpenResty operation and maintenance platform allows users to add the correspondence between specific identifiers in the domain name and the backend service address, that is, the address of the backend service can be uniquely determined by these specific identifiers. The OpenResty operation and maintenance platform is equivalent to automatically generating a domain name for the corresponding specific service, and placing the routing information represented by these specific identifiers directly in a domain name under a standard rule (corresponding to the main domain name of the OpenResty operation and maintenance platform). The OpenResty operation and maintenance platform can quickly obtain routing information from the wildcard domain name before forwarding the request, and then complete the correct forwarding of the request. Therefore, the user end needs to initiate an access request to the OpenResty operation and maintenance platform with a wildcard domain name.

所述服务端可以与所述网关端部署于同一机房(内网访问),也可以是部署于不同机房(公网访问)。当所述服务端与所述网关端部署于不同机房时,出于安全性考虑,OpenResty运维平台无法直接访问到服务端的所有服务,因此,可以在服务端前部署一个同样是基于OpenResty实现的Proxy代理服务(代理端),由网关端通过IP白名单或者VPN网络访问模式对代理端进行网络安全控制访问。所有请求都是先从网关端转发至代理端上,然后再由代理端转发至服务端具体的后端服务上。The server can be deployed in the same computer room as the gateway (intranet access) or in different computer rooms (public network access). When the server and the gateway are deployed in different computer rooms, for security reasons, the OpenResty operation and maintenance platform cannot directly access all services of the server. Therefore, a Proxy service (agent) based on OpenResty can be deployed in front of the server, and the gateway can perform network security control access to the agent through IP whitelist or VPN network access mode. All requests are first forwarded from the gateway to the agent, and then forwarded by the agent to the specific backend service of the server.

所述第一对应关系和所述第二对应关系表示域名中特定标识与地址信息的对应关系,即,OpenResty运维平台并不直接存储所生成的泛域名与地址信息之间的对应关系,而是对访问请求中的目标泛域名进行解析后动态确定相应的服务地址,以实现动态路由。The first correspondence and the second correspondence represent the correspondence between a specific identifier in a domain name and address information, that is, the OpenResty operation and maintenance platform does not directly store the correspondence between the generated wildcard domain name and address information, but dynamically determines the corresponding service address after resolving the target wildcard domain name in the access request to achieve dynamic routing.

如所述步骤S110所述,当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段。As described in step S110, when receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule.

需要说明的是,所述泛域名解析规则可以用于将泛域名划分为第一域名段和第二域名段,以进一步确定代理地址信息和服务地址信息。It should be noted that the wildcard domain name resolution rule can be used to divide the wildcard domain name into a first domain name segment and a second domain name segment to further determine the proxy address information and the service address information.

如所述步骤S120和步骤S130所述,所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;As described in step S120 and step S130, the gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship; the gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship;

需要说明的是,所述泛域名可以包括第一域名段、第二域名段以及主域名,第一域名段可以用于确定用于代理端的地址,第二域名段可以用于确定服务端及其具体服务的地址,主域名可以是用户端用于访问网关端的公网域名。It should be noted that the wildcard domain name may include a first domain name segment, a second domain name segment and a primary domain name. The first domain name segment may be used to determine the address used for the proxy end, the second domain name segment may be used to determine the address of the server end and its specific service, and the primary domain name may be the public domain name used by the user end to access the gateway end.

所述第一对应关系为第一域名段与代理地址信息之间的对应关系;当第一域名段为机房名称时,网关端可以依据机房名称和第一对应关系确定该机房(服务端)所对应的代理端,即,网关端并不直接发送访问请求至服务端,而是先发送访问请求至代理端后,由代理端转发至服务端,服务端和代理端是相对应的。The first correspondence is the correspondence between the first domain name segment and the proxy address information; when the first domain name segment is the name of a computer room, the gateway can determine the proxy corresponding to the computer room (server) based on the name of the computer room and the first correspondence, that is, the gateway does not directly send an access request to the server, but first sends the access request to the proxy, which is then forwarded to the server. The server and the proxy correspond to each other.

所述第二对应关系为第二域名段与服务地址信息之间的对应关系;网关端可以依据服务名称和第二对应关系确定服务端机房下具体服务的地址信息,代理端则通过所述服务地址信息进行转发。The second correspondence is the correspondence between the second domain name segment and the service address information; the gateway end can determine the address information of the specific service in the server room according to the service name and the second correspondence, and the proxy end forwards it through the service address information.

上述步骤S120~S130是本实施例下的具体实现方式,可根据实际需求调整步骤S120~S130的先后顺序,上述步骤的顺序不应理解为对本申请的限定。The above steps S120~S130 are specific implementation methods under this embodiment. The order of steps S120~S130 can be adjusted according to actual needs. The order of the above steps should not be understood as a limitation on this application.

如所述步骤S140所述,所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。As described in step S140, the gateway sends the access request and the target service address information to the proxy via the target proxy address information; the proxy is used to send the access request to the server via the target service address information; the server is used to determine the request result based on the access request, and return the request result to the user.

需要说明的是,所有对泛域名的解析可以都在所述网关端上进行,所述代理端可以只负责将访问请求原封不动地进行转发;所述服务端可以依次通过所述代理端和所述网关端返回所述请求结果至所述用户端。It should be noted that all resolution of wildcard domain names can be performed on the gateway end, and the proxy end can only be responsible for forwarding the access request intact; the server end can return the request result to the user end through the proxy end and the gateway end in turn.

在本申请一实施例中,所述泛域名解析规则包括域名分隔符和域名段次序;In one embodiment of the present application, the wildcard domain name resolution rule includes domain name separators and domain name segment order;

可以结合下列描述进一步说明步骤S110所述“所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段”的具体过程。The specific process of "the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule" in step S110 can be further explained in combination with the following description.

如下列步骤所述,所述网关端依据所述目标泛域名确定有效信息字符串;As described in the following steps, the gateway determines a valid information string according to the target wildcard domain name;

所述网关端依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段。The gateway determines the target first domain name segment and the target second domain name segment according to the valid information string, the domain name separator and the domain name segment order.

需要说明的是,有效信息字符串可以表示泛域名中包含有能够确定代理地址信息和服务地址信息的有效部分;域名分隔符可以表示将第一域名段和第二域名段进行分隔的标识符;所述域名段次序可以表示依据排列的次序分别确定第一域名段和第二域名段的规则。It should be noted that the valid information string can indicate that the wildcard domain name contains a valid part that can determine the proxy address information and the service address information; the domain name separator can indicate an identifier that separates the first domain name segment and the second domain name segment; the domain name segment order can indicate the rules for respectively determining the first domain name segment and the second domain name segment according to the order of arrangement.

在本申请一实施例中,可以结合下列描述进一步说明“所述网关端依据所述目标泛域名确定有效信息字符串”的具体过程。In an embodiment of the present application, the specific process of "the gateway determines a valid information string according to the target wildcard domain name" can be further explained in combination with the following description.

如下列步骤所述,所述网关端依据所述目标泛域名去除主域名信息,并截取有效信息字符串。As described in the following steps, the gateway removes the primary domain name information according to the target wildcard domain name and intercepts a valid information string.

需要说明的是,当泛域名中包含主域名时,所述网关端可以先去除主域名信息,再截取有效信息字符串。It should be noted that, when the wildcard domain name includes the primary domain name, the gateway may first remove the primary domain name information and then intercept the valid information string.

在本申请一实施例中,可以结合下列描述进一步说明“所述网关端依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段”的具体过程。In one embodiment of the present application, the specific process of "the gateway determines the target first domain name segment and the target second domain name segment based on the valid information string, the domain name separator and the domain name segment order" can be further explained in combination with the following description.

如下列步骤所述,所述网关端依据所述域名分隔符切分所述有效信息字符串并依次排列确定字符串序列;As described in the following steps, the gateway divides the valid information string according to the domain name separator and arranges them in sequence to determine a string sequence;

所述网关端依据所述字符串序列和所述域名段次序确定目标第一域名段和目标第二域名段。The gateway determines the target first domain name segment and the target second domain name segment according to the character string sequence and the order of the domain name segments.

需要说明的是,字符串序列可以表示切分出的不同域名段,也可以直接表示切分出的机房或具体服务的名称。It should be noted that the string sequence can represent different domain name segments that are segmented, or can directly represent the name of a segmented computer room or specific service.

作为一种示例,当以“server.idc.env.bu.moat.demo.com”作为访问请求的泛域名时,“所述网关端依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段”具体可以包括如下步骤:As an example, when "server.idc.env.bu.moat.demo.com" is used as the wildcard domain name of the access request, "the gateway determines the target first domain name segment and the target second domain name segment according to the valid information string, the domain name separator and the domain name segment order" may specifically include the following steps:

所述网关端去除泛域名中的主域名信息“.moat.demo.com”,截取有效信息字符串“server.idc.env.bu”;The gateway removes the primary domain name information ".moat.demo.com" from the wildcard domain name and intercepts the valid information string "server.idc.env.bu";

所述网关端通过“.”号作为域名分隔符对“server.idc.env.bu”进行切分,得到字符串序列“server”、“idc”、“env”和“bu”;The gateway splits "server.idc.env.bu" by using "." as a domain name separator to obtain a string sequence of "server", "idc", "env" and "bu".

所述网关端以域名段次序确定字符串序列中各域名段的名称:第一位置的“server”表示服务名称,第二位置的“idc”表示机房名称,第三位置的“env”表示环境名称,第四位置的“bu”表示业务线名称。The gateway determines the name of each domain name segment in the character string sequence in order of domain name segments: the "server" in the first position represents the service name, the "idc" in the second position represents the computer room name, the "env" in the third position represents the environment name, and the "bu" in the fourth position represents the business line name.

作为一种示例,当以“server.idc.env.bu.ip.port.moat.demo.com”作为访问请求的泛域名时,可见,相较于泛域名“server.idc.env.bu.moat.demo.com”,泛域名“server.idc.env.bu.ip.port.moat.demo.com”增加了“ip”和“port”两个层级,可以通过域名段次序确定域名段中所指向的服务地址:第五位置的“ip”表示IP地址,第六位置的“idc”表示端口号。As an example, when "server.idc.env.bu.ip.port.moat.demo.com" is used as the wildcard domain name of the access request, it can be seen that compared with the wildcard domain name "server.idc.env.bu.moat.demo.com", the wildcard domain name "server.idc.env.bu.ip.port.moat.demo.com" adds two levels of "ip" and "port". The service address pointed to in the domain name segment can be determined by the order of the domain name segments: the "ip" in the fifth position represents the IP address, and the "idc" in the sixth position represents the port number.

作为一种示例,当以“idc.ip.port.moat.demo.com”作为访问请求的泛域名时,所述网关端可直接通过该域名和第一对应关系确定服务端机房对应的代理端地址后,直接通过域名指定对应的IP地址和端口,这种情况下可以无需预先配置服务名称、环境名称等与真实地址之间的对应关系。As an example, when "idc.ip.port.moat.demo.com" is used as the wildcard domain name of the access request, the gateway can directly determine the proxy address corresponding to the server computer room through the domain name and the first correspondence, and then directly specify the corresponding IP address and port through the domain name. In this case, there is no need to pre-configure the correspondence between the service name, environment name, etc. and the real address.

需要说明的是,在上述的各个泛域名层级中,可以有至少一个层级为空,例如,在“服务名.机房名.环境名.业务线名.主域名”的结构中,“环境名”和“业务线名”可以为空,即表示为目标服务端机房里只有一套环境和一个业务线。对于开发运维人员而言,仅需记忆泛域名的结构,即可直接通过对应的名称对具体的服务进行访问。It should be noted that in each of the wildcard domain name levels mentioned above, at least one level can be empty. For example, in the structure of "service name. computer room name. environment name. business line name. primary domain name", "environment name" and "business line name" can be empty, which means that there is only one environment and one business line in the computer room of the target server. For development and operation and maintenance personnel, they only need to remember the structure of the wildcard domain name and can directly access specific services through the corresponding name.

在本申请一实施例中,所述目标第一域名段包括目标机房名称;In one embodiment of the present application, the target first domain name segment includes the target computer room name;

可以结合下列描述进一步说明“所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息”的具体过程。The specific process of "the gateway determines the target proxy address information based on the target first domain name segment and the first corresponding relationship" can be further explained in combination with the following description.

如下列步骤所述,所述网关端依据所述目标机房名称和所述第一对应关系确定目标代理地址信息。As described in the following steps, the gateway determines the target proxy address information according to the target computer room name and the first corresponding relationship.

需要说明的是,可以通过机房名称表示访问请求最终送达的服务端,机房名称和第一对应关系用于确定服务端所对应代理端的地址;服务地址信息由第二域名段和第二对应关系确定,而不直接通过机房名称确定服务端地址。It should be noted that the computer room name can be used to represent the server to which the access request is ultimately delivered, and the computer room name and the first correspondence are used to determine the address of the proxy corresponding to the server; the service address information is determined by the second domain name segment and the second correspondence, rather than directly determining the server address through the computer room name.

在本申请一实施例中,所述目标第二域名段包括目标服务名称、目标环境名称和目标业务线名称;In one embodiment of the present application, the target second domain name segment includes a target service name, a target environment name, and a target business line name;

可以结合下列描述进一步说明“所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息”的具体过程。The specific process of "the gateway determines the target service address information based on the target second domain name segment and the second corresponding relationship" can be further explained in combination with the following description.

如下列步骤所述,所述网关端依据所述目标服务名称、所述目标环境名称、所述目标业务线名称和所述第二对应关系确定目标服务地址信息。As described in the following steps, the gateway determines the target service address information according to the target service name, the target environment name, the target business line name and the second corresponding relationship.

需要说明的是,对于较为复杂的业务场景,服务端机房下可以有多个环境,一个环境内可以有多个业务线,故同个服务端可以包含多个服务地址;通过目标服务名称、目标环境名称和目标业务线名称,所述网关端所确定的目标服务地址信息为服务端机房下具体服务的地址信息,所述代理端能够通过目标服务地址信息直接访问到具体的服务实现多层级访问。It should be noted that for more complex business scenarios, there may be multiple environments under the server computer room, and there may be multiple business lines within an environment, so the same server may contain multiple service addresses; through the target service name, target environment name and target business line name, the target service address information determined by the gateway end is the address information of the specific service under the server computer room, and the proxy end can directly access the specific service through the target service address information to achieve multi-level access.

在本申请一实施例中,所述目标第二域名段包括:目标IP地址和目标端口号;In one embodiment of the present application, the target second domain name segment includes: a target IP address and a target port number;

可以结合下列描述进一步说明“所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息”的具体过程。The specific process of "the gateway determines the target service address information based on the target second domain name segment and the second corresponding relationship" can be further explained in combination with the following description.

如下列步骤所述,所述网关端依据所述目标IP地址、所述目标端口号和所述第二对应关系确定目标服务地址信息。As described in the following steps, the gateway determines the target service address information according to the target IP address, the target port number and the second corresponding relationship.

需要说明的是,对于目标服务在多个IP下都存在的情况,所述网关端可以直接通过目标IP地址、目标端口号和第二对应关系确定目标服务地址信息,即,可通过IP地址和端口号直接指定服务地址信息,域名中可以不包含服务名称、环境名称和业务线名称,也无需预先配置服务名称、环境名称和业务线名称与服务地址信息的对应关系。It should be noted that in the case where the target service exists under multiple IPs, the gateway can directly determine the target service address information through the target IP address, target port number and the second correspondence, that is, the service address information can be directly specified by the IP address and port number, and the domain name may not contain the service name, environment name and business line name, and there is no need to pre-configure the correspondence between the service name, environment name and business line name and the service address information.

在本申请一实施例中,参照图4-6,所述代理端可以包括至少两个;所述服务端可以包括至少两个;所述代理端和所述服务端可以是一一对应的;所述方法具体可以包括:In an embodiment of the present application, referring to FIGS. 4-6 , the proxy terminals may include at least two; the server terminals may include at least two; the proxy terminals and the server terminals may correspond one to one; the method may specifically include:

所述网关端通过所述目标代理地址信息发送所述访问请求和目标服务地址信息至目标代理端;所述目标代理端用于通过目标服务地址信息发送访问请求至目标服务端;所述目标服务端用于依据所述访问请求确定请求结果,以及通过所述目标代理端和所述网关端返回所述请求结果至所述用户端。The gateway sends the access request and target service address information to the target proxy via the target proxy address information; the target proxy is used to send the access request to the target server via the target service address information; the target server is used to determine the request result based on the access request, and return the request result to the user via the target proxy and the gateway.

需要说明的是,当所述代理端和所述服务端均包括至少两个时,所述方法可以用于跨机房访问,泛域名机制可使得跨机房场景下所有web服务均可生成一套统一规则的域名,实现对一个或多个服务端下的多个散乱的web服务进行集中地访问管理,开发运维人员查询或操作不同机房和环境的web服务时,不再需要频繁地来回切换VPN网络,极大提升工作效率,简化了访问和管理;开发运维人员也不再需要记录繁杂的各种web服务地址,并且所有的web平台数据增删改查都可按预分配的不同用户权限安全的自主进行操作,省去了每次排查问题时都要找运维人员协助的繁琐;排查生产业务问题时,在一个web运维平台上就能完成所有机房的服务运行状态数据获取、日志查询、监控数据查看等,使常用问题分析的工具和手段都集中于一个运维平台上,极大的提升了生产问题的处置效率。It should be noted that when the proxy end and the server end each include at least two, the method can be used for cross-computer room access, and the wildcard domain name mechanism can enable all web services in cross-computer room scenarios to generate a set of domain names with unified rules, thereby realizing centralized access management of multiple scattered web services under one or more servers. When development and operation personnel query or operate web services in different computer rooms and environments, they no longer need to frequently switch back and forth VPN networks, which greatly improves work efficiency and simplifies access and management; development and operation personnel no longer need to record various complicated web service addresses, and all web platform data additions, deletions, modifications and inquiries can be performed safely and independently according to pre-assigned different user permissions, eliminating the tediousness of having to seek assistance from operation and maintenance personnel every time a problem is investigated; when troubleshooting production business problems, service operation status data acquisition, log query, monitoring data viewing, etc. of all computer rooms can be completed on a web operation and maintenance platform, so that the tools and means for common problem analysis are concentrated on one operation and maintenance platform, greatly improving the efficiency of handling production problems.

在一具体实现中,参照图5,OpenResty运维平台可以部署于核心数据中心中;用户可以通过泛域名发起http/tcp访问请求至OpenResty运维平台;对于跨机房(多个数据中心)场景,OpenResty运维平台分别依据泛域名中不同数据中心的机房名称发送访问请求至对应的平台Proxy代理模块:idc_a对应于数据中心A的代理,idc_b对应于数据中心B的代理,idc_c对应于数据中心C的代理;对于数据中心A,平台Proxy代理模块再根据服务名称server_m对后端服务池进行访问;对于数据中心B,平台Proxy代理模块再根据服务名称server_n对后端服务池进行访问;对于数据中心C,平台Proxy代理模块再根据IP地址10.0.0.1以及端口号8080对后端服务池进行访问。In a specific implementation, referring to FIG5 , the OpenResty operation and maintenance platform can be deployed in a core data center; users can initiate http/tcp access requests to the OpenResty operation and maintenance platform through wildcard domain names; for cross-computer room (multiple data centers) scenarios, the OpenResty operation and maintenance platform sends access requests to the corresponding platform Proxy proxy modules according to the computer room names of different data centers in the wildcard domain names: idc_a corresponds to the proxy of data center A, idc_b corresponds to the proxy of data center B, and idc_c corresponds to the proxy of data center C; for data center A, the platform Proxy proxy module accesses the backend service pool according to the service name server_m; for data center B, the platform Proxy proxy module accesses the backend service pool according to the service name server_n; for data center C, the platform Proxy proxy module accesses the backend service pool according to the IP address 10.0.0.1 and the port number 8080.

在一具体实现中,参照图6,所述方法还可以涉及存储端,所述存储端可以为阿里云OSS(对象存储服务),所述目标泛域名可以包括控制指令域名段,所述控制指令域名段对应于shell指令和/或服务分析组件web请求;所述网关端解析出控制指令后将访问请求和控制指令发送至代理端,所述服务端依据访问请求确定请求结果后,将服务运行状态数据上传至阿里云OSS,再由网关端读取阿里云OSS中的服务运行状态数据,即,所述服务端通过所述存储端返回请求结果至所述网关端。In a specific implementation, referring to Figure 6, the method may also involve a storage end, which may be Alibaba Cloud OSS (object storage service), and the target wild-card domain name may include a control instruction domain name segment, which corresponds to a shell instruction and/or a service analysis component web request; after the gateway end parses the control instruction, it sends the access request and the control instruction to the proxy end, and after the server end determines the request result based on the access request, it uploads the service operation status data to Alibaba Cloud OSS, and then the gateway end reads the service operation status data in Alibaba Cloud OSS, that is, the server end returns the request result to the gateway end through the storage end.

在一具体实现中,用户可以使用一个标准的泛域名“http://rocketmq.alifin.moat.iboxpay.com”发起http访问请求,访问请求首先到达OpenResty运维平台网关;OpenResty运维平台网关根据域名中携带的服务名rocketmq、机房名alifin(阿里金融云),将访问请求转发至目标机房阿里金融云的OpenResty Proxy代理服务上;阿里金融云的OpenResty Proxy代理服务再将访问请求原封不动地代理至目标服务rocketmq上。In a specific implementation, a user can use a standard wildcard domain name "http://rocketmq.alifin.moat.iboxpay.com" to initiate an http access request. The access request first reaches the OpenResty operation and maintenance platform gateway; the OpenResty operation and maintenance platform gateway forwards the access request to the OpenResty Proxy service of the target data center Alibaba Financial Cloud based on the service name rocketmq and the data center name alifin (Ali Financial Cloud) carried in the domain name; the OpenResty Proxy service of Alibaba Financial Cloud then proxies the access request intactly to the target service rocketmq.

以上是对本申请方法实施例的描述,对于装置实施例而言,由于其与方法实施例基本相似,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。The above is a description of the method embodiment of the present application. As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

参照图2,示出了本申请一实施例提供的一种基于泛域名的多层级代理动态路由装置,所述装置涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;2, a multi-level proxy dynamic routing device based on wildcard domain name provided by an embodiment of the present application is shown, the device involves a user end, a gateway end, a proxy end and a service end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;

所述装置包括:The device comprises:

泛域名解析模块210,用于依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;A wildcard domain name resolution module 210, configured to determine a target first domain name segment and a target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;

代理地址信息确定模块220,用于依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;A proxy address information determination module 220, configured to determine target proxy address information according to the target first domain name segment and the first corresponding relationship;

服务地址信息确定模块230,用于依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;A service address information determination module 230, configured to determine target service address information according to the target second domain name segment and the second corresponding relationship;

发送模块240,用于通过所述目标代理地址信息发送所述访问请求和目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The sending module 240 is used to send the access request and the target service address information to the agent end through the target agent address information; the agent end is used to send the access request to the server end through the target service address information; the server end is used to determine the request result based on the access request, and return the request result to the user end.

在本申请一实施例中,所述泛域名解析规则包括域名分隔符和域名段次序;所述泛域名解析模块210包括:In an embodiment of the present application, the wildcard domain name resolution rule includes domain name separators and domain name segment order; the wildcard domain name resolution module 210 includes:

有效信息字符串确定子模块,用于依据所述目标泛域名确定有效信息字符串;A valid information string determination submodule, used to determine a valid information string according to the target wildcard domain name;

目标域名段确定子模块,用于依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段。The target domain name segment determination submodule is used to determine the target first domain name segment and the target second domain name segment according to the valid information string, the domain name separator and the domain name segment order.

在本申请一实施例中,所述有效信息字符串确定子模块用于依据所述目标泛域名去除主域名信息,并截取有效信息字符串。In an embodiment of the present application, the valid information string determination submodule is used to remove the primary domain name information according to the target wildcard domain name and intercept the valid information string.

在本申请一实施例中,所述目标域名段确定子模块包括:In one embodiment of the present application, the target domain name segment determination submodule includes:

字符串切分排列子模块,用于依据所述域名分隔符切分所述有效信息字符串并依次排列确定字符串序列;A character string segmentation and arrangement submodule, used to segment the valid information character string according to the domain name separator and arrange them in sequence to determine a character string sequence;

域名段次序匹配子模块,用于依据所述字符串序列和所述域名段次序确定目标第一域名段和目标第二域名段。The domain name segment order matching submodule is used to determine the target first domain name segment and the target second domain name segment according to the character string sequence and the domain name segment order.

在本申请一实施例中,所述目标第一域名段包括目标机房名称;In one embodiment of the present application, the target first domain name segment includes the target computer room name;

所述代理地址信息确定模块220用于依据所述目标机房名称和所述第一对应关系确定目标代理地址信息。The proxy address information determination module 220 is used to determine the target proxy address information according to the target computer room name and the first corresponding relationship.

在本申请一实施例中,所述目标第二域名段包括目标服务名称、目标环境名称和目标业务线名称;In one embodiment of the present application, the target second domain name segment includes a target service name, a target environment name, and a target business line name;

所述服务地址信息确定模块230用于依据所述目标服务名称、所述目标环境名称、所述目标业务线名称和所述第二对应关系确定目标服务地址信息。The service address information determination module 230 is used to determine the target service address information according to the target service name, the target environment name, the target business line name and the second corresponding relationship.

在本申请一实施例中,所述目标第二域名段包括:目标IP地址和目标端口号;In one embodiment of the present application, the target second domain name segment includes: a target IP address and a target port number;

服务地址信息确定模块230用于依据所述目标IP地址、所述目标端口号和所述第二对应关系确定目标服务地址信息。The service address information determination module 230 is used to determine the target service address information according to the target IP address, the target port number and the second corresponding relationship.

对于系统实施例而言,由于其与方法实施例基本相似,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。As for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

参照图3,示出了本申请一实施例提供的一种基于泛域名的多层级代理动态路由系统,所述系统包括用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;3, a multi-level proxy dynamic routing system based on wildcard domain names provided by an embodiment of the present application is shown, the system comprising a user end, a gateway end, a proxy end and a server end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information;

所述系统包括:The system comprises:

所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;The user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;

所述网关端用于依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段,以及依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息,以及依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息,以及通过所述目标代理地址信息发送所述访问请求和目标服务地址信息至所述代理端;The gateway end is used to determine the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule, and to determine the target proxy address information according to the target first domain name segment and the first corresponding relationship, and to determine the target service address information according to the target second domain name segment and the second corresponding relationship, and to send the access request and the target service address information to the proxy end through the target proxy address information;

所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;The proxy end is used to send the access request to the server end through the target service address information;

所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The server is used to determine a request result according to the access request, and return the request result to the client.

在本申请一实施例中,参照图4,所述代理端包括至少两个;所述服务端包括至少两个;所述代理端和所述服务端一一对应;In one embodiment of the present application, referring to FIG. 4 , the proxy terminals include at least two; the server terminals include at least two; the proxy terminals correspond to the server terminals one by one;

所述网关端包括OpenResty服务器,所述代理端包括OpenResty Proxy代理服务器;所述网关端通过IP白名单访问或VPN访问与所述代理端通讯连接。The gateway end includes an OpenResty server, and the proxy end includes an OpenResty Proxy proxy server; the gateway end is connected to the proxy end through IP whitelist access or VPN access.

参照图7,示出了本申请实施例提供的一种计算机设备的框图。计算机设备12适于用来实现本发明实施方式,具体可以包括如下:7, a block diagram of a computer device provided in an embodiment of the present application is shown. The computer device 12 is suitable for implementing the embodiments of the present invention, and may specifically include the following:

计算机设备12以通用计算设备的形式表现。计算机设备12的组件可以包括但不限于:一个或者多个处理单元16,系统存储器28,连接不同系统组件(包括系统存储器28和处理单元16)的总线18。计算机设备12可以是挂接在总线上的设备。The computer device 12 is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16). The computer device 12 may be a device attached to the bus.

总线18表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA)总线,微通道体系结构(MCA)总线,增强型ISA总线、视频电子标准协会(VESA)局域总线以及外围组件互连(PCI)总线。Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

计算机设备12典型地包括多种计算机系统可读介质。这些介质可以是任何能够被计算机设备12访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.

系统存储器28可以包括易失性存储器形式的计算机系统可读介质,例如RAM 30(随机存取存储器)和/或高速缓存32。计算机设备12可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统34可以用于读写不可移动的、非易失性磁介质(通常称为“硬盘驱动器”)。尽管图7中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CD-ROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线18相连。系统存储器28可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本发明各实施例的功能。The system memory 28 may include computer system readable media in the form of volatile memory, such as RAM 30 (random access memory) and/or cache 32. The computer device 12 may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as "hard drives"). Although not shown in FIG. 7 , a disk drive for reading and writing removable non-volatile disks (such as "floppy disks"), and an optical disk drive for reading and writing removable non-volatile optical disks (such as CD-ROMs, DVD-ROMs or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of various embodiments of the present invention.

具有一组(至少一个)程序模块42的程序/实用工具40,可以存储在例如系统存储器28中,这样的程序模块42包括——但不限于——操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块42通常执行本发明所描述的实施例中的功能和/或方法。A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.

计算机设备12也可以与一个或多个外部设备14(例如键盘、指向设备、显示器24等)通信,还可与一个或者多个使得用户能与该计算机设备12交互的设备通信,和/或与使得该计算机设备12能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过I/O接口22(输入/输出(Input/Output)接口)进行。并且,计算机设备12还可以通过网络适配器20与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络(例如因特网))通信。如图7所示,网络适配器20通过总线18与计算机设备12的其它模块通信。应当明白,尽管图7中未示出,可以结合计算机设备12使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the computer device 12, and/or may communicate with any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an I/O interface 22 (input/output interface). In addition, the computer device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and/or public networks (e.g., the Internet)) via a network adapter 20. As shown in FIG. 7 , the network adapter 20 communicates with other modules of the computer device 12 via a bus 18. It should be understood that, although not shown in FIG. 7 , other hardware and/or software modules may be used in conjunction with the computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

处理单元16通过运行存储在系统存储器28中的程序,从而执行各种功能应用以及数据处理,例如实现本发明任意实施例所提供的一种基于泛域名的多层级代理动态路由方法。The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing a multi-level proxy dynamic routing method based on wildcard domain names provided in any embodiment of the present invention.

也即,该程序被处理器执行时实现:That is, when the program is executed by the processor:

当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;When receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;

所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;The gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship;

所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;The gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship;

所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The gateway sends the access request and the target service address information to the proxy via the target proxy address information; the proxy sends the access request to the server via the target service address information; the server determines the request result based on the access request and returns the request result to the user.

本实施例的计算机设备12仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。The computer device 12 of this embodiment is only an example and should not bring any limitation to the functions and scope of use of the embodiment of the present invention.

本申请一实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本申请任意实施例提供的一种基于泛域名的多层级代理动态路由方法。An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a multi-level proxy dynamic routing method based on wildcard domain names as provided in any embodiment of the present application.

也即,该程序被处理器执行时实现:That is, when the program is executed by the processor:

当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;When receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;

所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;The gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship;

所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;The gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship;

所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The gateway sends the access request and the target service address information to the proxy via the target proxy address information; the proxy sends the access request to the server via the target service address information; the server determines the request result based on the access request and returns the request result to the user.

计算机存储介质可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、RAM、只读存储器(ROM)、可擦式可编程只读存储器(EPROM)、闪存、光纤、便携式CD-ROM、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含有或者存储有程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。Computer storage media can use any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a RAM, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括——但不限于——电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于——无线、电线、光缆、无线电频率(RF)等等,或者上述的任意合适的组合。Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括LAN或WAN——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operation of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a LAN or WAN, or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。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.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。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 "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

以上对本申请所提供的一种基于泛域名的多层级代理动态路由方法、装置及系统,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The above is a detailed introduction to a multi-level proxy dynamic routing method, device and system based on wildcard domain names provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. 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 technical personnel in this field, 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 (10)

Translated fromChinese
1.一种基于泛域名的多层级代理动态路由方法,其特征在于,所述方法涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;1. A multi-level proxy dynamic routing method based on wildcard domain names, characterized in that the method involves a user end, a gateway end, a proxy end and a server end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;所述方法包括:The method comprises:当接收到所述访问请求时,所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;When receiving the access request, the gateway determines the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;The gateway determines the target proxy address information according to the target first domain name segment and the first corresponding relationship;所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;The gateway determines the target service address information according to the target second domain name segment and the second corresponding relationship;所述网关端通过所述目标代理地址信息发送所述访问请求和所述目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The gateway sends the access request and the target service address information to the proxy via the target proxy address information; the proxy sends the access request to the server via the target service address information; the server determines the request result based on the access request and returns the request result to the user.2.根据权利要求1所述的方法,其特征在于,所述泛域名解析规则包括域名分隔符和域名段次序;2. The method according to claim 1, characterized in that the wildcard domain name resolution rule includes domain name separators and domain name segment order;所述网关端依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段的步骤,包括:The step of determining the target first domain name segment and the target second domain name segment by the gateway according to the target wildcard domain name and the wildcard domain name resolution rule comprises:所述网关端依据所述目标泛域名确定有效信息字符串;The gateway determines a valid information string according to the target wildcard domain name;所述网关端依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段。The gateway determines the target first domain name segment and the target second domain name segment according to the valid information string, the domain name separator and the domain name segment order.3.根据权利要求2所述的方法,其特征在于,所述网关端依据所述目标泛域名确定有效信息字符串的步骤,包括:3. The method according to claim 2, wherein the step of determining the valid information string according to the target wildcard domain name comprises:所述网关端依据所述目标泛域名去除主域名信息,并截取有效信息字符串。The gateway removes the primary domain name information according to the target wildcard domain name, and intercepts a valid information character string.4.根据权利要求2所述的方法,其特征在于,所述网关端依据所述有效信息字符串、所述域名分隔符和所述域名段次序确定目标第一域名段和目标第二域名段的步骤,包括:4. The method according to claim 2, characterized in that the step of determining the target first domain name segment and the target second domain name segment by the gateway according to the valid information string, the domain name separator and the domain name segment order comprises:所述网关端依据所述域名分隔符切分所述有效信息字符串并依次排列确定字符串序列;The gateway divides the valid information string according to the domain name separator and arranges them in sequence to determine a string sequence;所述网关端依据所述字符串序列和所述域名段次序确定目标第一域名段和目标第二域名段。The gateway determines the target first domain name segment and the target second domain name segment according to the character string sequence and the order of the domain name segments.5.根据权利要求1所述的方法,其特征在于,所述目标第一域名段包括目标机房名称;5. The method according to claim 1, characterized in that the target first domain name segment includes a target computer room name;所述网关端依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息的步骤,包括:The step of determining the target proxy address information by the gateway according to the target first domain name segment and the first corresponding relationship includes:所述网关端依据所述目标机房名称和所述第一对应关系确定目标代理地址信息。The gateway determines the target proxy address information according to the target computer room name and the first corresponding relationship.6.根据权利要求1所述的方法,其特征在于,所述目标第二域名段包括目标服务名称、目标环境名称和目标业务线名称;6. The method according to claim 1, characterized in that the target second domain name segment includes a target service name, a target environment name, and a target business line name;所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息的步骤,包括:The step of determining the target service address information by the gateway according to the target second domain name segment and the second corresponding relationship includes:所述网关端依据所述目标服务名称、所述目标环境名称、所述目标业务线名称和所述第二对应关系确定目标服务地址信息。The gateway determines the target service address information according to the target service name, the target environment name, the target business line name and the second corresponding relationship.7.根据权利要求1所述的方法,其特征在于,所述目标第二域名段包括:目标IP地址和目标端口号;7. The method according to claim 1, characterized in that the target second domain name segment includes: a target IP address and a target port number;所述网关端依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息的步骤,包括:The step of determining the target service address information by the gateway according to the target second domain name segment and the second corresponding relationship includes:所述网关端依据所述目标IP地址、所述目标端口号和所述第二对应关系确定目标服务地址信息。The gateway determines the target service address information according to the target IP address, the target port number and the second corresponding relationship.8.一种基于泛域名的多层级代理动态路由装置,其特征在于,所述装置涉及用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;8. A multi-level proxy dynamic routing device based on wildcard domain names, characterized in that the device involves a user end, a gateway end, a proxy end, and a service end; the gateway end pre-stores a wildcard domain name resolution rule; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information; the user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;所述装置包括:The device comprises:泛域名解析模块,用于依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段;A wildcard domain name resolution module, used to determine a target first domain name segment and a target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule;代理地址信息确定模块,用于依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息;A proxy address information determination module, configured to determine target proxy address information according to the target first domain name segment and the first corresponding relationship;服务地址信息确定模块,用于依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息;A service address information determination module, used to determine target service address information according to the target second domain name segment and the second corresponding relationship;发送模块,用于通过所述目标代理地址信息发送所述访问请求和目标服务地址信息至所述代理端;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。A sending module is used to send the access request and target service address information to the proxy end through the target proxy address information; the proxy end is used to send the access request to the server end through the target service address information; the server end is used to determine the request result based on the access request, and return the request result to the user end.9.一种基于泛域名的多层级代理动态路由系统,其特征在于,所述系统包括用户端、网关端、代理端和服务端;所述网关端预存有泛域名解析规则;所述网关端预存有第一域名段与代理地址信息之间的第一对应关系;所述网关端预存有第二域名段与服务地址信息之间的第二对应关系;9. A multi-level proxy dynamic routing system based on wildcard domain names, characterized in that the system includes a user end, a gateway end, a proxy end and a service end; the gateway end pre-stores wildcard domain name resolution rules; the gateway end pre-stores a first correspondence between a first domain name segment and proxy address information; the gateway end pre-stores a second correspondence between a second domain name segment and service address information;所述系统包括:The system comprises:所述用户端用于发送访问请求至所述网关端;其中,所述访问请求包括目标泛域名;The user end is used to send an access request to the gateway end; wherein the access request includes a target wildcard domain name;所述网关端用于依据所述目标泛域名和所述泛域名解析规则确定目标第一域名段和目标第二域名段,以及依据所述目标第一域名段和所述第一对应关系确定目标代理地址信息,以及依据所述目标第二域名段和所述第二对应关系确定目标服务地址信息,以及通过所述目标代理地址信息发送所述访问请求和目标服务地址信息至所述代理端;The gateway end is used to determine the target first domain name segment and the target second domain name segment according to the target wildcard domain name and the wildcard domain name resolution rule, and to determine the target proxy address information according to the target first domain name segment and the first corresponding relationship, and to determine the target service address information according to the target second domain name segment and the second corresponding relationship, and to send the access request and the target service address information to the proxy end through the target proxy address information;所述代理端用于通过所述目标服务地址信息发送所述访问请求至所述服务端;The proxy end is used to send the access request to the server end through the target service address information;所述服务端用于依据所述访问请求确定请求结果,以及返回所述请求结果至所述用户端。The server is used to determine a request result according to the access request, and return the request result to the client.10.根据权利要求9所述的系统,其特征在于,所述代理端包括至少两个;所述服务端包括至少两个;所述代理端和所述服务端一一对应;10. The system according to claim 9, characterized in that the agent terminals include at least two; the server terminals include at least two; the agent terminals correspond to the server terminals one by one;所述网关端包括OpenResty服务器,所述代理端包括OpenResty Proxy代理服务器;所述网关端通过IP白名单访问或VPN访问与所述代理端通讯连接。The gateway end includes an OpenResty server, and the proxy end includes an OpenResty Proxy proxy server; the gateway end is connected to the proxy end through IP whitelist access or VPN access.
CN202411180886.2A2024-08-262024-08-26 A multi-level proxy dynamic routing method, device and system based on wildcard domain namePendingCN118764429A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202411180886.2ACN118764429A (en)2024-08-262024-08-26 A multi-level proxy dynamic routing method, device and system based on wildcard domain name

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202411180886.2ACN118764429A (en)2024-08-262024-08-26 A multi-level proxy dynamic routing method, device and system based on wildcard domain name

Publications (1)

Publication NumberPublication Date
CN118764429Atrue CN118764429A (en)2024-10-11

Family

ID=92945838

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202411180886.2APendingCN118764429A (en)2024-08-262024-08-26 A multi-level proxy dynamic routing method, device and system based on wildcard domain name

Country Status (1)

CountryLink
CN (1)CN118764429A (en)

Similar Documents

PublicationPublication DateTitle
US10212173B2 (en)Deterministic reproduction of client/server computer state or output sent to one or more client computers
US20060069774A1 (en)Method and apparatus for managing data center using Web services
US9697379B2 (en)Database virtualization
US11134117B1 (en)Network request intercepting framework for compliance monitoring
US20200210584A1 (en)Deterministic Reproduction of Client/Server Computer State or Output Sent to One or More Client Computers
US6981031B2 (en)Language independent message management for multi-node application systems
CN111240924A (en)Detection method and system for Socket monitoring of Linux virtual machine
US6826591B2 (en)Flexible result data structure and multi-node logging for a multi-node application system
CN112988385A (en)Request processing method, device, system, storage medium and electronic equipment
CN112804366B (en)Method and device for resolving domain name
CN116389599A (en) Gateway service request processing, cloud native gateway system management method and device
CN114301872B (en)Domain name based access method and device, electronic equipment and storage medium
CN115480877A (en)External exposure method and device of application service in multi-cluster environment
CN109068170B (en)Storage method, device, terminal and storage medium for barrage message
CN115987591B (en)Device access method and device, computer readable storage medium and electronic device
CN118764429A (en) A multi-level proxy dynamic routing method, device and system based on wildcard domain name
CN114448703B (en)Request processing method, request processing device, electronic equipment and storage medium
JP2008210214A (en) Information processing apparatus, communication control processing function addition method, and communication control processing function addition program
CN111600944B (en) A data processing method, device, device and storage medium
CN116319002A (en) A single sign-on method, device, gateway device and storage medium
CN115988080A (en)Micro service resource calling method and system based on proxy middleware
CN120711019A (en) Domain name resolution method, device and related equipment
CN116366545A (en) Flow forwarding method, device, electronic device and storage medium
CN114444068A (en)Data access method, device, equipment and medium for third-party application program
CN120639744A (en)Domain name resolution protection method, device, equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp