WO2022134016A1 - 外链改写的处理方法和装置 - Google Patents

外链改写的处理方法和装置 Download PDF

Info

Publication number
WO2022134016A1
WO2022134016A1 PCT/CN2020/139481 CN2020139481W WO2022134016A1 WO 2022134016 A1 WO2022134016 A1 WO 2022134016A1 CN 2020139481 W CN2020139481 W CN 2020139481W WO 2022134016 A1 WO2022134016 A1 WO 2022134016A1
Authority
WO
WIPO (PCT)
Prior art keywords
client
ipv4
protocol stack
page
content
Prior art date
Application number
PCT/CN2020/139481
Other languages
English (en)
French (fr)
Inventor
李矩希
Original Assignee
山石网科通信技术股份有限公司
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 山石网科通信技术股份有限公司 filed Critical 山石网科通信技术股份有限公司
Priority to CN202080003754.6A priority Critical patent/CN112771835B/zh
Priority to PCT/CN2020/139481 priority patent/WO2022134016A1/zh
Priority to US17/437,058 priority patent/US20240015131A1/en
Publication of WO2022134016A1 publication Critical patent/WO2022134016A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/251Translation of Internet protocol [IP] addresses between different IP versions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/301Name conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/659Internet protocol version 6 [IPv6] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/686Types of network addresses using dual-stack hosts, e.g. in Internet protocol version 4 [IPv4]/Internet protocol version 6 [IPv6] networks

