Google Docs Viewer
Google Docs Viewer Transport is a stream transport over requests transported by Google Docs Viewer. The client encodes requests into a series of HTTP requests, and request Google Docs Views to carry out these requests. (v5.51.0+)
This transport is very similar to meek, however, the request are not forwarded by a cdn, but google docs viewer. Sadly it is similarly slow and should only be used when other transport are not working. This transport is inspired by https://github.com/0xinf0/gdocs-tunnel (which could be faster than this transport, as currently the version implemented in v2ray is missing some optimization).
Warning
This transport was primarily generated by an LLM and should currently be treated as experimental. Its configuration format and protocol details may change incompatibly in future versions.
This protocol has not been fully tested prior to release.
Google Docs Viewer Stream Transport
- Name:
gdocsviewer - Type: Transport Protocol
- ID:
stream.gdocsviewer
Client Example
{
"log": {
"error": {
"level": "Debug",
"type": "Console"
},
"access": {
"type": "None"
}
},
"inbounds": [
{
"protocol": "socks",
"listen": "127.0.0.1",
"port": 1080,
"settings": {
"udpEnabled": false,
"address": "127.0.0.1",
"packetEncoding": "Packet"
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"address": "www.google.com",
"port": 443,
"uuid": "fbaecb02-945e-471f-9790-e768a586894d"
},
"streamSettings": {
"transport": "gdocsviewer",
"transportSettings": {
"viewerUrl": "https://drive.google.com/viewerng/viewer?embedded=false",
"textUrl": "https://drive.google.com/viewerng/text",
"originUrl": "http://{rand}-0-0-0-0.sslip.io:8080/",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36",
"maxRequestBytes": 872,
"originUrlReplacementRules": [
{
"name": "rand",
"pattern": "[a-z0-9]{16}"
}
],
"sharedKey": "0xjCwHGQW/pOpFa4LkjPqetQvnL29QUAeJ50og/pe1E=",
"h2PoolSize": 4,
"minRequestIntervalMs": 100,
"maxViewerBodyBytes": 33554432
},
"security": "tls",
"securitySettings": {
"serverName": "www.google.com"
}
}
}
]
}
Server Example
{
"log": {
"error": {
"level": "Debug",
"type": "Console"
},
"access": {
"type": "None"
}
},
"inbounds": [
{
"listen": "0.0.0.0",
"port": 8080,
"protocol": "vmess",
"settings": {
"users": [
"fbaecb02-945e-471f-9790-e768a586894d"
]
},
"streamSettings": {
"transport": "gdocsviewer",
"transportSettings": {
"pathPrefix": "/",
"maxRequestBytes": 1100,
"maxResponseBytes": 24000,
"sharedKey": "0xjCwHGQW/pOpFa4LkjPqetQvnL29QUAeJ50og/pe1E="
},
"security": "none"
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}
If the server uses the default pathPrefix, the client originUrl should include that path, for example http://example.com:8080/gdocsviewer. If the server uses "pathPrefix": "/", originUrl can point to the site root.
Fields
viewerUrl: string
(Client only) The Google Docs Viewer page URL. The client adds or overwrites the url query parameter. Default: https://docs.google.com/viewer.
textUrl: string
(Client only) The Google Docs Viewer text endpoint URL. The client adds or overwrites the id query parameter; if page is not set, it sets page=0. Default: https://drive.google.com/viewerng/text.
originUrl: string
(Client only, required) Public origin base URL reachable by Google Docs Viewer. This value should match pathPrefix on server.
viewerHostHeader: string
(Client only) HTTP Host header sent to viewerUrl and textUrl. This is useful when connecting to a Google frontend IP while sending a different Host header.
userAgent: string
(Client only) User-Agent sent to Google Docs Viewer. You should use a real browser user agent to avoid google's blocking.
h2PoolSize: number
(Client only) HTTP/2 connection pool size. The default is determined by the underlying HTTP round tripper.
maxViewerBodyBytes: number
(Client only) Maximum response body size accepted for Google Docs Viewer page and text responses. Default: 33554432.
minRequestIntervalMs: number
(Client only) Minimum interval between Google Docs Viewer requests, in milliseconds. Default: 100.
originUrlReplacementRules: [ OriginUrlReplacementRule ]
(Client only) Generates and replaces placeholders in originUrl for each request. This can replace {rand} in http://{rand}-origin.example.com/ with a random label.
This is used to reduce origin host based restrictions from google docs viewer.
sharedKey: string
(Client and server) Optional shared key. In JSONv5 this is a bytes field, so it should be Base64 encoded. The decoded value must be 32 bytes and is used as an AES-256-GCM key. Client and server must use the same value.
Without sharedKey, request paths use /r/{session}/{payload}/{nonce}.txt, and successful server responses are plain Base64 text. With sharedKey, request paths use /t/{encrypted}.log; requests and responses are protected by AEAD, and server errors are returned as encrypted error frames.
It is recommended to use encryption to avoid being easily restricted by google, or at least reduce the leaking of metadata.
pathPrefix: string
(Server only) Path prefix accepted by the server. Default: /gdocsviewer. When set to /, the server accepts /r/... or /t/... under the site root.
maxRequestBytes: number
(Client and server) Maximum payload size in a single request. The client uses this value as the per-request write limit; the server rejects requests larger than this value. Default: 1100.
maxResponseBytes: number
(Server only) Maximum response payload size before encoding. Default: 65536. Smaller values, such as 24000, are usually safer through the Google Docs Viewer text endpoint.
OriginUrlReplacementRule
name: string
Placeholder name. {name} in originUrl is replaced. Names may contain letters, digits, _, -, and ..
pattern: string
Limited pattern syntax used to generate the replacement value. It supports literal characters, backslash escaping, character classes, and fixed repeat counts, for example [a-z0-9]{16}. This is not a full regular expression; +, *, ?, |, and grouping are not supported.
The same rule generates one value per request and replaces all matching placeholders in originUrl.
Notes
originUrlmust be an HTTP URL that Google Docs Viewer can fetch directly.- The outer client outbound target is normally an address that can reach Google services, used with TLS
serverName. sharedKeyis recommended; without it, the origin path and response body are not protected by transport encryption.- This transport performs multiple HTTP requests and its performance and reliability depend on Google Docs Viewer behavior.
(This document is generated with assist from LLM, and reviewed by author.)
