//在原来代码的12行的位置添加下面的内容
const allowedDomains = ["你的域名", "你的域名"];
// Extract the Referer header or use a placeholder if not present
const Referer = request.headers.get('Referer') || "Referer";
// Create a URL object from the Referer to extract the hostname
let refererUrl;
try {
refererUrl = new URL(Referer);
} catch (error) {
return Response.redirect("https://你的域名", 302);
}
// Check if the hostname of the Referer is in the list of allowed domains
if (!allowedDomains.includes(refererUrl.hostname)) {
return Response.redirect("https://你的域名", 302);
}
// Existing code for handling requests continues here...
const url = new URL(request.url);
Google One的VPN有很明显的优点,其中最突出的一点就是其IP地址非常干净。这使得在需要解锁和收看流媒体视频,或者注册一些网络服务时,Google One可以为您创造一个非常干净的网络环境。但是,它也有一些缺点,最主要的是使用不太方便,因为Google One不支持中国大陆地区。如果您想使用它的VPN服务,必须安装一个前置代理,例如使用一个软路由,需要两层使用才能完成操作,这大大限制了我们的使用环境。
首先是目前已经开通的国家:
Google one vpn可以支持的平台包括安卓手机、ios苹果手机或者平板、Windows操作系统、mac电脑,看到其中是不包括我们网络环境中经常用到的Linux系统的。
对于Windows的vps主机,需要补充一下,建议选择平台就支持预装Windows的vps,这种是比较简便的方法。当然如果你有linux的主机也可以通过dd windows的方法后台将系统更新为windows的方法,这种方法网上有一键安装的脚本,一条命令就可以搞定,不过这种方法存在被平台发现并关闭服务的风险,所以如果采取这种方法,需要注意两点:1是在Google中搜索一下dd windows 服务商的名字 看看是不是对这种操作严控,另外就是务必只在月付的机器上搞这种操作。
V2Ray 4.28.2 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.15.2 windows/amd64) A unified platform for anti-censorship. 2024/03/24 02:31:04 Using default config: C:\v2ray\config.json
// Config file of V2Ray. This file follows standard JSON format, with comments support.
// Uncomment entries below to satisfy your needs. Also read our manual for more detail at
// https://www.v2ray.com/
{
"log": {
// By default, V2Ray writes access log to stdout.
// "access": "/path/to/access/log/file",
// By default, V2Ray write error log to stdout.
// "error": "/path/to/error/log/file",
// Log level, one of "debug", "info", "warning", "error", "none"
"loglevel": "warning"
},
// List of inbound proxy configurations.
"inbounds": [{
// Port to listen on. You may need root access if the value is less than 1024.
"port": 80,
// IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces.
"listen": "0.0.0.0",
// Tag of the inbound proxy. May be used for routing.
"tag": "socks-inbound",
// Protocol name of inbound proxy.
"protocol": "vmess",
// Settings of the protocol. Varies based on protocol.
"settings": {
"clients": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/livecam"
}
},
// Enable sniffing on TCP connection.
"sniffing": {
"enabled": true,
// Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS.
"destOverride": ["http", "tls"]
}
}],
// List of outbound proxy configurations.
"outbounds": [
{
"tag":"IP4_out",
"protocol": "freedom",
"settings": {}
},
{
"tag":"IP6_out",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv6"
}
}
],
// Transport is for global transport settings. If you have multiple transports with same settings
// (say mKCP), you may put it here, instead of in each individual inbound/outbounds.
//"transport": {},
// Routing controls how traffic from inbounds are sent to outbounds.
"routing": {
"rules": [
{
"type": "field",
"outboundTag": "IP6_out",
"network": "udp,tcp"
}
]
},
// Dns settings for domain resolution.
"dns": {
// Static hosts, similar to hosts file.
"hosts": {
// Match v2ray.com to another domain on CloudFlare. This domain will be used when querying IPs for v2ray.com.
"domain:v2ray.com": "www.vicemc.net",
// The following settings help to eliminate DNS poisoning in mainland China.
// It is safe to comment these out if this is not the case for you.
"domain:github.io": "pages.github.com",
"domain:wikipedia.org": "www.wikimedia.org",
"domain:shadowsocks.org": "electronicsrealm.com"
},
"servers": [
"1.1.1.1",
{
"address": "114.114.114.114",
"port": 53,
// List of domains that use this DNS first.
"domains": [
"geosite:cn"
]
},
"8.8.8.8",
"localhost"
]
},
// Policy controls some internal behavior of how V2Ray handles connections.
// It may be on connection level by user levels in 'levels', or global settings in 'system.'
"policy": {
// Connection policys by user levels
"levels": {
"0": {
"uplinkOnly": 0,
"downlinkOnly": 0
}
},
"system": {
"statsInboundUplink": false,
"statsInboundDownlink": false,
"statsOutboundUplink": false,
"statsOutboundDownlink": false
}
},
// Stats enables internal stats counter.
// This setting can be used together with Policy and Api.
//"stats":{},
// Api enables gRPC APIs for external programs to communicate with V2Ray instance.
//"api": {
//"tag": "api",
//"services": [
// "HandlerService",
// "LoggerService",
// "StatsService"
//]
//},
// You may add other entries to the configuration, but they will not be recognized by V2Ray.
"other": {}
}