Definitions

  • the present application relates to the technical field of network communication, and in particular, to a method and device for processing external link rewriting.
  • a widely used method for the external links on the transformed website is to rewrite the external link content in the webpage through a NAT64 gateway or a similar gateway device.
  • the NAT64 gateway works in both IPv6 and IPv4 dual-stack mode, it proxy requests on IPv6, and use the IPv4 network to send the website pointed to by the real external link, so that IPv6 clients can access other websites that do not provide IPv6.
  • External links to services is to rewrite all external links requested by clients through a NAT64 gateway or a similar gateway device, which causes unnecessary waste to the performance of the NAT64 gateway and affects the performance of the NAT64 gateway.
  • the main purpose of the present application is to provide a method and apparatus for processing external links, so as to solve the problem that the performance of the gateway device is affected due to the gateway device rewriting the external links requested by all clients in the related art.
  • a method for processing external link rewriting includes: responding to an IPv6 access service initiated by a client to obtain the content of the first page; processing the content of the first page to obtain the content of the second page; running an IPv4 detection service on the client according to the content of the second page to determine the IP address of the client Protocol stack information; according to the IP protocol stack information, determine whether to rewrite the external chain of the request initiated by the client.
  • determining whether to perform external chain rewriting on the request initiated by the client according to the IP protocol stack information includes: if the IP protocol stack information is IPv4/IPv6 dual stack, the request initiated by the client is not rewritten on the external chain; if the IP protocol stack The information is an IPv6 single stack, and the external chain rewrites the request initiated by the client.
  • processing the content of the first page to obtain the content of the second page includes: inserting an IPv4 detection script into the content of the first page, and using the content of the first page after inserting the IPv4 detection script as the content of the second page.
  • run the IPv4 detection service on the client according to the content of the second page, and determine that the IP protocol stack information of the client includes: executing an IPv4 detection script on the client, wherein the IPv4 detection script is preset with an IPv4 network service address; The service address initiates an IPv4 detection request, and obtains the IPv4 detection request result; the IP protocol stack information of the client is determined according to the IPv4 detection request result.
  • obtain the IP protocol stack information of the client according to the IPv4 detection request result and include: determine whether the client can establish a connection with the IPv4 network service address according to the IPv4 detection request result; If the client is successfully connected with the IPv4 network service address, determine the IP of the client.
  • the protocol stack information is IPv4/IPv6 dual stack; if the client fails to connect with the IPv4 network service address, determine that the client's IP protocol stack information is IPv6 single stack.
  • the method also includes: if the IP protocol stack information of the client is an IPv6 single stack, the identification of the client is set as the first identification; If the IP protocol stack information of the client is the first identification; For IPv4/IPv6 dual stack, set the identifier of the client as the second identifier.
  • determining whether to perform external chain rewriting to the response of the client request according to the IP protocol stack information includes: identifying the identifier of the client; if the identifier of the client is the second identifier, the request initiated by the client is not rewritten externally; The identifier of the client is the first identifier, and the external link is rewritten for the request initiated by the client.
  • the method is applied to a system comprising a client, a NAT64 gateway and a server, and before responding to the IPv6 access service initiated by the client, the method includes: deploying an IPv4 HTTP service on the NAT64 gateway, so that the NAT64 gateway can Provides IPv4 access services.
  • a processing device for rewriting external links includes: a first obtaining unit, used for responding to an IPv6 access service initiated by a client, to obtain the content of the first page; a second obtaining unit, used for processing the content of the first page to obtain the content of the second page; the first determining The unit is used to run the IPv4 detection service on the client according to the content of the second page, and determine the IP protocol stack information of the client; the second determining unit is used to determine whether to rewrite the external chain of the request initiated by the client according to the IP protocol stack information.
  • the second determination unit also includes: a first judgment module, for if the IP protocol stack information is IPv4/IPv6 dual stack, the request initiated by the client is not rewritten from the external chain; the second judgment module is used for if the IP The protocol stack information is an IPv6 single stack, and the external chain rewrites the request initiated by the client.
  • the second obtaining unit further includes: a first embedding module, configured to insert an IPv4 detection script into the content of the first page, and use the content of the first page after inserting the IPv4 detection script as the content of the second page.
  • a first embedding module configured to insert an IPv4 detection script into the content of the first page, and use the content of the first page after inserting the IPv4 detection script as the content of the second page.
  • the first determination unit further includes: a first execution module, used for executing an IPv4 detection script on the client, wherein the IPv4 detection script is preset with an IPv4 network service address; a first request module is used to provide the IPv4 network service address. The address initiates an IPv4 detection request, and obtains the IPv4 detection request result; the first determination module is configured to determine the IP protocol stack information of the client according to the IPv4 detection request result.
  • a first execution module used for executing an IPv4 detection script on the client, wherein the IPv4 detection script is preset with an IPv4 network service address
  • a first request module is used to provide the IPv4 network service address. The address initiates an IPv4 detection request, and obtains the IPv4 detection request result
  • the first determination module is configured to determine the IP protocol stack information of the client according to the IPv4 detection request result.
  • the first determination module also includes: a first determination submodule, used for determining whether the client can establish a connection with the IPv4 network service address according to the IPv4 detection request result; the first determination submodule is used if the client is connected to the IPv4 network. If the service address connection is successful, it is determined that the IP protocol stack information of the client is IPv4/IPv6 dual stack; the second determining submodule is used to determine that the client IP protocol stack information is IPv6 single stack if the connection between the client and the IPv4 network service address fails.
  • this device also includes: a first setting unit, after obtaining the IP protocol stack information of the client according to the IPv4 detection request result, if the IP protocol stack information of the client is an IPv6 single stack, the identification of the client is set as the first identification;
  • the second setting unit is configured to, after obtaining the IP protocol stack information of the client according to the IPv4 detection request result, if the IP protocol stack information of the client is an IPv4/IPv6 dual stack, set the identifier of the client as the second identifier.
  • the second determining unit also includes: a first identification module, used to identify the identity of the client; a second identification module, used to not rewrite the external chain of the request initiated by the client if the client's identity is the second identity;
  • the third identification module is configured to rewrite the external chain of the request initiated by the client if the identification of the client is the first identification.
  • the device is applied to a system comprising a client, a NAT64 gateway and a server, and the device further includes: a first deployment unit for deploying an IPv4 HTTP service on the NAT64 gateway before responding to the IPv6 access service initiated by the client , so that the NAT64 gateway can provide IPv4 access services to clients.
  • the following steps are adopted: responding to the IPv6 access service initiated by the client to obtain the content of the first page; processing the content of the first page to obtain the content of the second page; running the IPv4 detection service on the client according to the content of the second page, Determine the IP protocol stack information of the client; determine whether to rewrite the external chain of the request initiated by the client according to the IP protocol stack information, which solves the problem that the performance of the gateway device is affected by the gateway device rewriting the external chain of all client requests in the related art. issue of impact.
  • This application determines the IP protocol stack information of the client by running the IPv4 detection service on the client, and then determines whether to rewrite the external chain of the request initiated by the client according to the IP protocol stack information, so that the gateway device can select the external chain requested by the client. Rewriting avoids rewriting external links that do not need to be rewritten, resulting in waste of gateway resources, thereby achieving the effect of improving gateway performance.
  • FIG. 1 is a flowchart of a method for processing external link rewriting provided according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of a processing system for external link rewriting provided according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an application scenario of a processing system rewritten by an external link provided according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a processing device for external link rewriting provided according to an embodiment of the present application.
  • IPv6 Abbreviation for Internet Protocol version 6 (Internet Protocol version 6), which is the next-generation IP protocol designed by the Internet Engineering Task Force (IETF) to replace IPv4.
  • IETF Internet Engineering Task Force
  • NAT64 Gateway A stateful network address and protocol translation technology.
  • External links refer to links that import your own website from other websites.
  • Javascript It is an interpreted scripting language based on object and event-driven and has security performance. It does not need to be compiled and is directly embedded in HTTP pages.
  • a method for processing external link rewriting is provided.
  • FIG. 1 is a flowchart of a processing method for external link rewriting according to an embodiment of the present application. As shown in Figure 1, the method includes the following steps:
  • Step S101 in response to the IPv6 access service initiated by the client, obtain the content of the first page.
  • the server providing network access uses the IPv4 protocol, while the client may use the IPv6 single-stack protocol or IPv4/IPv6 dual-stack protocol.
  • the client needs to pass NAT64 Gateway for network access.
  • the client initiates an access request, and the NAT64 gateway responds to the client's access request, converts the access link corresponding to the IPv6 access service initiated by the client, and sends the converted link to the back-end IPv4 network server , so as to obtain the web page content returned by the server.
  • the client initiates an access to http://www.hillstonenet.com.cn through the IPv6 network
  • the NAT64 gateway responds to the client's request, performs NAT64 translation on the link, and sends the translated link to the back-end IPv4 network server, and Get the page content returned by the backend server.
  • Step S102 Process the content of the first page to obtain the content of the second page.
  • IPv6 single-stack clients may have problems with skylights and external links when accessing the network. For IPv4/IPv6 dual-stack clients, even if the external links do not provide IPv6 services, the client can still use the IPv4 network for access. Therefore, There is no skylight problem that exists with IPv6 single-stack clients.
  • the NAT64 gateway cannot identify whether the client IP protocol stack is an IPv6 single-stack or an IPv4/IPv6 dual-stack, the responses corresponding to a large number of IPv4/IPv6 dual-stack client requests are unnecessarily rewritten, resulting in low efficiency. .
  • the external link rewriting method by obtaining the IP protocol stack information of the client, that is, obtaining whether the client is an IPv6 single-stack network or an IPv4/IPv6 dual-stack network, and on this basis, according to the client IP protocol stack The information determines whether to rewrite the external chain of the request initiated by the client.
  • the NAT64 gateway In order for the NAT64 gateway to obtain the client's IP protocol stack information, that is, to obtain whether the client is an IPv6 single-stack network or an IPv4/IPv6 dual-stack network, after the NAT64 gateway responds to the client's network access request and obtains the content of the first page returned by the server , it is necessary to process the content of the first page to obtain the content of the second page, and obtain the IP protocol stack information of the client through the client running the content of the second page.
  • processing the content of the first page to obtain the content of the second page includes: inserting an IPv4 detection script into the content of the first page, and inserting an IPv4 detection script into the content of the first page.
  • the NAT64 gateway can provide an additional IPv4 HTTP service for the client of the IPv4 network to access, and it is based on this service. Detects whether the client is working on an IPv4 network. In order to obtain the IP protocol stack information of the client, it is necessary to insert an IPv4 detection script into the content of the first page after the NAT64 gateway obtains the first page corresponding to the client's network access request.
  • the IPv4 detection script is provided by the NAT64 gateway.
  • the NAT64 gateway inserts the script into the response content.
  • the script is executed by the client, it does not affect any original logic and display layout of the page.
  • Step S103 Run the IPv4 detection service on the client according to the content of the second page, and determine the IP protocol stack information of the client.
  • the client After receiving the second page returned by the NAT64 gateway, the client loads the content of the second page. Since the second page contains both the normal web page content requested by the client and an IPv4 detection script, the client is working normally. While loading the webpage content, the IPv4 detection script is also executed. The client can determine the IP protocol stack information of the client by executing the IPv4 detection script.
  • running an IPv4 detection service on the client according to the content of the second page, and determining the IP protocol stack information of the client includes: executing an IPv4 detection script on the client, wherein , an IPv4 network service address is preset in the IPv4 detection script; an IPv4 detection request is initiated to the IPv4 network service address, and an IPv4 detection request result is obtained; the IP protocol stack information of the client is determined according to the IPv4 detection request result.
  • the NAT64 gateway responds to the client's request to access the network service, obtains the page content returned by the server, inserts the IPv4 detection script into the page content, and returns the web page content after the IPv4 detection script is inserted to the client.
  • the detection script is used for the client to execute IPv4 detection service, after the client receives the content of the second page, in addition to performing normal page rendering and logic, it will additionally execute an IPv4 detection script.
  • the NAT64 gateway sets the detection service address in the detection script to http://ipv4/ipv4-test.html, where "ipv4" is an IPv4 network address, so that when the client executes the IPv4 detection script, it will try to initiate a pair of The network access request of the address "http://ipv4/ipv4-test.html", and the IP protocol stack information of the client is determined according to the access request result of the address.
  • obtaining the IP protocol stack information of the client according to the IPv4 detection request result includes: determining whether the client can establish a connection with the IPv4 network service address according to the IPv4 detection request result. If the client is successfully connected with the IPv4 network service address, determine that the client's IP protocol stack information is IPv4/IPv6 dual stack; if the client fails to connect with the IPv4 network service address, determine that the client's IP protocol stack information is IPv6 single stack.
  • the client executes the IPv4 detection script and accesses the IPv4 network service address preset in the detection script, it is determined whether the client can establish a connection with the IPv4 network service address according to the result of the access request, and further determines whether the client is an IPv4/ IPv6 dual stack or IPv6 single stack.
  • the access result of the client to the preset IPv4 network service address shows that the connection can be normal, and the NAT64 gateway has any response to the client's access request, it means that the client can access the services of the IPv4 network, and the IP protocol stack information of the client is determined as IPv4/IPv6 dual-stack network; if the access result shows that it cannot be connected to the preset IPv4 network service address, it means that the client cannot access the IPv4 detection service provided by NAT64, and the IP protocol stack information of the client is determined to be IPv6 single-stack .
  • the method further includes: if the IP protocol stack information of the client is an IPv6 single stack, The identifier of the client is set as the first identifier; if the IP protocol stack information of the client is IPv4/IPv6 dual stack, the identifier of the client is set as the second identifier.
  • the NAT64 gateway When the client sends an external link access request through the NAT64 gateway, the NAT64 gateway will determine whether to rewrite the external link accessed by the client according to the client's IP protocol stack information.
  • IPv4/ IPv6 dual stack or IPv6 single stack the client is set with the corresponding identification, if the client is in the IPv4/IPv6 dual stack network, then the identification of the client is set as the second identification, if the client is in the IPv6 single stack network , the client's ID is set as the first ID.
  • the NAT64 gateway can quickly determine whether the client is IPv4/IPv6 dual-stack or IPv6 single-stack according to the client's identifier. For example, when the client is IPv4/IPv6 dual-stack, set the client's Session Cookie to 1 (corresponding to the second identifier above); when the client is IPv6 single-stack, set the client's Session Cookie to 0 (corresponding to the above-mentioned second identifier) the first identification).
  • the session cookie it can be ensured that before the client closes the browser, the client's subsequent access to the website will bring the session cookie, and the NAT64 gateway can quickly determine the client's IP protocol stack information based on the client's session cookie value.
  • Step S104 according to the IP protocol stack information, it is determined whether to perform external link rewriting on the request initiated by the client.
  • determining whether to perform external link rewriting on the request initiated by the client according to IP protocol stack information includes: if the IP protocol stack information is IPv4/IPv6 dual stack, The request initiated by the client will not be rewritten from the external link; if the IP protocol stack information is IPv6 single stack, the request initiated by the client will be rewritten from the external link.
  • IPv6 single-stack clients may have problems with skylights and external links when accessing the network. For IPv4/IPv6 dual-stack clients, even if the external links do not provide IPv6 services, the client can still use the IPv4 network for access. Therefore, There is no skylight problem that exists with IPv6 single-stack clients.
  • the NAT64 gateway cannot identify whether the client IP protocol stack is an IPv6 single-stack or an IPv4/IPv6 dual-stack, the responses corresponding to a large number of IPv4/IPv6 dual-stack client requests are unnecessarily rewritten, resulting in low efficiency. .
  • the external link rewriting method can obtain the IP protocol stack information of the client, that is, whether the client is an IPv6 single-stack network or an IPv4/IPv6 dual-stack network, and on this basis, according to the client IP protocol stack
  • the information determines whether to rewrite the external chain of the request initiated by the client. That is, for the response of the client request in the IPv4/IPv6 dual-stack network, the external chain is not rewritten; for the response of the client request in the IPv6 single-stack network, the external chain is rewritten, so as to avoid a large number of IPv4/IPv6.
  • the response corresponding to the dual-stack client request is unnecessarily rewritten to avoid the waste of gateway resources, so that the gateway device can selectively rewrite the external link requested by the client, so as to improve the performance of the NAT64 gateway.
  • determining whether to perform external link rewriting on the response requested by the client according to the IP protocol stack information includes: identifying the identifier of the client; if the identifier of the client is the second If the identifier of the client is the first identifier, the request initiated by the client will be rewritten from the external chain.
  • the client reflects the IP protocol stack information by setting the cookie as the first identifier or the second identifier.
  • the NAT64 gateway receives the request from the client, it parses the cookie in the request to determine whether the client is in an IPv4/IPv6 dual-stack network. If the client is identified as the second identifier, it means that the client is an IPv4/IPv6 dual-stack network, and the client can access the modified website through IPv6. Even if the external link does not provide IPv6 services, the client can still use IPv4 To access the network, the NAT64 gateway does not need to rewrite the external chain of the request initiated by the client.
  • the identification of the client is identified as the first identification, it means that the client is an IPv6 single-stack network, and the client can only access the modified website through IPv6. If the requested external link does not provide IPv6 services, the client cannot access the website. normal access, therefore, NAT64 rewrites the external chain of the request initiated by the client identified as the first identifier.
  • the method is applied to a system including a client, a NAT64 gateway and a server, and before responding to the IPv6 access service initiated by the client, the method includes:
  • the IPv4 HTTP service is deployed on the NAT64 gateway, so that the NAT64 gateway can provide IPv4 access services to clients.
  • the NAT64 gateway is mainly used to provide IPv6 and IPv4 services to the outside world, and the same external link rewriting is performed for all client accesses, although it satisfies the normal loading of the web page by the client, and solves the problems of IPv6 single-stack client skylight and external links. , but it also unnecessarily rewrites the responses corresponding to a large number of dual-stack client requests, causing unnecessary waste to the performance of the NAT64 gateway and reducing the experience of dual-stack clients.
  • IPv4 HTTP services In order to identify the IP protocol stack type of the client, only provide external link rewriting for IPv4 single-stack clients, and do not provide external link rewriting for IPv4/IPv6 dual-stack clients, it is necessary to deploy IPv4 HTTP services on the NAT64 gateway in advance, so that the client Determines the client's IP stack type by accessing the IPv4-based HTTP service provided on the NAT64 gateway.
  • the NAT64 gateway can obtain the IP protocol stack information of the client, that is, obtain whether the client is an IPv6 single-stack network or an IPv4/IPv6 dual-stack network, and then for the IPv4
  • the response of the client request of the /IPv6 dual-stack network does not rewrite the external chain, which can effectively optimize the performance of the NAT64 gateway and improve the user experience of the dual-stack network client.
  • FIG. 2 is a schematic diagram of an application scenario of a method for rewriting an external link provided according to an embodiment of the present application.
  • a client first initiates a network access request through an IPv6 network, for example, the external link that initiates the request is “http://www .hillstonenet.com.cn”, because the NAT64 gateway cannot determine the IP protocol stack type of the client, it performs NAT64 conversion on the external link and sends it to the back-end network server. Insert the IPv4 detection script in the IPv4 detection script, and return the webpage content after the IPv4 detection script is inserted to the client.
  • the NAT64 gateway can set the detection service in the IPv4 detection script to http://ipv4/ipv4-test.html, where " ipv4" is an IPv4 network address.
  • the client receives the response, in addition to executing normal page rendering and logic, it additionally executes the IPv4 detection script.
  • the client attempts to initiate a link to "http://ipv4/ipv4-test.html" If the access request is unreachable, it means that the client is an IPv6 single-stack network and cannot access the IPv4 detection service provided by NAT64; if the connection can be established normally, it means that the client is an IPv4/IPv6 dual-stack network.
  • the IPv4 detection service provided by NAT64 can be accessed.
  • the client sets the corresponding identifier according to the detection result, and NAT64 determines the client's IP protocol stack information according to the identifier.
  • the NAT64 gateway does not rewrite any external links, while for IPv6 single-stack network clients, the NAT64 gateway Corresponding external links need to be rewritten.
  • FIG. 3 is a schematic diagram of an application scenario of a processing method for external link rewriting provided according to an embodiment of the present application
  • a client makes a network access request through a NAT64 gateway
  • the NAT64 gateway identifies the IP protocol stack information of each client through an identification value in the client access request , so that only the external chain rewriting is performed on the IPv6 single-stack network client (which can only access the IPv6 external chain), and the external chain rewriting is not performed on the IPv4/IPv6 dual-stack network client.
  • the scheme provided by the present invention can reduce unnecessary external links.
  • the chain rewrite operation effectively optimizes the performance of the NAT64 gateway and improves the user experience of the dual-stack network client.
  • the method for processing external link rewriting obtains the content of the first page by responding to the IPv6 access service initiated by the client; processes the content of the first page to obtain the content of the second page;
  • the content runs the IPv4 detection service on the client to determine the IP protocol stack information of the client; according to the IP protocol stack information, it is determined whether to rewrite the external chain of the request initiated by the client.
  • This application solves the problem in the related art that the performance of the gateway device is affected because the gateway device rewrites all the external links requested by the client, so that the NAT64 gateway device selectively rewrites the external links requested by the client to avoid It solves the problem of waste of gateway resources by rewriting the external links that do not need to be rewritten, thereby achieving the effect of improving the performance of the gateway.
  • An embodiment of the present application further provides a processing device for rewriting an external link. It should be noted that the processing device for rewriting an external link in the embodiment of the present application may be used to execute the processing for rewriting an external link provided by the embodiment of the present application. method. The following describes the processing device for external link rewriting provided by the embodiments of the present application.
  • FIG. 4 is a schematic diagram of a processing device for external link rewriting according to an embodiment of the present application.
  • the apparatus includes: a first obtaining unit 401 , a second obtaining unit 402 , a first determining unit 403 , and a second determining unit 404 .
  • the first obtaining unit 401 is configured to obtain the first page content in response to the IPv6 access service initiated by the client;
  • the second obtaining unit 402 is configured to process the content of the first page to obtain the content of the second page;
  • the first determining unit 403 is configured to run the IPv4 detection service on the client according to the content of the second page, and determine the IP protocol stack information of the client;
  • the second determining unit 404 is configured to determine, according to the IP protocol stack information, whether to perform external link rewriting on the request initiated by the client.
  • the processing device for external link rewriting obtained by the embodiment of the present application obtains the content of the first page by responding to the IPv6 access service initiated by the client through the first obtaining unit 401; the second obtaining unit 402 processes the content of the first page, Obtain the second page content; the first determining unit 403 runs the IPv4 detection service on the client according to the second page content, and determines the IP protocol stack information of the client; the second determining unit 404 determines whether to initiate a request to the client according to the IP protocol stack information Rewrite external links.
  • the problem in the related art that the performance of the gateway device is affected due to the gateway device rewriting the external links requested by all clients is solved.
  • This application determines the IP protocol stack information of the client by running the IPv4 detection service on the client, and then determines whether to rewrite the external chain of the request initiated by the client according to the IP protocol stack information, so that the gateway device can select the external chain requested by the client. Rewriting avoids rewriting external links that do not need to be rewritten, resulting in waste of gateway resources, thereby achieving the effect of improving gateway performance.
  • the second determining unit 404 further includes: a first determining module, configured to initiate a request to the client if the IP protocol stack information is an IPv4/IPv6 dual stack.
  • the second judgment module is used to rewrite the external chain of the request initiated by the client if the IP protocol stack information is IPv6 single stack.
  • the second obtaining unit 402 further includes: a first embedding module, configured to insert an IPv4 detection script into the content of the first page, and insert the IPv4 detection script.
  • the first determining unit 403 further includes: a first execution module, configured to execute an IPv4 detection script on the client, wherein the IPv4 detection script is preset.
  • a first execution module configured to execute an IPv4 detection script on the client, wherein the IPv4 detection script is preset.
  • a first request module is used to initiate an IPv4 detection request to the IPv4 network service address to obtain an IPv4 detection request result;
  • a first determination module is used to determine the client's IP protocol stack information according to the IPv4 detection request result.
  • the first determination module further includes: a first determination submodule, configured to determine whether the client and the IPv4 network service address can be established according to the IPv4 detection request result. Connect; The first to determine the submodule, for if the client and the IPv4 network service address are connected successfully, determine that the IP protocol stack information of the client is IPv4/IPv6 dual stack; The second determines the submodule, for if the client and the IPv4 network service The address connection fails, and the IP protocol stack information of the client is determined to be IPv6 single stack.
  • the device further includes: a first setting unit, configured to obtain the client's IP protocol stack information according to the IPv4 detection request result, if the client's IP protocol The stack information is an IPv6 single stack, and the identification of the client is set as the first identification; the second setting unit is used to obtain the IP protocol stack information of the client according to the IPv4 detection request result, if the IP protocol stack information of the client is IPv4/IPv6 dual stack , and set the identifier of the client as the second identifier.
  • a first setting unit configured to obtain the client's IP protocol stack information according to the IPv4 detection request result, if the client's IP protocol The stack information is an IPv6 single stack, and the identification of the client is set as the first identification
  • the second setting unit is used to obtain the IP protocol stack information of the client according to the IPv4 detection request result, if the IP protocol stack information of the client is IPv4/IPv6 dual stack , and set the identifier of the client as the second identifier.
  • the second determining unit 404 further includes: a first identification module, used for identifying the identifier of the client; is the second identifier, and does not perform external link rewriting on the request initiated by the client; the third identification module is used for rewriting the external link on the request initiated by the client if the client's identifier is the first identifier.
  • the device is applied to a system including a client, a NAT64 gateway, and a server, and the device further includes: a first deployment unit, configured to respond to the client Before initiating the IPv6 access service, deploy the IPv4 HTTP service on the NAT64 gateway, so that the NAT64 gateway can provide the client with the IPv4 access service.
  • a first deployment unit configured to respond to the client Before initiating the IPv6 access service, deploy the IPv4 HTTP service on the NAT64 gateway, so that the NAT64 gateway can provide the client with the IPv4 access service.
  • the processing device for external link rewriting includes a processor and a memory.
  • the above-mentioned first acquisition unit 401, second acquisition unit 402, first determination unit 403, second determination unit 404, etc. are all stored in the memory as program units, and are stored in the memory by the processor.
  • the above-mentioned program elements stored in the memory are executed to realize the corresponding functions.
  • the processor includes a kernel, and the kernel calls the corresponding program unit from the memory.
  • the kernel can set one or more, and the external link rewriting can be processed by adjusting the kernel parameters.
  • Memory may include non-persistent memory in computer readable media, random access memory (RAM) and/or non-volatile memory, such as read only memory (ROM) or flash memory (flash RAM), the memory including at least one memory chip.
  • RAM random access memory
  • ROM read only memory
  • flash RAM flash memory
  • An embodiment of the present invention provides a storage medium on which a program is stored, and when the program is executed by a processor, a processing method for rewriting an external link is implemented.
  • An embodiment of the present invention provides a processor, where the processor is used to run a program, wherein a processing method for rewriting an external link is performed when the program is running.
  • An embodiment of the present invention provides a device.
  • the device includes a processor, a memory, and a program stored in the memory and running on the processor.
  • the processor executes the program, the following steps are implemented: responding to an IPv6 access service initiated by a client, obtaining The content of the first page; the content of the first page is processed to obtain the content of the second page; the IPv4 detection service is run on the client according to the content of the second page, and the IP protocol stack information of the client is determined; The request initiated is rewritten by the external chain.
  • the processor executes the program, the following steps are also implemented: if the IP protocol stack information is IPv4/IPv6 dual stack, the request initiated by the client is not rewritten on the external chain; if the IP protocol stack information is IPv6 single stack, the request initiated by the client is Rewrite the external link.
  • the processor When executing the program, the processor further implements the following steps: inserting an IPv4 detection script into the content of the first page, and using the content of the first page after inserting the IPv4 detection script as the content of the second page.
  • the client executes an IPv4 detection script, wherein the IPv4 detection script is pre-arranged with an IPv4 network service address; Initiate an IPv4 detection request to the IPv4 network service address, obtain an IPv4 detection request result; According to IPv4 The probe request result determines the client's IP protocol stack information.
  • the processor executes the program, the following steps are also implemented: determine whether the client can establish a connection with the IPv4 network service address according to the IPv4 detection request result; if the client is successfully connected with the IPv4 network service address, determine that the IP protocol stack information of the client is IPv4/IPv6 Dual stack; if the client fails to connect with the IPv4 network service address, determine that the client's IP protocol stack information is IPv6 single stack.
  • the processor executes the program, the following steps are also realized: if the IP protocol stack information of the client is an IPv6 single stack, the identification of the client is set as the first identification; if the IP protocol stack information of the client is IPv4/IPv6 dual stack, the identification of the client is set as Second logo.
  • the processor executes the program, the following steps are also implemented: identifying the identifier of the client; if the identifier of the client is the second identifier, the request initiated by the client is not rewritten from the external chain; if the identifier of the client is the first identifier, the request initiated by the client is Request for external link rewriting.
  • the processor also implements the following steps when executing the program: deploying the IPv4 HTTP service on the NAT64 gateway, so that the NAT64 gateway can provide the client with the IPv4 access service.
  • the devices in this article can be servers, PCs, PADs, mobile phones, and so on.
  • the present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: obtaining the content of the first page in response to the IPv6 access service initiated by the client; The content is processed to obtain the content of the second page; the IPv4 detection service is run on the client according to the content of the second page, and the IP protocol stack information of the client is determined; according to the IP protocol stack information, it is determined whether to rewrite the external link for the request initiated by the client.
  • IP protocol stack information is IPv4/IPv6 dual stack
  • the request initiated by the client will not be rewritten on the external link
  • IP protocol stack information For the IPv6 single stack it rewrites the external chain of the request initiated by the client.
  • IPv4 detection script When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: executing an IPv4 detection script on the client, wherein the IPv4 detection script is preset with an IPv4 network service address; initiate IPv4 to the IPv4 network service address Probe request, obtain the IPv4 probe request result; determine the client's IP protocol stack information according to the IPv4 probe request result.
  • determining whether the client can establish a connection with the IPv4 network service address according to the IPv4 detection request result if the client is successfully connected with the IPv4 network service address, Determine that the client's IP protocol stack information is IPv4/IPv6 dual stack; if the client fails to connect with the IPv4 network service address, determine that the client's IP protocol stack information is IPv6 single stack.
  • IP protocol stack information of the client When executed on the data processing equipment, it is also suitable for executing a program with the following method steps for initialization: if the IP protocol stack information of the client is an IPv6 single stack, the identification of the client is set as the first identification; if the IP protocol stack information of the client is IPv4/IPv6 dual stack, set the client's identity as the second identity.
  • identifying the identity of the client When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: identifying the identity of the client; if the identity of the client is the second identity, the request initiated by the client will not be rewritten; The identifier is the first identifier, and the request initiated by the client is rewritten on the external chain.
  • the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions
  • the apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-persistent memory in computer readable media, random access memory (RAM) and/or non-volatile memory in the form of, for example, read only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
  • RAM random access memory
  • ROM read only memory
  • flash RAM flash memory
  • Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology.
  • Information may be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
  • the embodiments of the present application may be provided as a method, a system or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请公开了一种外链改写的处理方法和装置。该方法包括:响应客户端发起的IPv6访问服务,得到第一页面内容;对第一页面内容进行处理,得到第二页面内容;根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。通过本申请,解决了相关技术中由于网关设备对所有客户端请求的外链进行改写,导致网关设备性能受到影响的问题。

Description

外链改写的处理方法和装置 技术领域
本申请涉及网络通信技术领域,具体而言,涉及一种外链改写的处理方法和装置。
背景技术
在网站的IPv6改造过程中,针对被改造网站上的外链,一种被广泛使用的做法是通过NAT64网关或者类似网关设备来改写网页中的外链内容。将需要做改写的外链改写为NAT64网关或者类似设备所服务的域名或者IPv6地址,进而将对外链的访问引流到NAT64网关上。由于NAT64网关同时工作在IPv6和IPv4双栈模式,其将IPv6上的请求进行代理,使用IPv4网络发送真正的外链所指向的网站,进而达到IPv6客户端能够访问该网站上的其它不提供IPv6服务的外链。当前的实现方式为通过NAT64网关或者类似网关设备对所有客户端请求的外链进行改写,对NAT64网关的性能造成不必要的浪费,影响NAT64网关的性能。
针对相关技术中对网关设备对所有客户端请求的外链进行改写,影响网关设备的性能的问题,目前尚未提出有效的解决方案。
发明内容
本申请的主要目的在于提供一种外链改写的处理方法和装置,以解决相关技术中由于网关设备对所有客户端请求的外链进行改写,导致网关设备性能受到影响的问题。
为了实现上述目的,根据本申请的一个方面,提供了一种外链改写的处理方法。该方法包括:响应客户端发起的IPv6访问服务,得到第一页面内容;对第一页面内容进行处理,得到第二页面内容;根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。
进一步地,根据IP协议栈信息确定是否对客户端发起的请求进行外链改写包括:若IP协议栈信息为IPv4/IPv6双栈,对客户端发起的请求不进行外链改写;若IP协议栈信息为IPv6单栈,对客户端发起的请求进行外链改写。
进一步地,对第一页面内容进行处理,得到第二页面内容包括:在第一页面内容中插入IPv4探测脚本,将插入IPv4探测脚本后的第一页面内容作为第二页面内容。
进一步地,根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协 议栈信息包括:在客户端执行IPv4探测脚本,其中,IPv4探测脚本中预先设置有IPv4网络服务地址;向IPv4网络服务地址发起IPv4探测请求,得到IPv4探测请求结果;根据IPv4探测请求结果确定客户端的IP协议栈信息。
进一步地,根据IPv4探测请求结果得到客户端的IP协议栈信息包括:根据IPv4探测请求结果确定客户端与IPv4网络服务地址是否能建立连接;若客户端与IPv4网络服务地址连接成功,确定客户端的IP协议栈信息为IPv4/IPv6双栈;若客户端与IPv4网络服务地址连接失败,确定客户端的IP协议栈信息为IPv6单栈。
进一步地,根据IPv4探测请求结果得到客户端的IP协议栈信息之后,该方法还包括:若客户端的IP协议栈信息为IPv6单栈,设置客户端的标识为第一标识;若客户端的IP协议栈信息为IPv4/IPv6双栈,设置客户端的标识为第二标识。
进一步地,根据IP协议栈信息确定是否对客户端请求的响应进行外链改写包括:识别客户端的标识;若客户端的标识为第二标识,对客户端发起的请求不进行外链改写;若客户端的标识为第一标识,对客户端发起的请求进行外链改写。
进一步地,该方法应用于包括客户端、NAT64网关和服务器的系统,在响应客户端发起的IPv6访问服务之前,该方法包括:在NAT64网关上部署IPv4的HTTP服务,使得NAT64网关能够对客户端提供IPv4访问服务。
为了实现上述目的,根据本申请的另一方面,提供了一种外链改写的处理装置。该装置包括:第一获取单元,用于响应客户端发起的IPv6访问服务,得到第一页面内容;第二获取单元,用于对第一页面内容进行处理,得到第二页面内容;第一确定单元,用于根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;第二确定单元,用于根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。
进一步地,第二确定单元还包括:第一判断模块,用于若IP协议栈信息为IPv4/IPv6双栈,对客户端发起的请求不进行外链改写;第二判断模块,用于若IP协议栈信息为IPv6单栈,对客户端发起的请求进行外链改写。
进一步地,第二获取单元还包括:第一嵌入模块,用于在第一页面内容中插入IPv4探测脚本,将插入IPv4探测脚本后的第一页面内容作为第二页面内容。
进一步地,第一确定单元还包括:第一执行模块,用于在客户端执行IPv4探测脚本,其中,IPv4探测脚本中预先设置有IPv4网络服务地址;第一请求模块,用于向IPv4网络服务地址发起IPv4探测请求,得到IPv4探测请求结果;第一确定模块,用于根据IPv4探测请求结果确定客户端的IP协议栈信息。
进一步地,第一确定模块还包括:第一判断子模块,用于根据IPv4探测请求结果确定客户端与IPv4网络服务地址是否能建立连接;第一确定子模块,用于若客户端与IPv4网络服务地址连接成功,确定客户端的IP协议栈信息为IPv4/IPv6双栈;第二确定子模块,用于若客户端与IPv4网络服务地址连接失败,确定客户端的IP协议栈信息为IPv6单栈。
进一步地,该装置还包括:第一设置单元,用于根据IPv4探测请求结果得到客户端的IP协议栈信息之后,若客户端的IP协议栈信息为IPv6单栈,设置客户端的标识为第一标识;第二设置单元,用于根据IPv4探测请求结果得到客户端的IP协议栈信息之后,若客户端的IP协议栈信息为IPv4/IPv6双栈,设置客户端的标识为第二标识。
进一步地,第二确定单元还包括:第一识别模块,用于识别客户端的标识;第二识别模块,用于若客户端的标识为第二标识,对客户端发起的请求不进行外链改写;第三识别模块,用于若客户端的标识为第一标识,对客户端发起的请求进行外链改写。
进一步地,该装置应用于包括客户端、NAT64网关和服务器的系统,该装置还包括:第一部署单元,用于在响应客户端发起的IPv6访问服务之前,在NAT64网关上部署IPv4的HTTP服务,使得NAT64网关能够对客户端提供IPv4访问服务。
通过本申请,采用以下步骤:响应客户端发起的IPv6访问服务,得到第一页面内容;对第一页面内容进行处理,得到第二页面内容;根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;根据IP协议栈信息确定是否对客户端发起的请求进行外链改写,解决了相关技术中由于网关设备对所有客户端请求的外链进行改写,导致网关设备性能受到影响的问题。本申请通过在客户端运行IPv4探测服务确定客户端的IP协议栈信息,然后依据IP协议栈信息确定是否对客户端发起的请求进行外链改写,使得网关设备对客户端请求的外链进行选择性改写,避免了对不需要改写的外链进行改写,造成网关资源的浪费,进而达到了提高网关性能的效果。
附图说明
构成本申请的一部分的附图用来提供对本申请的进一步理解,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1是根据本申请实施例提供的外链改写的处理方法的流程图;
图2是根据本申请实施例提供的外链改写的处理系统的示意图;
图3是根据本申请实施例提供的外链改写的处理系统应用场景的示意图;以及
图4是根据本申请实施例提供的外链改写的处理装置的示意图。
具体实施方式
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
为了便于描述,以下对本申请实施例涉及的部分名词或术语进行说明:
IPv6:Internet Protocol version 6(互联网协议第6版)的缩写,是互联网工程任务组(IETF)设计的用于替代IPv4的下一代IP协议。
NAT64网关:一种有状态的网络地址与协议转换技术。
外链:外链就是指在别的网站导入自己网站的链接。
HTTP:请求-响应协议。
Javascript:是一种基于对象和事件驱动并具有安全性能的解释型脚本语言,不需要编译,直接嵌入到HTTP页面中。
根据本申请的实施例,提供了一种外链改写的处理方法。
图1是根据本申请实施例的外链改写的处理方法的流程图。如图1所示,该方法包括以下步骤:
步骤S101,响应客户端发起的IPv6访问服务,得到第一页面内容。
在一些应用场景中,提供网络访问的服务器使用IPv4协议,而客户端可能使用IPv6单栈协议或IPv4/IPv6双栈协议,为了给所有客户端都提供正常的网络访问服务, 需要客户端通过NAT64网关进行网络访问。当需要进行网络访问时,客户端发起访问请求,NAT64网关响应客户端的访问请求,对客户端发起的IPv6访问服务对应的访问链接进行转换,并将转换后的链接发送给后端的IPv4网络的服务器,从而获取到服务器返回的网页内容。例如,客户端通过IPv6网络发起http://www.hillstonenet.com.cn的访问,NAT64网关响应客户端的请求,对链接进行NAT64转换,将转换后的链接发送至后端的IPv4网络的服务器,并获取到后端服务器返回的页面内容。
步骤S102,对第一页面内容进行处理,得到第二页面内容。
IPv6单栈客户端在进行网络访问时可能会出现天窗、外链问题,而对于IPv4/IPv6双栈客户端,即使其中的外链不提供IPv6服务,客户端仍然可以使用IPv4网络进行访问,因此不存在IPv6单栈客户端所存在的天窗问题。然而现有技术中由于NAT64网关无法辨识客户端IP协议栈是IPv6单栈还是IPv4/IPv6双栈,对大量的IPv4/IPv6双栈客户端请求对应的响应进行了不必要的改写,导致效率低。因此本申请实施例提供的外链改写方法,通过获取客户端的IP协议栈信息,即获取客户端是IPv6单栈网络还是IPv4/IPv6双栈网络,并在此基础上,根据客户端IP协议栈信息确定是否对客户端发起的请求进行外链改写。为了让NAT64网关能够获取客户端的IP协议栈信息,即获取客户端是IPv6单栈网络还是IPv4/IPv6双栈网络,在NAT64网关响应客户端的网络访问请求并获取到服务器返回的第一页面内容后,需要对第一页面内容进行处理,得到第二页面内容,并通过客户端运行第二页面内容获取到客户端的IP协议栈信息。
可选地,在本申请实施例提供的外链改写的处理方法中,对第一页面内容进行处理,得到第二页面内容包括:在第一页面内容中插入IPv4探测脚本,将插入IPv4探测脚本后的第一页面内容作为第二页面内容。
相对于现有技术中的NAT64网关,本申请实施例提供的外链改写的方法中,需要NAT64网关能够提供额外的IPv4的HTTP服务,供IPv4网络的客户端进行访问,正是基于这个服务来探测客户端是否工作在IPv4网络。为了获取客户端的IP协议栈信息,需要在NAT64网关获取到客户端网络访问请求对应的第一页面之后,在第一页面内容中插入IPv4探测脚本。该IPv4探测脚本由NAT64网关提供,当客户端通过IPv6服务请求页面时,NAT64网关将该脚本插入到响应内容中,该脚本在客户端执行时,不影响页面的任何原有逻辑以及显示布局。
步骤S103,根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息。
客户端在接收到NAT64网关返回的第二页面后,对第二页面的内容进行加载,由于第二页面中既包含客户端请求的正常网页内容,还插入了IPv4探测脚本,因此客户 端在正常加载网页内容的同时,也执行了IPv4探测脚本,客户端通过执行IPv4探测脚本,可以确定客户端的IP协议栈信息。
可选地,在本申请实施例提供的外链改写的处理方法中,根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息包括:在客户端执行IPv4探测脚本,其中,IPv4探测脚本中预先设置有IPv4网络服务地址;向IPv4网络服务地址发起IPv4探测请求,得到IPv4探测请求结果;根据IPv4探测请求结果确定客户端的IP协议栈信息。
NAT64网关响应客户端访问网络服务的请求,得到服务器返回的页面内容,在页面内容中插入IPv4探测脚本,并将插入IPv4探测脚本后的网页内容返回给客户端,该探测脚本用于客户端执行IPv4探测服务,客户端在收到第二页面内容后,除了执行正常的页面渲染和逻辑之外,还将额外地执行IPv4探测脚本。例如,NAT64网关在探测脚本中将探测服务地址设置为http://ipv4/ipv4-test.html,其中“ipv4”为一个IPv4网络地址,这样客户端在执行IPv4探测脚本时,将尝试发起对地址“http://ipv4/ipv4-test.html”的网络访问请求,并根据对该地址的访问请求结果确定客户端的IP协议栈信息。
可选地,在本申请实施例提供的外链改写的处理方法中,根据IPv4探测请求结果得到客户端的IP协议栈信息包括:根据IPv4探测请求结果确定客户端与IPv4网络服务地址是否能建立连接;若客户端与IPv4网络服务地址连接成功,确定客户端的IP协议栈信息为IPv4/IPv6双栈;若客户端与IPv4网络服务地址连接失败,确定客户端的IP协议栈信息为IPv6单栈。
在客户端执行IPv4探测脚本,对探测脚本中预设的IPv4网络服务地址进行访问时,根据访问请求的结果确定客户端与该IPv4网络服务地址是否能建立连接,并进一步确定客户端是IPv4/IPv6双栈还是IPv6单栈。如果客户端对预设IPv4网络服务地址的访问结果显示能够正常连接,NAT64网关对客户端的访问请求有任何响应,说明该客户端可以访问IPv4网络的服务,则确定该客户端的IP协议栈信息为IPv4/IPv6双栈网络;如果访问结果显示无法与预设的IPv4网络服务地址连接,则说明该客户端不可以访问NAT64提供的IPv4探测服务,则确定该客户端的IP协议栈信息为IPv6单栈。
可选地,在本申请实施例提供的外链改写的处理方法中,根据IPv4探测请求结果得到客户端的IP协议栈信息之后,该方法还包括:若客户端的IP协议栈信息为IPv6单栈,设置客户端的标识为第一标识;若客户端的IP协议栈信息为IPv4/IPv6双栈,设置客户端的标识为第二标识。
在客户端通过NAT64网关发出外链访问请求时,NAT64网关将根据客户端的IP 协议栈信息确定是否对客户端访问的外链进行改写,为了让NAT64网关准确判断客户端的IP协议栈信息(IPv4/IPv6双栈或IPv6单栈),在本申请中对客户端设置对应的标识,如果客户端处于IPv4/IPv6双栈网络,则设置客户端的标识为第二标识,如果客户端处于IPv6单栈网络,则设置客户端的标识为第一标识。这样客户端在通过NAT64网关发起外链访问请求时,NAT64网关就可以根据客户端的标识快速判断客户端是IPv4/IPv6双栈还是IPv6单栈。例如,当客户端为IPv4/IPv6双栈时,将客户端的Session Cookie设置为1(对应上述的第二标识);当客户端为IPv6单栈时,将客户端的Session Cookie设置为0(对应上述的第一标识)。通过设置Session Cookie可以确保在客户端关闭浏览器之前,该客户端到网站的后续访问都会带上该Session Cookie,NAT64网关就可以根据客户端的Session Cookie值快速的确定出客户端的IP协议栈信息。
步骤S104,根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。
可选地,在本申请实施例提供的外链改写的处理方法中,根据IP协议栈信息确定是否对客户端发起的请求进行外链改写包括:若IP协议栈信息为IPv4/IPv6双栈,对客户端发起的请求不进行外链改写;若IP协议栈信息为IPv6单栈,对客户端发起的请求进行外链改写。
IPv6单栈客户端在进行网络访问时可能会出现天窗、外链问题,而对于IPv4/IPv6双栈客户端,即使其中的外链不提供IPv6服务,客户端仍然可以使用IPv4网络进行访问,因此不存在IPv6单栈客户端所存在的天窗问题。然而现有技术中由于NAT64网关无法辨识客户端IP协议栈是IPv6单栈还是IPv4/IPv6双栈,对大量的IPv4/IPv6双栈客户端请求对应的响应进行了不必要的改写,导致效率低。因此本申请实施例提供的外链改写方法,能够获取客户端的IP协议栈信息,即获取客户端是IPv6单栈网络还是IPv4/IPv6双栈网络,并在此基础上,根据客户端IP协议栈信息确定是否对客户端发起的请求进行外链改写。也即,对于处于IPv4/IPv6双栈网络的客户端请求的响应,不进行外链改写;对于处于IPv6单栈网络的客户端请求的响应,进行外链改写,从而避免对大量的IPv4/IPv6双栈客户端请求对应的响应进行了不必要的改写,避免网关资源的浪费,进而使得网关设备对客户端请求的外链进行选择性改写,达到提高NAT64网关的性能的效果。
可选地,在本申请实施例提供的外链改写的处理方法中,根据IP协议栈信息确定是否对客户端请求的响应进行外链改写包括:识别客户端的标识;若客户端的标识为第二标识,对客户端发起的请求不进行外链改写;若客户端的标识为第一标识,对客户端发起的请求进行外链改写。
客户端通过设置Cookie为第一标识或第二标识来反映IP协议栈信息,当NAT64网关收到来自客户端的请求后,解析请求中的Cookie,来判断客户端是否处于 IPv4/IPv6双栈网络。如果识别到客户端为第二标识,说明客户端为IPv4/IPv6双栈网络,客户端可以通过IPv6访问被改造的网站,即便是其中的外链不提供IPv6的服务,客户端仍然可以使用IPv4网络进行访问,NAT64网关不需要对客户端发起的请求进行外链改写。如果识别到客户端的标识为第一标识,说明客户端为IPv6单栈网络,客户端只能通过IPv6对被改造的网站进行访问,如果请求的外链不提供IPv6服务,客户端就无法对网站进行正常访问,因此,NAT64对识别为第一标识的客户端发起的请求进行外链改写。
可选地,在本申请实施例提供的外链改写的处理方法中,该方法应用于包括客户端、NAT64网关和服务器的系统,在响应客户端发起的IPv6访问服务之前,该方法包括:在NAT64网关上部署IPv4的HTTP服务,使得NAT64网关能够对客户端提供IPv4访问服务。
通常NAT64网关主要用于对外提供IPv6和IPv4的服务,针对所有客户端的访问进行同样的外链改写,虽然满足了客户端对网页的正常加载,解决了IPv6单栈客户端天窗、外链等问题,但也对大量双栈客户端请求对应的响应进行了不必要的改写,对NAT64网关的性能造成不必要的浪费,并降低双栈客户端的体验。为了识别客户端的IP协议栈类型,只对IPv4单栈客户端提供外链改写,对IPv4/IPv6双栈客户端不提供外链改写,需要预先在NAT64网关上部署IPv4的HTTP服务,使得客户端通过对NAT64网关上提供的基于IPv4的HTTP服务的访问确定客户端的IP协议栈类型。
因此,通过本申请实施例提供的外链改写的处理方法,能够让NAT64网关获取客户端的IP协议栈信息,也即获取客户端是IPv6单栈网络还是IPv4/IPv6双栈网络,进而对于处于IPv4/IPv6双栈网络的客户端请求的响应,不进行外链改写,这样可以有效优化NAT64网关的性能,提高双栈网络客户端的使用体验。
图2是根据本申请实施例提供的外链改写处理方法的应用场景示意图,如图2所示,客户端首先通过IPv6网络发起网络访问请求,例如发起请求的外链为“http://www.hillstonenet.com.cn”,NAT64网关由于无法判断客户端的IP协议栈类型,对该外链进行NAT64转换,送给后端网络服务器,后端服务器返回响应,NAT64网关在后端返回的网页内容中插入IPv4探测脚本,并将插入IPv4探测脚本后的网页内容返回给客户端,例如,NAT64网关可以在IPv4探测脚本中将探测服务设置为http://ipv4/ipv4-test.html,其中“ipv4”为一个IPv4网络地址。客户端收到响应之后,除了执行正常的页面渲染和逻辑之外,额外地执行IPv4探测脚本,在执行该探测脚本时客户端尝试发起对链接“http://ipv4/ipv4-test.html”的访问请求,如果访问请求不可达,则说明该客户端为IPv6单栈网络,不可以访问NAT64提供的IPv4探测服务;如果能够正常建立连接,则说明该客户端为IPv4/IPv6双栈网络,可以访问NAT64提供 的IPv4探测服务。客户端根据探测结果设置相应的标识,NAT64根据标识确定客户端的IP协议栈信息,对于IPv4/IPv6双栈网络客户端,NAT64网关不作任何外链改写,而对于IPv6单栈网络客户端,NAT64网关需要作相应的外链改写。
图3是根据本申请实施例提供的外链改写的处理方法应用场景的示意图,客户端通过NAT64网关进行网络访问请求,NAT64网关通过客户端访问请求中的标识值识别各客户端的IP协议栈信息,从而只对IPv6单栈网络客户端(只能访问IPv6外链)进行外链改写,对IPv4/IPv6双栈网络客户端不进行外链改写,使用本发明提供的方案可以减少不必要的外链改写操作,有效优化NAT64网关的性能,提高双栈网络客户端的使用体验。
综上,本申请实施例提供的外链改写的处理方法,通过响应客户端发起的IPv6访问服务,得到第一页面内容;对第一页面内容进行处理,得到第二页面内容;根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。通过本申请,解决了相关技术中由于网关设备对所有客户端请求的外链进行改写,导致网关设备性能受到影响的问题,使得NAT64网关设备对客户端请求的外链选择性地进行改写,避免了对不需要改写的外链进行改写从而造成网关资源的浪费的问题,进而达到了提高网关性能的效果。
需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
本申请实施例还提供了一种外链改写的处理装置,需要说明的是,本申请实施例的外链改写的处理装置可以用于执行本申请实施例所提供的用于外链改写的处理方法。以下对本申请实施例提供的外链改写的处理装置进行介绍。
图4是根据本申请实施例的外链改写的处理装置的示意图。如图4所示,该装置包括:第一获取单元401、第二获取单元402、第一确定单元403、第二确定单元404。
具体的,第一获取单元401,用于响应客户端发起的IPv6访问服务,得到第一页面内容;
第二获取单元402,用于对第一页面内容进行处理,得到第二页面内容;
第一确定单元403,用于根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;
第二确定单元404,用于根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。
综上,本申请实施例提供的外链改写的处理装置,通过第一获取单元401响应客户端发起的IPv6访问服务,得到第一页面内容;第二获取单元402对第一页面内容进行处理,得到第二页面内容;第一确定单元403根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;第二确定单元404根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。解决了相关技术中由于网关设备对所有客户端请求的外链进行改写,导致网关设备性能受到影响的问题。本申请通过在客户端运行IPv4探测服务确定客户端的IP协议栈信息,然后依据IP协议栈信息确定是否对客户端发起的请求进行外链改写,使得网关设备对客户端请求的外链进行选择性改写,避免了对不需要改写的外链进行改写,造成网关资源的浪费,进而达到了提高网关性能的效果。
可选地,在本申请实施例提供的外链改写的处理装置中,第二确定单元404还包括:第一判断模块,用于若IP协议栈信息为IPv4/IPv6双栈,对客户端发起的请求不进行外链改写;第二判断模块,用于若IP协议栈信息为IPv6单栈,对客户端发起的请求进行外链改写。
可选地,在本申请实施例提供的外链改写的处理装置中,第二获取单元402还包括:第一嵌入模块,用于在第一页面内容中插入IPv4探测脚本,将插入IPv4探测脚本后的第一页面内容作为第二页面内容。
可选地,在本申请实施例提供的外链改写的处理装置中,第一确定单元403还包括:第一执行模块,用于在客户端执行IPv4探测脚本,其中,IPv4探测脚本中预先设置有IPv4网络服务地址;第一请求模块,用于向IPv4网络服务地址发起IPv4探测请求,得到IPv4探测请求结果;第一确定模块,用于根据IPv4探测请求结果确定客户端的IP协议栈信息。
可选地,在本申请实施例提供的外链改写的处理装置中,第一确定模块还包括:第一判断子模块,用于根据IPv4探测请求结果确定客户端与IPv4网络服务地址是否能建立连接;第一确定子模块,用于若客户端与IPv4网络服务地址连接成功,确定客户端的IP协议栈信息为IPv4/IPv6双栈;第二确定子模块,用于若客户端与IPv4网络服务地址连接失败,确定客户端的IP协议栈信息为IPv6单栈。
可选地,在本申请实施例提供的外链改写的处理装置中,该装置还包括:第一设置单元,用于根据IPv4探测请求结果得到客户端的IP协议栈信息之后,若客户端的IP协议栈信息为IPv6单栈,设置客户端的标识为第一标识;第二设置单元,用于根据IPv4探测请求结果得到客户端的IP协议栈信息之后,若客户端的IP协议栈信息为IPv4/IPv6双栈,设置客户端的标识为第二标识。
可选地,在本申请实施例提供的外链改写的处理装置中,第二确定单元404还包括:第一识别模块,用于识别客户端的标识;第二识别模块,用于若客户端的标识为第二标识,对客户端发起的请求不进行外链改写;第三识别模块,用于若客户端的标识为第一标识,对客户端发起的请求进行外链改写。
可选地,在本申请实施例提供的外链改写的处理装置中,该装置应用于包括客户端、NAT64网关和服务器的系统,该装置还包括:第一部署单元,用于在响应客户端发起的IPv6访问服务之前,在NAT64网关上部署IPv4的HTTP服务,使得NAT64网关能够对客户端提供IPv4访问服务。
外链改写的处理装置包括处理器和存储器,上述的第一获取单元401、第二获取单元402、第一确定单元403、第二确定单元404等均作为程序单元存储在存储器中,由处理器执行存储在存储器中的上述程序单元来实现相应的功能。
处理器中包含内核,由内核去存储器中调取相应的程序单元。内核可以设置一个或以上,通过调整内核参数来进行外链改写的处理。
存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM),存储器包括至少一个存储芯片。
本发明实施例提供了一种存储介质,其上存储有程序,该程序被处理器执行时实现外链改写的处理方法。
本发明实施例提供了一种处理器,处理器用于运行程序,其中,程序运行时执行外链改写的处理方法。
本发明实施例提供了一种设备,设备包括处理器、存储器及存储在存储器上并可在处理器上运行的程序,处理器执行程序时实现以下步骤:响应客户端发起的IPv6访问服务,得到第一页面内容;对第一页面内容进行处理,得到第二页面内容;根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。
处理器执行程序时还实现以下步骤:若IP协议栈信息为IPv4/IPv6双栈,对客户端发起的请求不进行外链改写;若IP协议栈信息为IPv6单栈,对客户端发起的请求进行外链改写。
处理器执行程序时还实现以下步骤:在第一页面内容中插入IPv4探测脚本,将插入IPv4探测脚本后的第一页面内容作为第二页面内容。
处理器执行程序时还实现以下步骤:在客户端执行IPv4探测脚本,其中,IPv4 探测脚本中预先设置有IPv4网络服务地址;向IPv4网络服务地址发起IPv4探测请求,得到IPv4探测请求结果;根据IPv4探测请求结果确定客户端的IP协议栈信息。
处理器执行程序时还实现以下步骤:根据IPv4探测请求结果确定客户端与IPv4网络服务地址是否能建立连接;若客户端与IPv4网络服务地址连接成功,确定客户端的IP协议栈信息为IPv4/IPv6双栈;若客户端与IPv4网络服务地址连接失败,确定客户端的IP协议栈信息为IPv6单栈。
处理器执行程序时还实现以下步骤:若客户端的IP协议栈信息为IPv6单栈,设置客户端的标识为第一标识;若客户端的IP协议栈信息为IPv4/IPv6双栈,设置客户端的标识为第二标识。
处理器执行程序时还实现以下步骤:识别客户端的标识;若客户端的标识为第二标识,对客户端发起的请求不进行外链改写;若客户端的标识为第一标识,对客户端发起的请求进行外链改写。
处理器执行程序时还实现以下步骤:在NAT64网关上部署IPv4的HTTP服务,使得NAT64网关能够对客户端提供IPv4访问服务。本文中的设备可以是服务器、PC、PAD、手机等。
本申请还提供了一种计算机程序产品,当在数据处理设备上执行时,适于执行初始化有如下方法步骤的程序:响应客户端发起的IPv6访问服务,得到第一页面内容;对第一页面内容进行处理,得到第二页面内容;根据第二页面内容在客户端运行IPv4探测服务,确定客户端的IP协议栈信息;根据IP协议栈信息确定是否对客户端发起的请求进行外链改写。
当在数据处理设备上执行时,还适于执行初始化有如下方法步骤的程序:若IP协议栈信息为IPv4/IPv6双栈,对客户端发起的请求不进行外链改写;若IP协议栈信息为IPv6单栈,对客户端发起的请求进行外链改写。
当在数据处理设备上执行时,还适于执行初始化有如下方法步骤的程序:在第一页面内容中插入IPv4探测脚本,将插入IPv4探测脚本后的第一页面内容作为第二页面内容。
当在数据处理设备上执行时,还适于执行初始化有如下方法步骤的程序:在客户端执行IPv4探测脚本,其中,IPv4探测脚本中预先设置有IPv4网络服务地址;向IPv4网络服务地址发起IPv4探测请求,得到IPv4探测请求结果;根据IPv4探测请求结果确定客户端的IP协议栈信息。
当在数据处理设备上执行时,还适于执行初始化有如下方法步骤的程序:根据IPv4 探测请求结果确定客户端与IPv4网络服务地址是否能建立连接;若客户端与IPv4网络服务地址连接成功,确定客户端的IP协议栈信息为IPv4/IPv6双栈;若客户端与IPv4网络服务地址连接失败,确定客户端的IP协议栈信息为IPv6单栈。
当在数据处理设备上执行时,还适于执行初始化有如下方法步骤的程序:若客户端的IP协议栈信息为IPv6单栈,设置客户端的标识为第一标识;若客户端的IP协议栈信息为IPv4/IPv6双栈,设置客户端的标识为第二标识。
当在数据处理设备上执行时,还适于执行初始化有如下方法步骤的程序:识别客户端的标识;若客户端的标识为第二标识,对客户端发起的请求不进行外链改写;若客户端的标识为第一标识,对客户端发起的请求进行外链改写。
当在数据处理设备上执行时,还适于执行初始化有如下方法步骤的程序:在NAT64网关上部署IPv4的HTTP服务,使得NAT64网关能够对客户端提供IPv4访问服务。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、 网络接口和内存。
存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。存储器是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DvD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、商品或者设备中还存在另外的相同要素。
本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
以上仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。

Claims (11)

  1. 一种外链改写的处理方法,其特征在于,所述方法包括:
    响应客户端发起的IPv6访问服务,得到第一页面内容;
    对所述第一页面内容进行处理,得到第二页面内容;
    根据所述第二页面内容在所述客户端运行IPv4探测服务,确定所述客户端的IP协议栈信息;
    根据所述IP协议栈信息确定是否对所述客户端发起的请求进行外链改写。
  2. 根据权利要求1所述的方法,其特征在于,根据所述IP协议栈信息确定是否对所述客户端发起的请求进行外链改写包括:
    若所述IP协议栈信息为IPv4/IPv6双栈,对所述客户端发起的请求不进行外链改写;
    若所述IP协议栈信息为IPv6单栈,对所述客户端发起的请求进行外链改写。
  3. 根据权利要求1所述的方法,其特征在于,对所述第一页面内容进行处理,得到第二页面内容包括:
    在所述第一页面内容中插入IPv4探测脚本,将插入所述IPv4探测脚本后的所述第一页面内容作为所述第二页面内容。
  4. 根据权利要求3所述的方法,其特征在于在,根据所述第二页面内容在客户端运行IPv4探测服务,确定所述客户端的IP协议栈信息包括:
    在客户端执行所述IPv4探测脚本,其中,所述IPv4探测脚本中预先设置有IPv4网络服务地址;
    向所述IPv4网络服务地址发起IPv4探测请求,得到IPv4探测请求结果;
    根据所述IPv4探测请求结果确定所述客户端的IP协议栈信息。
  5. 根据权利要求4所述的方法,其特征在于,根据所述IPv4探测请求结果得到所述客户端的IP协议栈信息包括:
    根据所述IPv4探测请求结果确定所述客户端与所述IPv4网络服务地址是否能建立连接;
    若所述客户端与所述IPv4网络服务地址连接成功,确定所述客户端的IP协议栈信息为IPv4/IPv6双栈;
    若所述客户端与所述IPv4网络服务地址连接失败,确定所述客户端的IP协议栈信息为IPv6单栈。
  6. 根据权利要求5所述的方法,其特征在于,根据所述IPv4探测请求结果得到所述客户端的IP协议栈信息之后,所述方法还包括:
    若客户端的IP协议栈信息为IPv6单栈,设置所述客户端的标识为第一标识;
    若客户端的IP协议栈信息为IPv4/IPv6双栈,设置所述客户端的标识为第二标识。
  7. 根据权利要求6所述的方法,其特征在于,根据所述IP协议栈信息确定是否对所述客户端请求的响应进行外链改写包括:
    识别所述客户端的标识;
    若所述客户端的标识为第二标识,对所述客户端发起的请求不进行外链改写;
    若所述客户端的标识为第一标识,对所述客户端发起的请求进行外链改写。
  8. 根据权利要求1所述的方法,其特征在于,所述方法应用于包括客户端、NAT64网关和服务器的系统,在响应客户端发起的IPv6访问服务之前,所述方法包括:
    在所述NAT64网关上部署IPv4的HTTP服务,使得所述NAT64网关能够对所述客户端提供IPv4访问服务。
  9. 一种外链改写的处理装置,其特征在于,包括:
    第一获取单元,用于响应客户端发起的IPv6访问服务,得到第一页面内容;
    第二获取单元,用于对所述第一页面内容进行处理,得到第二页面内容;
    第一确定单元,用于根据所述第二页面内容在所述客户端运行IPv4探测服务,确定所述客户端的IP协议栈信息;
    第二确定单元,用于根据所述IP协议栈信息确定是否对所述客户端发起的请求进行外链改写。
  10. 一种计算机可读存储介质,其上存储有计算机程序/指令,其特征在于,该计算机程序/指令被处理器执行时执行权利要求1至8中任意一项所述的方法。
  11. 一种计算机程序产品,包括计算机程序/指令,其特征在于,该计算机程序/指令被处理器执行时执行权利要求1至8中任意一项所述的方法。
PCT/CN2020/139481 2020-12-25 2020-12-25 外链改写的处理方法和装置 WO2022134016A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202080003754.6A CN112771835B (zh) 2020-12-25 2020-12-25 外链改写的处理方法和装置
PCT/CN2020/139481 WO2022134016A1 (zh) 2020-12-25 2020-12-25 外链改写的处理方法和装置
US17/437,058 US20240015131A1 (en) 2020-12-25 2020-12-25 Processing Method and Device for External Link Rewriting

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/139481 WO2022134016A1 (zh) 2020-12-25 2020-12-25 外链改写的处理方法和装置

Publications (1)

Publication Number Publication Date
WO2022134016A1 true WO2022134016A1 (zh) 2022-06-30

Family

ID=75699443

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/139481 WO2022134016A1 (zh) 2020-12-25 2020-12-25 外链改写的处理方法和装置

Country Status (3)

Country Link
US (1) US20240015131A1 (zh)
CN (1) CN112771835B (zh)
WO (1) WO2022134016A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070818B (zh) * 2021-11-17 2024-04-02 山石网科通信技术股份有限公司 网站访问系统、方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150281251A1 (en) * 2009-10-30 2015-10-01 Hangzhou H3C Technologies Co., Ltd. Method and apparatus for dual stack access
CN108243249A (zh) * 2018-01-04 2018-07-03 网宿科技股份有限公司 一种网页广告的防屏蔽方法、内容分发网络及客户端
CN111107056A (zh) * 2019-11-22 2020-05-05 睿哲科技股份有限公司 外链url资源调用的方法、装置及协议转换服务器
CN111416862A (zh) * 2020-03-20 2020-07-14 福建万物易联网络科技有限公司 一种基于ipv6 ipv4的cdn平台访问方法及系统

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9184930B2 (en) * 2009-06-08 2015-11-10 Cisco Technology, Inc. Detection and support of a dual-stack capable host
GB201612361D0 (en) * 2016-04-19 2016-08-31 Cisco Tech Inc Routing to content in an IP network
CN109543121B (zh) * 2018-11-09 2023-11-03 深圳万物云联科技有限公司 一种外链url资源调用方法及装置
FR3096202A1 (fr) * 2019-06-20 2020-11-20 Orange Procédé et dispositif d’obtention d’une adresse IP
US11595347B1 (en) * 2020-12-04 2023-02-28 Amazon Technologies, Inc. Dual-stack network addressing in cloud provider network edge locations

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150281251A1 (en) * 2009-10-30 2015-10-01 Hangzhou H3C Technologies Co., Ltd. Method and apparatus for dual stack access
CN108243249A (zh) * 2018-01-04 2018-07-03 网宿科技股份有限公司 一种网页广告的防屏蔽方法、内容分发网络及客户端
CN111107056A (zh) * 2019-11-22 2020-05-05 睿哲科技股份有限公司 外链url资源调用的方法、装置及协议转换服务器
CN111416862A (zh) * 2020-03-20 2020-07-14 福建万物易联网络科技有限公司 一种基于ipv6 ipv4的cdn平台访问方法及系统

Also Published As

Publication number Publication date
CN112771835B (zh) 2023-05-02
CN112771835A (zh) 2021-05-07
US20240015131A1 (en) 2024-01-11

Similar Documents

Publication Publication Date Title
CN109067914B (zh) Web服务的代理方法、装置、设备及存储介质
CN111314499B (zh) 一种域名代理方法、装置、设备及可读存储介质
USRE45139E1 (en) Method and apparatus for cross-domain communication using designated response processing page
US9584472B2 (en) Facilitating content accessibility via different communication formats
US9871850B1 (en) Enhanced browsing using CDN routing capabilities
TWI656772B (zh) 獲取網頁的方法、系統、網路伺服器、瀏覽器和gslb
US10263950B2 (en) Directing clients based on communication format
CN107613037B (zh) 一种域名重定向方法和系统
CN112702425B (zh) 基于域名泛解析的web应用访问代理方法、装置和存储介质
US11489810B2 (en) Intelligently routing a response packet along a same connection as a request packet
JP6666441B2 (ja) Ipアドレス取得方法及び装置
WO2022134016A1 (zh) 外链改写的处理方法和装置
CN104702707A (zh) 一种数据处理方法及装置
US20190068556A1 (en) Method to avoid inspection bypass due to dns poisoning or http host header spoofing
TWI546688B (zh) 對網路位址進行處理的方法及相關的伺服器與非暫態電腦可讀取儲存媒體
TW201644249A (zh) 用以執行傳輸控制協定交握之裝置及方法
CN111885063B (zh) 开源系统访问管控方法、装置、设备及存储介质
CN114070818B (zh) 网站访问系统、方法和装置
RU2751787C1 (ru) Способ оптимизации трафика для прозрачного кеширования, балансировщик нагрузки и носитель данных
CN114285856B (zh) 一种ipv4外链访问方法及装置
CN113055446B (zh) 零信任中保护应用流量的方法、装置及计算设备
EP4068104B1 (en) Method for controlling an opc ua server, opc ua server, computer program, and computer-readable medium
US9544387B2 (en) Indication of URL prerequisite to network communication
CN114051022A (zh) Http请求处理方法及装置
US20210368008A1 (en) Network resource access

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 17437058

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20966581

Country of ref document: EP

Kind code of ref document: A1