mirror of https://gitlab.com/rwkgyg/CFwarp.git
Add files via upload
This commit is contained in:
parent
f8ac61ac54
commit
c588cd51b4
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"blackhole",
|
||||||
|
"tag":"blackhole-out"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {},
|
||||||
|
"tag": "direct"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "socks5-warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": [""] // 必填!自定义域名走IPv6,例:["geosite:netflix","geosite:*****"]或["netflix.com","****.**"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "socks5-warp",
|
||||||
|
"domain": [""] // 必填!自定义域名走socks5-warp,,例:["geosite:netflix","geosite:*****"]或["netflix.com","****.**"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "warp",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "warp",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "warp",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "warp",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "warp",
|
||||||
|
"domain": [""]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
{
|
||||||
|
"api": {
|
||||||
|
"services": [
|
||||||
|
"HandlerService",
|
||||||
|
"LoggerService",
|
||||||
|
"StatsService"
|
||||||
|
],
|
||||||
|
"tag": "api"
|
||||||
|
},
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"port": 62789,
|
||||||
|
"protocol": "dokodemo-door",
|
||||||
|
"settings": {
|
||||||
|
"address": "127.0.0.1"
|
||||||
|
},
|
||||||
|
"tag": "api",
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": ["http", "tls"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP4-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "socks5-warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"policy": {
|
||||||
|
"system": {
|
||||||
|
"statsInboundDownlink": true,
|
||||||
|
"statsInboundUplink": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"routing": {
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": ["ip.gs"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "socks5-warp",
|
||||||
|
"domain": ["google.com"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inboundTag": [
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"outboundTag": "api",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ip": [
|
||||||
|
"geoip:private"
|
||||||
|
],
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"protocol": [
|
||||||
|
"bittorrent"
|
||||||
|
],
|
||||||
|
"type": "field"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"stats": {}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
{
|
||||||
|
"api": {
|
||||||
|
"services": [
|
||||||
|
"HandlerService",
|
||||||
|
"LoggerService",
|
||||||
|
"StatsService"
|
||||||
|
],
|
||||||
|
"tag": "api"
|
||||||
|
},
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"port": 62789,
|
||||||
|
"protocol": "dokodemo-door",
|
||||||
|
"settings": {
|
||||||
|
"address": "127.0.0.1"
|
||||||
|
},
|
||||||
|
"tag": "api",
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": ["http", "tls"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"policy": {
|
||||||
|
"system": {
|
||||||
|
"statsInboundDownlink": true,
|
||||||
|
"statsInboundUplink": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"routing": {
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": ["ip.gs"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inboundTag": [
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"outboundTag": "api",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ip": [
|
||||||
|
"geoip:private"
|
||||||
|
],
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"protocol": [
|
||||||
|
"bittorrent"
|
||||||
|
],
|
||||||
|
"type": "field"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"stats": {}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
{
|
||||||
|
"api": {
|
||||||
|
"services": [
|
||||||
|
"HandlerService",
|
||||||
|
"LoggerService",
|
||||||
|
"StatsService"
|
||||||
|
],
|
||||||
|
"tag": "api"
|
||||||
|
},
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"port": 62789,
|
||||||
|
"protocol": "dokodemo-door",
|
||||||
|
"settings": {
|
||||||
|
"address": "127.0.0.1"
|
||||||
|
},
|
||||||
|
"tag": "api",
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": ["http", "tls"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"IP6-out",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "socks5-warp",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"policy": {
|
||||||
|
"system": {
|
||||||
|
"statsInboundDownlink": true,
|
||||||
|
"statsInboundUplink": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"routing": {
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP6-out",
|
||||||
|
"domain": ["ip.gs"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "socks5-warp",
|
||||||
|
"domain": ["google.com"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "IP4-out",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inboundTag": [
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"outboundTag": "api",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ip": [
|
||||||
|
"geoip:private"
|
||||||
|
],
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"protocol": [
|
||||||
|
"bittorrent"
|
||||||
|
],
|
||||||
|
"type": "field"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"stats": {}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
{
|
||||||
|
"api": {
|
||||||
|
"services": [
|
||||||
|
"HandlerService",
|
||||||
|
"LoggerService",
|
||||||
|
"StatsService"
|
||||||
|
],
|
||||||
|
"tag": "api"
|
||||||
|
},
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"port": 62789,
|
||||||
|
"protocol": "dokodemo-door",
|
||||||
|
"settings": {
|
||||||
|
"address": "127.0.0.1"
|
||||||
|
},
|
||||||
|
"tag": "api",
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": ["http", "tls"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag": "default",
|
||||||
|
"protocol": "freedom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"socks5_out",
|
||||||
|
"protocol": "socks",
|
||||||
|
"settings": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "127.0.0.1",
|
||||||
|
"port": 40000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"policy": {
|
||||||
|
"system": {
|
||||||
|
"statsInboundDownlink": true,
|
||||||
|
"statsInboundUplink": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"routing": {
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "socks5_out",
|
||||||
|
"domain": ["geosite:netflix"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"outboundTag": "default",
|
||||||
|
"network": "udp,tcp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inboundTag": [
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"outboundTag": "api",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ip": [
|
||||||
|
"geoip:private"
|
||||||
|
],
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"type": "field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outboundTag": "blocked",
|
||||||
|
"protocol": [
|
||||||
|
"bittorrent"
|
||||||
|
],
|
||||||
|
"type": "field"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"stats": {}
|
||||||
|
}
|
|
@ -0,0 +1,975 @@
|
||||||
|
#!/bin/bash
|
||||||
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
red='\033[0;31m'
|
||||||
|
bblue='\033[0;34m'
|
||||||
|
plain='\033[0m'
|
||||||
|
red(){ echo -e "\033[31m\033[01m$1\033[0m";}
|
||||||
|
green(){ echo -e "\033[32m\033[01m$1\033[0m";}
|
||||||
|
yellow(){ echo -e "\033[33m\033[01m$1\033[0m";}
|
||||||
|
blue(){ echo -e "\033[36m\033[01m$1\033[0m";}
|
||||||
|
white(){ echo -e "\033[37m\033[01m$1\033[0m";}
|
||||||
|
bblue(){ echo -e "\033[34m\033[01m$1\033[0m";}
|
||||||
|
rred(){ echo -e "\033[35m\033[01m$1\033[0m";}
|
||||||
|
readtp(){ read -t5 -n26 -p "$(yellow "$1")" $2;}
|
||||||
|
readp(){ read -p "$(yellow "$1")" $2;}
|
||||||
|
[[ $EUID -ne 0 ]] && yellow "请以root模式运行脚本" && exit 1
|
||||||
|
|
||||||
|
start(){
|
||||||
|
yellow " 请稍等3秒……正在扫描vps类型及参数中……"
|
||||||
|
if [[ -f /etc/redhat-release ]]; then
|
||||||
|
release="Centos"
|
||||||
|
elif cat /etc/issue | grep -q -E -i "debian"; then
|
||||||
|
release="Debian"
|
||||||
|
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
|
||||||
|
release="Ubuntu"
|
||||||
|
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
|
||||||
|
release="Centos"
|
||||||
|
elif cat /proc/version | grep -q -E -i "debian"; then
|
||||||
|
release="Debian"
|
||||||
|
elif cat /proc/version | grep -q -E -i "ubuntu"; then
|
||||||
|
release="Ubuntu"
|
||||||
|
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
|
||||||
|
release="Centos"
|
||||||
|
else
|
||||||
|
red "不支持你当前系统,请选择使用Ubuntu,Debian,Centos系统。" && rm -f CFwarp.sh && exit 1
|
||||||
|
fi
|
||||||
|
vsid=`grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1`
|
||||||
|
sys(){
|
||||||
|
[ -f /etc/os-release ] && grep -i pretty_name /etc/os-release | cut -d \" -f2 && return
|
||||||
|
[ -f /etc/lsb-release ] && grep -i description /etc/lsb-release | cut -d \" -f2 && return
|
||||||
|
[ -f /etc/redhat-release ] && awk '{print $0}' /etc/redhat-release && return;}
|
||||||
|
op=`sys`
|
||||||
|
version=`uname -r | awk -F "-" '{print $1}'`
|
||||||
|
main=`uname -r | awk -F . '{print $1}'`
|
||||||
|
minor=`uname -r | awk -F . '{print $2}'`
|
||||||
|
bit=`uname -m`
|
||||||
|
[[ $bit = x86_64 ]] && cpu=AMD64
|
||||||
|
[[ $bit = aarch64 ]] && cpu=ARM64
|
||||||
|
vi=`systemd-detect-virt`
|
||||||
|
if [[ -n $(sysctl net.ipv4.tcp_congestion_control 2>/dev/null | awk -F ' ' '{print $3}') ]]; then
|
||||||
|
bbr=`sysctl net.ipv4.tcp_congestion_control | awk -F ' ' '{print $3}'`
|
||||||
|
elif [[ -n $(ping 10.0.0.2 -c 2 | grep ttl) ]]; then
|
||||||
|
bbr="openvz版bbr-plus"
|
||||||
|
else
|
||||||
|
bbr="暂不支持显示"
|
||||||
|
fi
|
||||||
|
if [[ $vi = openvz ]]; then
|
||||||
|
TUN=$(cat /dev/net/tun 2>&1)
|
||||||
|
if [[ ! $TUN =~ 'in bad state' ]] && [[ ! $TUN =~ '处于错误状态' ]] && [[ ! $TUN =~ 'Die Dateizugriffsnummer ist in schlechter Verfassung' ]]; then
|
||||||
|
red "检测到未开启TUN,现尝试添加TUN支持" && sleep 4
|
||||||
|
cd /dev
|
||||||
|
mkdir net
|
||||||
|
mknod net/tun c 10 200
|
||||||
|
chmod 0666 net/tun
|
||||||
|
TUN=$(cat /dev/net/tun 2>&1)
|
||||||
|
if [[ ! $TUN =~ 'in bad state' ]] && [[ ! $TUN =~ '处于错误状态' ]] && [[ ! $TUN =~ 'Die Dateizugriffsnummer ist in schlechter Verfassung' ]]; then
|
||||||
|
green "添加TUN支持失败,建议与VPS厂商沟通或后台设置开启" && exit 0
|
||||||
|
else
|
||||||
|
green "恭喜,添加TUN支持成功,现添加防止重启VPS后TUN失效的TUN守护功能" && sleep 4
|
||||||
|
cat>/root/tun.sh<<-\EOF
|
||||||
|
#!/bin/bash
|
||||||
|
cd /dev
|
||||||
|
mkdir net
|
||||||
|
mknod net/tun c 10 200
|
||||||
|
chmod 0666 net/tun
|
||||||
|
EOF
|
||||||
|
chmod +x /root/tun.sh
|
||||||
|
grep -qE "^ *@reboot root bash /root/tun.sh >/dev/null 2>&1" /etc/crontab || echo "@reboot root bash /root/tun.sh >/dev/null 2>&1" >> /etc/crontab
|
||||||
|
green "TUN守护功能已启动"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
[[ $(type -P yum) ]] && yumapt='yum -y' || yumapt='apt -y'
|
||||||
|
[[ $(type -P wget) ]] || (yellow "检测到wget未安装,升级安装中" && $yumapt update;$yumapt install wget)
|
||||||
|
[[ $(type -P curl) ]] || (yellow "检测到curl未安装,升级安装中" && $yumapt update;$yumapt install curl)
|
||||||
|
[[ ! $(type -P python3) ]] && (yellow "检测到python3未安装,升级安装中" && $yumapt update;$yumapt install python3)
|
||||||
|
[[ ! $(type -P screen) ]] && (yellow "检测到screen未安装,升级安装中" && $yumapt update;$yumapt install screen)
|
||||||
|
|
||||||
|
ud4='sed -i "5 s/^/PostUp = ip -4 rule add from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "6 s/^/PostDown = ip -4 rule delete from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf'
|
||||||
|
ud6='sed -i "7 s/^/PostUp = ip -6 rule add from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "8 s/^/PostDown = ip -6 rule delete from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf'
|
||||||
|
ud4ud6='sed -i "5 s/^/PostUp = ip -4 rule add from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "6 s/^/PostDown = ip -4 rule delete from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "7 s/^/PostUp = ip -6 rule add from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "8 s/^/PostDown = ip -6 rule delete from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf'
|
||||||
|
c1="sed -i '/0\.0\.0\.0\/0/d' /etc/wireguard/wgcf.conf"
|
||||||
|
c2="sed -i '/\:\:\/0/d' /etc/wireguard/wgcf.conf"
|
||||||
|
c3="sed -i 's/engage.cloudflareclient.com/162.159.193.10/g' /etc/wireguard/wgcf.conf"
|
||||||
|
c4="sed -i 's/engage.cloudflareclient.com/2606:4700:d0::a29f:c001/g' /etc/wireguard/wgcf.conf"
|
||||||
|
c5="sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' /etc/wireguard/wgcf.conf"
|
||||||
|
c6="sed -i 's/1.1.1.1/2001:4860:4860::8888,8.8.8.8/g' /etc/wireguard/wgcf.conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowWGCF(){
|
||||||
|
UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
|
||||||
|
v6=$(curl -s6m6 https://ip.gs -k)
|
||||||
|
v4=$(curl -s4m6 https://ip.gs -k)
|
||||||
|
isp4=`curl -s --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v4 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"`
|
||||||
|
isp6=`curl -s --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v6 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"`
|
||||||
|
[[ -e /etc/wireguard/wgcf+p.log ]] && cfplus="WARP+普通账户(有限WARP+流量),设备名称:$(grep -s 'Device name' /etc/wireguard/wgcf+p.log | awk '{ print $NF }')" || cfplus="WARP+Teams账户(无限WARP+流量)"
|
||||||
|
AE="阿联酋(United Arab Emirates)";AU="澳大利亚(Australia)";BG="保加利亚(Bulgaria)";BR="巴西(Brazil)";CA="加拿大(Canada)";CH="瑞士(Switzerland)";CL="智利(Chile)";CN="中国(China)";CO="哥伦比亚(Colombia)";DE="德国(Germany)";ES="西班牙(Spain)";FI="芬兰(Finland)";FR="法国(France)";GB="英国(United Kingdom)";HK="香港(Hong Kong)";ID="印度尼西亚(Indonesia)";IE="爱尔兰(Ireland)";IL="以色列(Israel)";IN="印度(India)";IT="意大利(Italy)";JP="日本(Japan)";KR="韩国(South Korea)";LU="卢森堡(Luxembourg)";MX="墨西哥(Mexico)";MY="马来西亚(Malaysia)";NL="荷兰(Netherlands)";NZ="新西兰(New Zealand)";PH="菲律宾(Philippines)";RO="罗马尼亚(Romania)";RU="俄罗斯(Russian)";SA="沙特(Saudi Arabia)";SE="瑞典(Sweden)";SG="新加坡(Singapore)";TW="台湾(Taiwan)";US="美国(United States)";VN="越南(Vietnam)";ZA="南非(South Africa)"
|
||||||
|
if [[ -n $v4 ]]; then
|
||||||
|
result4=$(curl -4 --user-agent "${UA_Browser}" -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81215567" 2>&1)
|
||||||
|
[[ "$result4" == "404" ]] && NF="遗憾哦,当前IP仅解锁奈飞Netflix自制剧..."
|
||||||
|
[[ "$result4" == "403" ]] && NF="死心了,当前IP不支持解锁奈飞Netflix....."
|
||||||
|
[[ "$result4" == "000" ]] && NF="检测到网络有问题,再次进入脚本可能就好了.."
|
||||||
|
[[ "$result4" == "200" ]] && NF="恭喜呀,当前IP可解锁奈飞Netflix流媒体..."
|
||||||
|
g4=$(eval echo \$$(curl -s --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v4 -k | awk -F "country_code" '{print $2}' | awk -F "region_code" '{print $1}' | sed "s/[,\":}]//g"))
|
||||||
|
wgcfv4=$(curl -s4 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
case ${wgcfv4} in
|
||||||
|
plus)
|
||||||
|
WARPIPv4Status=$(white "IPV4 WARP+状态:\c" ; rred "运行中,$cfplus" ; white " [ Cloudflare服务商 ]获取IPV4:\c" ; rred "$v4" ; white " IPV4 奈飞NF解锁情况:\c" ; rred "$NF \c"; white " IPV4 所在地区:\c" ; rred "$g4");;
|
||||||
|
on)
|
||||||
|
WARPIPv4Status=$(white "IPV4 WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " [ Cloudflare服务商 ]获取IPV4:\c" ; green "$v4" ; white " IPV4 奈飞NF解锁情况:\c" ; green "$NF \c"; white " IPV4 所在地区:\c" ; green "$g4");;
|
||||||
|
off)
|
||||||
|
WARPIPv4Status=$(white "IPV4 WARP状态:\c" ; yellow "关闭中" ; white " [ $isp4服务商 ]获取IPV4:\c" ; yellow "$v4" ; white " IPV4 奈飞NF解锁情况:\c" ; yellow "$NF \c"; white " IPV4 所在地区:\c" ; yellow "$g4");;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
WARPIPv4Status=$(white "IPV4 状态:\c" ; red "不存在IPV4地址 ")
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 ]]; then
|
||||||
|
result6=$(curl -6 --user-agent "${UA_Browser}" -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81215567" 2>&1)
|
||||||
|
[[ "$result6" == "404" ]] && NF="遗憾哦,当前IP仅解锁奈飞Netflix自制剧..."
|
||||||
|
[[ "$result6" == "403" ]] && NF="死心了,当前IP不支持解锁奈飞Netflix....."
|
||||||
|
[[ "$result6" == "000" ]] && NF="检测到网络有问题,再次进入脚本可能就好了.."
|
||||||
|
[[ "$result6" == "200" ]] && NF="恭喜呀,当前IP可解锁奈飞Netflix流媒体..."
|
||||||
|
g6=$(eval echo \$$(curl -s --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v6 -k | awk -F "country_code" '{print $2}' | awk -F "region_code" '{print $1}' | sed "s/[,\":}]//g"))
|
||||||
|
wgcfv6=$(curl -s6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
case ${wgcfv6} in
|
||||||
|
plus)
|
||||||
|
WARPIPv6Status=$(white "IPV6 WARP+状态:\c" ; rred "运行中,$cfplus" ; white " [ Cloudflare服务商 ]获取IPV6:\c" ; rred "$v6" ; white " IPV6 奈飞NF解锁情况:\c" ; rred "$NF \c"; white " IPV6 所在地区:\c" ; rred "$g6");;
|
||||||
|
on)
|
||||||
|
WARPIPv6Status=$(white "IPV6 WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " [ Cloudflare服务商 ]获取IPV6:\c" ; green "$v6" ; white " IPV6 奈飞NF解锁情况:\c" ; green "$NF \c"; white " IPV6 所在地区:\c" ; green "$g6");;
|
||||||
|
off)
|
||||||
|
WARPIPv6Status=$(white "IPV6 WARP状态:\c" ; yellow "关闭中" ; white " [ $isp6服务商 ]获取IPV6:\c" ; yellow "$v6" ; white " IPV6 奈飞NF解锁情况:\c" ; yellow "$NF \c"; white " IPV6 所在地区:\c" ; yellow "$g6");;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
WARPIPv6Status=$(white "IPV6 状态:\c" ; red "不存在IPV6地址 ")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowSOCKS5(){
|
||||||
|
if [[ $(systemctl is-active warp-svc) = active ]]; then
|
||||||
|
mport=`warp-cli --accept-tos settings 2>/dev/null | grep 'WarpProxy on port' | awk -F "port " '{print $2}'`
|
||||||
|
AE="阿联酋(United Arab Emirates)";AU="澳大利亚(Australia)";BG="保加利亚(Bulgaria)";BR="巴西(Brazil)";CA="加拿大(Canada)";CH="瑞士(Switzerland)";CL="智利(Chile)";CN="中国(China)";CO="哥伦比亚(Colombia)";DE="德国(Germany)";ES="西班牙(Spain)";FI="芬兰(Finland)";FR="法国(France)";GB="英国(United Kingdom)";HK="香港(Hong Kong)";ID="印度尼西亚(Indonesia)";IE="爱尔兰(Ireland)";IL="以色列(Israel)";IN="印度(India)";IT="意大利(Italy)";JP="日本(Japan)";KR="韩国(South Korea)";LU="卢森堡(Luxembourg)";MX="墨西哥(Mexico)";MY="马来西亚(Malaysia)";NL="荷兰(Netherlands)";NZ="新西兰(New Zealand)";PH="菲律宾(Philippines)";RO="罗马尼亚(Romania)";RU="俄罗斯(Russian)";SA="沙特(Saudi Arabia)";SE="瑞典(Sweden)";SG="新加坡(Singapore)";TW="台湾(Taiwan)";US="美国(United States)";VN="越南(Vietnam)";ZA="南非(South Africa)"
|
||||||
|
result=$(curl -sx socks5h://localhost:$mport -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81215567" 2>&1)
|
||||||
|
[[ "$result" == "404" ]] && NF="遗憾哦,当前IP仅解锁奈飞Netflix自制剧..."
|
||||||
|
[[ "$result" == "403" ]] && NF="死心了,当前IP不支持解锁奈飞Netflix....."
|
||||||
|
[[ "$result" == "000" ]] && NF="检测到网络有问题,再次进入脚本可能就好了.."
|
||||||
|
[[ "$result" == "200" ]] && NF="恭喜呀,当前IP可解锁奈飞Netflix流媒体..."
|
||||||
|
socks5=$(curl -sx socks5h://localhost:$mport www.cloudflare.com/cdn-cgi/trace -k --connect-timeout 2 | grep warp | cut -d= -f2)
|
||||||
|
s5ip=`curl -sx socks5h://localhost:$mport ip.gs -k`
|
||||||
|
s5gj=$(eval echo \$$(curl -s -A "Mozilla" https://api.ip.sb/geoip/$S5ip -k | awk -F "country_code" '{print $2}' | awk -F "region_code" '{print $1}' | sed "s/[,\":}]//g"))
|
||||||
|
case ${socks5} in
|
||||||
|
plus)
|
||||||
|
S5Status=$(white "Socks5 WARP+状态:\c" ; rred "运行中,WARP+普通账户(剩余WARP+流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000))GiB)" ; white " Socks5 端口:\c" ; rred "$mport" ; white " [ Cloudflare服务商 ]获取IPV4:\c" ; rred "$s5ip" ; white " IPV4 奈飞NF解锁情况:\c" ; rred "$NF \c" ; white " IPV4 所在地区:\c" ; rred "$s5gj");;
|
||||||
|
on)
|
||||||
|
S5Status=$(white "Socks5 WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " Socks5 端口:\c" ; green "$mport" ; white " [ Cloudflare服务商 ]获取IPV4:\c" ; green "$s5ip" ; white " IPV4 奈飞NF解锁情况:\c" ; green "$NF \c"; white " IPV4 所在地区:\c" ; green "$s5gj");;
|
||||||
|
*)
|
||||||
|
S5Status=$(white "Socks5 WARP状态:\c" ; yellow "已安装Socks5-WARP客户端,但端口处于关闭状态")
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
S5Status=$(white "Socks5 WARP状态:\c" ; red "未安装Socks5-WARP客户端")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
docker(){
|
||||||
|
if [[ -n $(ip a | grep docker) ]]; then
|
||||||
|
red "检测到VPS已安装docker,如继续安装Wgcf-WARP,docker会失效"
|
||||||
|
sleep 3s
|
||||||
|
yellow "6秒后继续安装,退出安装请按Ctrl+c"
|
||||||
|
sleep 6s
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
STOPwgcf(){
|
||||||
|
if [[ $(type -P warp-cli) ]]; then
|
||||||
|
red "已安装Socks5-WARP(+),不支持当前选择的Wgcf-WARP(+)安装方案"
|
||||||
|
systemctl start wg-quick@wgcf >/dev/null 2>&1 ; bash CFwarp.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
v4v6(){
|
||||||
|
v6=$(curl -s6m6 https://ip.gs -k)
|
||||||
|
v4=$(curl -s4m6 https://ip.gs -k)
|
||||||
|
}
|
||||||
|
|
||||||
|
ABC(){
|
||||||
|
echo $ABC1 | sh
|
||||||
|
echo $ABC2 | sh
|
||||||
|
echo $ABC3 | sh
|
||||||
|
echo $ABC4 | sh
|
||||||
|
}
|
||||||
|
conf(){
|
||||||
|
rm -rf /etc/wireguard/wgcf.conf
|
||||||
|
cp -f /etc/wireguard/wgcf-profile.conf /etc/wireguard/wgcf.conf >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
WGCFv4(){
|
||||||
|
yellow "稍等3秒,检测VPS内WARP环境"
|
||||||
|
docker && checkwgcf
|
||||||
|
if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then
|
||||||
|
v4v6
|
||||||
|
if [[ -n $v4 && -n $v6 ]]; then
|
||||||
|
green "当前原生v4+v6双栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV4单栈模式" && sleep 2
|
||||||
|
ABC1=$ud4 && ABC2=$c2 && ABC3=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
green "当前原生v6单栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV4单栈模式" && sleep 2
|
||||||
|
ABC1=$c2 && ABC2=$c4 && ABC3=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
if [[ -z $v6 && -n $v4 ]]; then
|
||||||
|
green "当前原生v4单栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV4单栈模式" && sleep 2
|
||||||
|
STOPwgcf ; ABC1=$ud4 && ABC2=$c2 && ABC3=$c3 && ABC4=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
systemctl stop wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
v4v6
|
||||||
|
if [[ -n $v4 && -n $v6 ]]; then
|
||||||
|
green "当前原生v4+v6双栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV4单栈模式" && sleep 2
|
||||||
|
conf && ABC1=$ud4 && ABC2=$c2 && ABC3=$c5 && ABC
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
green "当前原生v6单栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV4单栈模式" && sleep 2
|
||||||
|
conf && ABC1=$c2 && ABC2=$c4 && ABC3=$c5 && ABC
|
||||||
|
fi
|
||||||
|
if [[ -z $v6 && -n $v4 ]]; then
|
||||||
|
green "当前原生v4单栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV4单栈模式" && sleep 2
|
||||||
|
STOPwgcf ; conf && ABC1=$ud4 && ABC2=$c2 && ABC3=$c3 && ABC4=$c5 && ABC
|
||||||
|
fi
|
||||||
|
CheckWARP
|
||||||
|
ShowWGCF && WGCFmenu && back
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
WGCFv6(){
|
||||||
|
yellow "稍等3秒,检测VPS内WARP环境"
|
||||||
|
docker && checkwgcf
|
||||||
|
if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then
|
||||||
|
v4v6
|
||||||
|
if [[ -n $v4 && -n $v6 ]]; then
|
||||||
|
green "当前原生v4+v6双栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV6单栈模式" && sleep 2
|
||||||
|
ABC1=$ud6 && ABC2=$c1 && ABC3=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
green "当前原生v6单栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV6单栈模式(无IPV4!!!)" && sleep 2
|
||||||
|
ABC1=$ud6 && ABC2=$c1 && ABC3=$c4 && ABC4=$c6 && WGCFins
|
||||||
|
fi
|
||||||
|
if [[ -z $v6 && -n $v4 ]]; then
|
||||||
|
green "当前原生v4单栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV6单栈模式" && sleep 2
|
||||||
|
ABC1=$c1 && ABC2=$c3 && ABC3=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
systemctl stop wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
v4v6
|
||||||
|
if [[ -n $v4 && -n $v6 ]]; then
|
||||||
|
green "当前原生v4+v6双栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV6单栈模式" && sleep 2
|
||||||
|
conf && ABC1=$ud6 && ABC2=$c1 && ABC3=$c5 && ABC
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
green "当前原生v6单栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV6单栈模式(无IPV4!!!)" && sleep 2
|
||||||
|
conf && ABC1=$ud6 && ABC2=$c1 && ABC3=$c4 && ABC4=$c6 && ABC
|
||||||
|
fi
|
||||||
|
if [[ -z $v6 && -n $v4 ]]; then
|
||||||
|
green "当前原生v4单栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV6单栈模式" && sleep 2
|
||||||
|
conf && ABC1=$c1 && ABC2=$c3 && ABC3=$c5 && ABC
|
||||||
|
fi
|
||||||
|
CheckWARP
|
||||||
|
ShowWGCF && WGCFmenu && back
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
WGCFv4v6(){
|
||||||
|
yellow "稍等3秒,检测VPS内WARP环境"
|
||||||
|
docker && checkwgcf
|
||||||
|
if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then
|
||||||
|
v4v6
|
||||||
|
if [[ -n $v4 && -n $v6 ]]; then
|
||||||
|
green "当前原生v4+v6双栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV4+IPV6双栈模式" && sleep 2
|
||||||
|
STOPwgcf ; ABC1=$ud4ud6 && ABC2=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
green "当前原生v6单栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV4+IPV6双栈模式" && sleep 2
|
||||||
|
STOPwgcf ; ABC1=$ud6 && ABC2=$c4 && ABC3=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
if [[ -z $v6 && -n $v4 ]]; then
|
||||||
|
green "当前原生v4单栈vps首次安装Wgcf-WARP\n现添加Wgcf-WARP-IPV4+IPV6双栈模式" && sleep 2
|
||||||
|
STOPwgcf ; ABC1=$ud4 && ABC2=$c3 && ABC3=$c5 && WGCFins
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
systemctl stop wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
v4v6
|
||||||
|
if [[ -n $v4 && -n $v6 ]]; then
|
||||||
|
green "当前原生v4+v6双栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV4+IPV6双栈模式" && sleep 2
|
||||||
|
STOPwgcf ; conf && ABC1=$ud4ud6 && ABC2=$c5 && ABC
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
green "当前原生v6单栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV4+IPV6双栈模式" && sleep 2
|
||||||
|
STOPwgcf ; conf && ABC1=$ud6 && ABC2=$c4 && ABC3=$c5 && ABC
|
||||||
|
fi
|
||||||
|
if [[ -z $v6 && -n $v4 ]]; then
|
||||||
|
green "当前原生v4单栈vps已安装Wgcf-WARP\n现快速切换Wgcf-WARP-IPV4+IPV6双栈模式" && sleep 2
|
||||||
|
STOPwgcf ; conf && ABC1=$ud4 && ABC2=$c3 && ABC3=$c5 && ABC
|
||||||
|
fi
|
||||||
|
CheckWARP
|
||||||
|
ShowWGCF && WGCFmenu && back
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
WGCFmenu(){
|
||||||
|
white "------------------------------------------------------------------------------------------------"
|
||||||
|
white " 当前VPS IPV4接管出站流量情况如下 "
|
||||||
|
blue " ${WARPIPv4Status}"
|
||||||
|
white "------------------------------------------------------------------------------------------------"
|
||||||
|
white " 当前VPS IPV6接管出站流量情况如下"
|
||||||
|
blue " ${WARPIPv6Status}"
|
||||||
|
white "------------------------------------------------------------------------------------------------"
|
||||||
|
}
|
||||||
|
S5menu(){
|
||||||
|
white "------------------------------------------------------------------------------------------------"
|
||||||
|
white " 当前Socks5-WARP客户端本地代理127.0.0.1情况如下"
|
||||||
|
blue " ${S5Status}"
|
||||||
|
white "------------------------------------------------------------------------------------------------"
|
||||||
|
}
|
||||||
|
back(){
|
||||||
|
white "------------------------------------------------------------------------------------------------"
|
||||||
|
white " 回主菜单,请按任意键"
|
||||||
|
white " 退出脚本,请按Ctrl+C"
|
||||||
|
get_char && bash CFwarp.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
IP_Status_menu(){
|
||||||
|
white "------------------------------------------------------------------------------------------------"
|
||||||
|
WGCFmenu;S5menu
|
||||||
|
}
|
||||||
|
|
||||||
|
menu(){
|
||||||
|
green "rwkgyg-CFwarp脚本快捷键使用指南"
|
||||||
|
green "注意:进入实时显示Screen状态后,退出当前Screen界面:Ctrl+a+d 终止当前Screen运行:Ctrl+c "
|
||||||
|
yellow "------------------------------------------"
|
||||||
|
blue "cf wd : Wgcf-warp临时关闭"
|
||||||
|
blue "cf wu : Wgcf-warp开启"
|
||||||
|
blue "cf wr : Wgcf-warp重新启动"
|
||||||
|
blue "cf 5d : Socks5-warp临时关闭"
|
||||||
|
blue "cf 5u : Socks5-warp开启"
|
||||||
|
blue "cf sup : 实时显示Screen运行状态:Wgcf-warp进程守护"
|
||||||
|
blue "cf saw : 实时显示Screen运行状态:刷Netflix奈飞及区域的warp"
|
||||||
|
blue "cf scr : 实时显示Screen运行状态:刷指定区域的warp"
|
||||||
|
blue "cf scp : 实时显示Screen运行状态:刷指定IP段的warp"
|
||||||
|
blue "cf : 显示CFwarp主菜单"
|
||||||
|
blue "cf h : 显示CFwarp快捷键使用指南"
|
||||||
|
yellow "------------------------------------------"
|
||||||
|
}
|
||||||
|
|
||||||
|
lncf(){
|
||||||
|
if [[ $(type -P wg-quick) || $(type -P warp-cli) ]]; then
|
||||||
|
chmod +x /root/CFwarp.sh
|
||||||
|
ln -sf /root/CFwarp.sh /usr/bin/cf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
checkwgcf(){
|
||||||
|
wgcfv6=$(curl -s6m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
wgcfv4=$(curl -s4m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
}
|
||||||
|
CheckWARP(){
|
||||||
|
i=0
|
||||||
|
wg-quick down wgcf >/dev/null 2>&1
|
||||||
|
systemctl start wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
while [ $i -le 4 ]; do let i++
|
||||||
|
yellow "共执行5次,第$i次获取WARP的IP中……"
|
||||||
|
systemctl restart wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
checkwgcf
|
||||||
|
[[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && green "恭喜!WARP的IP获取成功!" && break || red "遗憾!WARP的IP获取失败"
|
||||||
|
done
|
||||||
|
checkwgcf
|
||||||
|
if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then
|
||||||
|
yellow "安装WARP失败,还原VPS,卸载Wgcf-WARP组件中……"
|
||||||
|
cwg
|
||||||
|
green "卸载Wgcf-WARP组件完成"
|
||||||
|
green "失败建议如下:"
|
||||||
|
[[ $release = Centos && ${vsid} -lt 7 ]] && yellow "当前系统版本号:Centos $vsid \n建议使用 Centos 7 以上系统 "
|
||||||
|
[[ $release = Ubuntu && ${vsid} -lt 18 ]] && yellow "当前系统版本号:Ubuntu $vsid \n建议使用 Ubuntu 18 以上系统 "
|
||||||
|
[[ $release = Debian && ${vsid} -lt 10 ]] && yellow "当前系统版本号:Debian $vsid \n建议使用 Debian 10 以上系统 "
|
||||||
|
yellow "1、强烈建议使用官方源升级系统及内核加速!如已使用第三方源及内核加速,请务必更新到最新版,或重置为官方源"
|
||||||
|
yellow "2、部分VPS系统极度精简,相关依赖需自行安装后再尝试"
|
||||||
|
yellow "3、查看https://www.cloudflarestatus.com/,你当前VPS就近区域可能处于黄色的【Re-routed】状态"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
screen -d >/dev/null 2>&1
|
||||||
|
[[ -e /root/check.sh ]] && screen -S aw -X quit ; screen -UdmS aw bash -c '/bin/bash /root/check.sh'
|
||||||
|
[[ -e /root/WARP-CR.sh ]] && screen -S cr -X quit ; screen -UdmS cr bash -c '/bin/bash /root/WARP-CR.sh'
|
||||||
|
[[ -e /root/WARP-CP.sh ]] && screen -S cp -X quit ; screen -UdmS cp bash -c '/bin/bash /root/WARP-CP.sh'
|
||||||
|
if [[ -e /root/WARP-UP.sh ]]; then
|
||||||
|
screen -S up -X quit ; screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh'
|
||||||
|
else
|
||||||
|
readtp "是否安装WARP在线监测守护进程(Y/y)?(5秒后默认为N,不安装):" warpup
|
||||||
|
echo
|
||||||
|
if [[ $warpup = [Yy] ]]; then
|
||||||
|
cat>/root/WARP-UP.sh<<-\EOF
|
||||||
|
#!/bin/bash
|
||||||
|
red(){ echo -e "\033[31m\033[01m$1\033[0m";}
|
||||||
|
green(){ echo -e "\033[32m\033[01m$1\033[0m";}
|
||||||
|
checkwgcf(){
|
||||||
|
wgcfv6=$(curl -s6m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
wgcfv4=$(curl -s4m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
}
|
||||||
|
warpclose(){
|
||||||
|
wg-quick down wgcf >/dev/null 2>&1 ; systemctl stop wg-quick@wgcf >/dev/null 2>&1 ; systemctl disable wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
warpopen(){
|
||||||
|
wg-quick down wgcf >/dev/null 2>&1 ; systemctl enable wg-quick@wgcf >/dev/null 2>&1 ; systemctl start wg-quick@wgcf >/dev/null 2>&1 ; systemctl restart wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
warpre(){
|
||||||
|
i=0
|
||||||
|
while [ $i -le 4 ]; do let i++
|
||||||
|
warpopen
|
||||||
|
checkwgcf
|
||||||
|
[[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && green "中断后的WARP尝试获取IP成功!" && break || red "中断后的WARP尝试获取IP失败!"
|
||||||
|
done
|
||||||
|
checkwgcf
|
||||||
|
if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then
|
||||||
|
warpclose
|
||||||
|
red "由于5次尝试获取WARP的IP失败,现执行停止并关闭WARP,VPS恢复原IP状态"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
while true; do
|
||||||
|
green "检测WARP是否启动中…………"
|
||||||
|
checkwgcf
|
||||||
|
[[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && green "恭喜!WARP状态为运行中!下轮检测将在你设置的60秒后自动执行" && sleep 60s || (warpre ; green "下轮检测将在你设置的50秒后自动执行" ; sleep 50s)
|
||||||
|
done
|
||||||
|
EOF
|
||||||
|
readp "WARP状态为运行时,重新检测WARP状态间隔时间(回车默认60秒),请输入间隔时间(例:50秒,输入50):" stop
|
||||||
|
[[ -n $stop ]] && sed -i "s/60s/${stop}s/g;s/60秒/${stop}秒/g" /root/WARP-UP.sh || green "默认间隔60秒"
|
||||||
|
readp "WARP状态为中断时(连续5次失败自动关闭WARP),继续检测WARP状态间隔时间(回车默认50秒),请输入间隔时间(例:50秒,输入50):" goon
|
||||||
|
[[ -n $goon ]] && sed -i "s/50s/${goon}s/g;s/50秒/${goon}秒/g" /root/WARP-UP.sh || green "默认间隔50秒"
|
||||||
|
[[ -e /root/WARP-UP.sh ]] && screen -S up -X quit ; screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh'
|
||||||
|
green "设置screen窗口名称'up',离线后台WARP在线守护进程" && sleep 2
|
||||||
|
grep -qE "^ *@reboot root screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh' >/dev/null 2>&1" /etc/crontab || echo "@reboot root screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh' >/dev/null 2>&1" >> /etc/crontab
|
||||||
|
green "添加WARP在线守护进程功能,重启VPS也会自动生效"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
dns(){
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
echo -e "nameserver 2001:4860:4860::8888\nnameserver 8.8.8.8" > /etc/resolv.conf
|
||||||
|
else
|
||||||
|
echo -e "nameserver 8.8.8.8\nnameserver 2001:4860:4860::8888" > /etc/resolv.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
dig9(){
|
||||||
|
if [[ -n $(grep 'DiG 9' /etc/hosts) ]]; then
|
||||||
|
echo -e "search blue.kundencontroller.de\noptions rotate\nnameserver 2a02:180:6:5::1c\nnameserver 2a02:180:6:5::4\nnameserver 2a02:180:6:5::1e\nnameserver 2a02:180:6:5::1d" > /etc/resolv.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_char(){
|
||||||
|
SAVEDSTTY=`stty -g`
|
||||||
|
stty -echo
|
||||||
|
stty cbreak
|
||||||
|
dd if=/dev/tty bs=1 count=1 2> /dev/null
|
||||||
|
stty -raw
|
||||||
|
stty echo
|
||||||
|
stty $SAVEDSTTY
|
||||||
|
}
|
||||||
|
|
||||||
|
WGCFins(){
|
||||||
|
rm -rf /usr/local/bin/wgcf /etc/wireguard/wgcf.conf /etc/wireguard/wgcf-profile.conf /etc/wireguard/wgcf-account.toml /etc/wireguard/wgcf+p.log /etc/wireguard/ID /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf
|
||||||
|
ShowWGCF
|
||||||
|
if [[ $release = Centos ]]; then
|
||||||
|
if [[ ${vsid} =~ 8 ]]; then
|
||||||
|
cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/
|
||||||
|
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
|
||||||
|
sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*
|
||||||
|
sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
|
||||||
|
yum clean all && yum makecache
|
||||||
|
fi
|
||||||
|
yum install epel-release -y;yum install iproute iptables wireguard-tools -y
|
||||||
|
elif [[ $release = Debian ]]; then
|
||||||
|
apt install lsb-release -y
|
||||||
|
echo "deb http://deb.debian.org/debian $(lsb_release -sc)-backports main" | tee /etc/apt/sources.list.d/backports.list
|
||||||
|
apt update -y;apt install iproute2 openresolv dnsutils iptables -y;apt install wireguard-tools --no-install-recommends -y
|
||||||
|
elif [[ $release = Ubuntu ]]; then
|
||||||
|
apt update -y;apt install iproute2 openresolv dnsutils iptables -y;apt install wireguard-tools --no-install-recommends -y
|
||||||
|
fi
|
||||||
|
[[ $cpu = AMD64 ]] && wget -N https://gitlab.com/rwkgyg/cfwarp/raw/main/wgcf_2.2.15_amd64 -O /usr/local/bin/wgcf && chmod +x /usr/local/bin/wgcf
|
||||||
|
[[ $cpu = ARM64 ]] && wget -N https://gitlab.com/rwkgyg/cfwarp/raw/main/wgcf_2.2.15_arm64 -O /usr/local/bin/wgcf && chmod +x /usr/local/bin/wgcf
|
||||||
|
if [[ $main -lt 5 || $minor -lt 6 ]] || [[ $vi =~ lxc|openvz ]]; then
|
||||||
|
[[ -e /usr/bin/wireguard-go ]] || wget -N https://gitlab.com/rwkgyg/cfwarp/raw/main/wireguard-go -O /usr/bin/wireguard-go && chmod +x /usr/bin/wireguard-go
|
||||||
|
fi
|
||||||
|
echo | wgcf register
|
||||||
|
until [[ -e wgcf-account.toml ]]
|
||||||
|
do
|
||||||
|
yellow "申请WARP普通账户过程中可能会多次提示:429 Too Many Requests,请等待30秒" && sleep 1
|
||||||
|
echo | wgcf register
|
||||||
|
done
|
||||||
|
wgcf generate
|
||||||
|
yellow "开始自动设置WARP的MTU最佳网络吞吐量值,以优化WARP网络!"
|
||||||
|
MTUy=1500
|
||||||
|
MTUc=10
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
ping='ping6'
|
||||||
|
IP1='2606:4700:4700::1111'
|
||||||
|
IP2='2001:4860:4860::8888'
|
||||||
|
else
|
||||||
|
ping='ping'
|
||||||
|
IP1='1.1.1.1'
|
||||||
|
IP2='8.8.8.8'
|
||||||
|
fi
|
||||||
|
while true; do
|
||||||
|
if ${ping} -c1 -W1 -s$((${MTUy} - 28)) -Mdo ${IP1} >/dev/null 2>&1 || ${ping} -c1 -W1 -s$((${MTUy} - 28)) -Mdo ${IP2} >/dev/null 2>&1; then
|
||||||
|
MTUc=1
|
||||||
|
MTUy=$((${MTUy} + ${MTUc}))
|
||||||
|
else
|
||||||
|
MTUy=$((${MTUy} - ${MTUc}))
|
||||||
|
[[ ${MTUc} = 1 ]] && break
|
||||||
|
fi
|
||||||
|
[[ ${MTUy} -le 1360 ]] && MTUy='1360' && break
|
||||||
|
done
|
||||||
|
MTU=$((${MTUy} - 80))
|
||||||
|
green "MTU最佳网络吞吐量值= $MTU 已设置完毕"
|
||||||
|
sed -i "s/MTU.*/MTU = $MTU/g" wgcf-profile.conf
|
||||||
|
cp -f wgcf-profile.conf /etc/wireguard/wgcf.conf >/dev/null 2>&1
|
||||||
|
echo $ABC1 | sh
|
||||||
|
echo $ABC2 | sh
|
||||||
|
echo $ABC3 | sh
|
||||||
|
echo $ABC4 | sh
|
||||||
|
mv -f wgcf-profile.conf /etc/wireguard >/dev/null 2>&1
|
||||||
|
mv -f wgcf-account.toml /etc/wireguard >/dev/null 2>&1
|
||||||
|
systemctl enable wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
CheckWARP
|
||||||
|
ShowWGCF && WGCFmenu && lncf && menu
|
||||||
|
}
|
||||||
|
|
||||||
|
SOCKS5ins(){
|
||||||
|
yellow "检测Socks5-WARP安装环境中……"
|
||||||
|
if [[ $release = Centos ]]; then
|
||||||
|
[[ ! ${vsid} =~ 8 ]] && yellow "当前系统版本号:Centos $vsid \nSocks5-WARP仅支持Centos 8 " && bash CFwarp.sh
|
||||||
|
elif [[ $release = Ubuntu ]]; then
|
||||||
|
[[ ! ${vsid} =~ 16|18|20 ]] && yellow "当前系统版本号:Ubuntu $vsid \nSocks5-WARP仅支持 Ubuntu 16.04/18.04/20.04系统 " && bash CFwarp.sh
|
||||||
|
elif [[ $release = Debian ]]; then
|
||||||
|
[[ ! ${vsid} =~ 9|10|11 ]] && yellow "当前系统版本号:Debian $vsid \nSocks5-WARP仅支持 Debian 9/10/11系统 " && bash CFwarp.sh
|
||||||
|
fi
|
||||||
|
[[ $(warp-cli --accept-tos status 2>/dev/null) =~ 'Connected' ]] && red "当前Socks5-WARP已经在运行中" && bash CFwarp.sh
|
||||||
|
systemctl stop wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
v4v6
|
||||||
|
if [[ -n $v6 && -z $v4 ]]; then
|
||||||
|
systemctl start wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
red "纯IPV6的VPS目前不支持安装Socks5-WARP" && bash CFwarp.sh
|
||||||
|
elif [[ -n $v4 && -z $v6 ]]; then
|
||||||
|
systemctl start wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
checkwgcf
|
||||||
|
[[ $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]] && red "纯IPV4的VPS已安装Wgcf-WARP-IPV4(选项1),不支持安装Socks5-WARP" && bash CFwarp.sh
|
||||||
|
elif [[ -n $v4 && -n $v6 ]]; then
|
||||||
|
systemctl start wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
checkwgcf
|
||||||
|
[[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && red "原生双栈VPS已安装Wgcf-WARP-IPV4/IPV6(选项1或选项2),请先卸载。然后安装Socks5-WARP,最后安装Wgcf-WARP-IPV4/IPV6" && bash CFwarp.sh
|
||||||
|
fi
|
||||||
|
systemctl start wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
checkwgcf
|
||||||
|
[[ $wgcfv4 =~ on|plus && $wgcfv6 =~ on|plus ]] && red "已安装Wgcf-WARP-IPV4+IPV6(选项3),不支持安装Socks5-WARP" && bash CFwarp.sh
|
||||||
|
if [[ $release = Centos ]]; then
|
||||||
|
if [[ ${vsid} =~ 8 ]]; then
|
||||||
|
cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/
|
||||||
|
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
|
||||||
|
sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*
|
||||||
|
sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
|
||||||
|
yum clean all && yum makecache
|
||||||
|
fi
|
||||||
|
yum -y install epel-release && yum -y install net-tools
|
||||||
|
rpm -ivh https://pkg.cloudflareclient.com/cloudflare-release-el8.rpm
|
||||||
|
yum -y install cloudflare-warp
|
||||||
|
fi
|
||||||
|
if [[ $release = Debian ]]; then
|
||||||
|
[[ ! $(type -P gpg) ]] && apt update && apt install gnupg -y
|
||||||
|
[[ ! $(apt list 2>/dev/null | grep apt-transport-https | grep installed) ]] && apt update && apt install apt-transport-https -y
|
||||||
|
fi
|
||||||
|
if [[ $release != Centos ]]; then
|
||||||
|
apt install net-tools -y
|
||||||
|
curl https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
|
||||||
|
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] http://pkg.cloudflareclient.com/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/cloudflare-client.list
|
||||||
|
apt update;apt install cloudflare-warp -y
|
||||||
|
fi
|
||||||
|
warp-cli --accept-tos register >/dev/null 2>&1 && sleep 2
|
||||||
|
warp-cli --accept-tos set-mode proxy >/dev/null 2>&1
|
||||||
|
warp-cli --accept-tos enable-always-on >/dev/null 2>&1
|
||||||
|
sleep 2 && ShowSOCKS5
|
||||||
|
[[ -e /root/check.sh ]] && screen -S aw -X quit ; screen -UdmS aw bash -c '/bin/bash /root/check.sh'
|
||||||
|
[[ -e /root/WARP-CR.sh ]] && screen -S cr -X quit ; screen -UdmS cr bash -c '/bin/bash /root/WARP-CR.sh'
|
||||||
|
[[ -e /root/WARP-CP.sh ]] && screen -S cp -X quit ; screen -UdmS cp bash -c '/bin/bash /root/WARP-CP.sh'
|
||||||
|
S5menu && lncf && menu
|
||||||
|
}
|
||||||
|
|
||||||
|
WARPup(){
|
||||||
|
ab="1.升级Wgcf-WARP+账户\n2.升级Socks5-WARP+账户\n3.更换Socks5端口\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 )
|
||||||
|
[[ ! $(type -P wg-quick) ]] && red "未安装Wgcf-WARP,无法升级到Wgcf-WARP+账户" && bash CFwarp.sh
|
||||||
|
ShowWGCF
|
||||||
|
[[ $wgcfv4 = plus || $wgcfv6 = plus ]] && red "当前已是Wgcf-WARP+账户,无须再升级" && bash CFwarp.sh
|
||||||
|
cd /etc/wireguard
|
||||||
|
readp "按键许可证秘钥(26个字符):" ID
|
||||||
|
[[ -n $ID ]] && sed -i "s/license_key.*/license_key = \"$ID\"/g" wgcf-account.toml && readp "设备名称重命名(直接回车随机命名):" sbmc || (red "未输入按键许可证秘钥(26个字符)" && bash CFwarp.sh)
|
||||||
|
[[ -n $sbmc ]] && SBID="--name $(echo $sbmc | sed s/[[:space:]]/_/g)"
|
||||||
|
wgcf update $SBID > /etc/wireguard/wgcf+p.log 2>&1
|
||||||
|
wgcf generate
|
||||||
|
sed -i "2s#.*#$(sed -ne 2p wgcf-profile.conf)#;4s#.*#$(sed -ne 4p wgcf-profile.conf)#" wgcf.conf
|
||||||
|
checkwgcf
|
||||||
|
[[ $wgcfv4 = plus || $wgcfv6 = plus ]] && green "已升级为Wgcf-WARP+账户\nWgcf-WARP+账户设备名称:$(grep -s 'Device name' /etc/wireguard/wgcf+p.log | awk '{ print $NF }')\nWgcf-WARP+账户剩余流量:$(grep -s Quota /etc/wireguard/wgcf+p.log | awk '{ print $(NF-1), $NF }')"
|
||||||
|
ShowWGCF && WGCFmenu && back;;
|
||||||
|
2 )
|
||||||
|
[[ ! $(type -P warp-cli) ]] && red "未安装Socks5-WARP,无法升级到Socks5-WARP+账户" && bash CFwarp.sh
|
||||||
|
[[ $(warp-cli --accept-tos account) =~ 'Limited' ]] && red "当前已是Socks5-WARP+账户,无须再升级" && bash CFwarp.sh
|
||||||
|
mkdir -p /etc/wireguard/ >/dev/null 2>&1
|
||||||
|
readp "按键许可证秘钥(26个字符):" ID
|
||||||
|
[[ -n $ID ]] && warp-cli --accept-tos set-license $ID >/dev/null 2>&1 || (red "未输入按键许可证秘钥(26个字符)" && bash CFwarp.sh)
|
||||||
|
yellow "如提示Error: Too many devices.说明超过了最多绑定4台设备限制"
|
||||||
|
[[ $(warp-cli --accept-tos account) =~ 'Limited' ]] && green "已升级为Socks5-WARP+账户\nSocks5-WARP+账户剩余流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000))GB" && echo $ID >/etc/wireguard/ID
|
||||||
|
ShowSOCKS5 && S5menu && back;;
|
||||||
|
3 )
|
||||||
|
[[ ! $(type -P warp-cli) ]] && red "未安装Socks5-WARP(+),无法更改端口" && bash CFwarp.sh
|
||||||
|
if readp "请输入自定义socks5端口(1024~65535):" port ; then
|
||||||
|
if [[ -n $(netstat -ntlp | grep "$port") ]]; then
|
||||||
|
until [[ -z $(netstat -ntlp | grep "$port") ]]
|
||||||
|
do
|
||||||
|
[[ -n $(netstat -ntlp | grep "$port") ]] && yellow "\n端口被占用,请重新输入端口" && readp "自定义Socks5端口:" port
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
[[ -n $port ]] && warp-cli --accept-tos set-proxy-port $port >/dev/null 2>&1
|
||||||
|
ShowSOCKS5 && S5menu && back;;
|
||||||
|
0 ) WARPupre
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
WARPupre(){
|
||||||
|
ab="1.Wgcf-WARP(+)账户升级到Teams账户\n2.Wgcf-WARP升级到WARP+账户、Wgcf-Socks5升级到WARP+账户、更换Socks5端口\n3.在线前台刷WARP+普通账户流量\n4.离线后台刷WARP+普通账户流量\n5.screen管理设置\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 )
|
||||||
|
[[ ! -e /etc/wireguard/wgcf.conf ]] && red "无法找到Wgcf-WARP(+)配置文件,建议重装Wgcf-WARP(+)" && bash CFwarp.sh
|
||||||
|
readp "请复制privateKey(44个字符):" Key
|
||||||
|
readp "请复制IPV6的Address:" Add
|
||||||
|
if [[ -n $Key && -n $Add ]]; then
|
||||||
|
sed -i "s#PrivateKey.*#PrivateKey = $Key#g;s#Address.*128#Address = $Add/128#g" /etc/wireguard/wgcf.conf
|
||||||
|
systemctl restart wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
checkwgcf
|
||||||
|
if [[ $wgcfv4 = plus || $wgcfv6 = plus ]]; then
|
||||||
|
rm -rf /etc/wireguard/wgcf+p.log && green "Wgcf-WARP+Teams账户已生效" && ShowWGCF && WGCFmenu && back
|
||||||
|
else
|
||||||
|
red "开启Wgcf-WARP+Teams账户失败,恢复使用WARP普通账户" && cp -f /etc/wireguard/wgcf-profile.conf /etc/wireguard/wgcf.conf >/dev/null 2>&1 && systemctl restart wg-quick@wgcf && ShowWGCF && WGCFmenu && back
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
red "未复制privateKey或Address,恢复使用WARP普通账户" && cp -f /etc/wireguard/wgcf-profile.conf /etc/wireguard/wgcf.conf >/dev/null 2>&1 && systemctl restart wg-quick@wgcf && ShowWGCF && WGCFmenu && back
|
||||||
|
fi;;
|
||||||
|
2 ) WARPup;;
|
||||||
|
3 ) wget -N --no-check-certificate https://cdn.jsdelivr.net/gh/ALIILAPRO/warp-plus-cloudflare/wp-plus.py && python3 wp-plus.py;;
|
||||||
|
4 )
|
||||||
|
wget -N --no-check-certificate https://cdn.jsdelivr.net/gh/ALIILAPRO/warp-plus-cloudflare/wp-plus.py
|
||||||
|
sed -i "27 s/[(][^)]*[)]//g" wp-plus.py
|
||||||
|
readp "客户端配置ID(36个字符):" ID
|
||||||
|
sed -i "27 s/input/'$ID'/" wp-plus.py
|
||||||
|
readp "设置screen窗口名称,回车默认名称为'wp':" wpp
|
||||||
|
[[ -z $wpp ]] && wpp='wp'
|
||||||
|
screen -UdmS $wpp bash -c '/usr/bin/python3 /root/wp-plus.py' && back;;
|
||||||
|
5 ) wget -N https://gitlab.com/rwkgyg/screen-script/raw/main/screen.sh && bash screen.sh && back;;
|
||||||
|
0 ) bash CFwarp.sh
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
ReIP(){
|
||||||
|
ab="1.手动刷新Wgcf-WARP(+)奈飞IP\n2.手动刷新Socks5-WARP(+)奈飞IP\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 )
|
||||||
|
[[ ! $(type -P wg-quick) ]] && red "未安装Wgcf-WARP(+),无法刷新IP" && bash CFwarp.sh
|
||||||
|
ShowWGCF
|
||||||
|
ab="1.刷新IPV4的奈飞IP\n2.刷新IPV6的奈飞IP\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 )
|
||||||
|
[[ $wgcfv4 = plus || $wgcfv4 = on ]] || (yellow "未开启Wgcf-WARP(+)-IPV4" && bash CFwarp.sh)
|
||||||
|
i=0
|
||||||
|
yellow "共刷新10次IP"
|
||||||
|
while [ $i -le 9 ]; do let i++
|
||||||
|
ShowWGCF
|
||||||
|
[[ "$result4" == "200" ]] && yellow "第$i次刷新IP \c" && green "恭喜,此IP:$v4 支持奈飞" && break || (yellow "第$i次刷新IP \c" && CheckWARP && red "当前IP:$v4 $NF" && sleep 3)
|
||||||
|
done
|
||||||
|
ShowWGCF && WGCFmenu && back;;
|
||||||
|
2 )
|
||||||
|
[[ $wgcfv6 = plus || $wgcfv6 = on ]] || (yellow "未开启Wgcf-WARP(+)-IPV6" && bash CFwarp.sh)
|
||||||
|
i=0
|
||||||
|
yellow "共刷新10次IP"
|
||||||
|
while [ $i -le 9 ]; do let i++
|
||||||
|
ShowWGCF
|
||||||
|
[[ "$result6" == "200" ]] && yellow "第$i次刷新IP \c" && green "恭喜,此IP:$v6 支持奈飞" && break || (yellow "第$i次刷新IP \c" && CheckWARP && red "当前IP:$v6 $NF" && sleep 3)
|
||||||
|
done
|
||||||
|
ShowWGCF && WGCFmenu && back;;
|
||||||
|
0 ) ReIP
|
||||||
|
esac;;
|
||||||
|
2 )
|
||||||
|
[[ ! $(type -P warp-cli) ]] && red "未安装Socks5-WARP(+),无法刷新IP" && bash CFwarp.sh
|
||||||
|
s5c(){
|
||||||
|
warp-cli --accept-tos register >/dev/null 2>&1 && sleep 2
|
||||||
|
[[ -e /etc/wireguard/ID ]] && warp-cli --accept-tos set-license $(cat /etc/wireguard/ID) >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
i=0
|
||||||
|
yellow "共刷新10次IP"
|
||||||
|
while [ $i -le 9 ]; do let i++
|
||||||
|
ShowSOCKS5
|
||||||
|
[[ "$result" == "200" ]] && yellow "第$i次刷新IP \c" && green "恭喜,此IP:$s5ip 支持奈飞" && break || (yellow "第$i次刷新IP \c" && s5c && red "当前IP:$s5i $NF" && sleep 3)
|
||||||
|
done
|
||||||
|
ShowSOCKS5 && S5menu && back;;
|
||||||
|
0 ) REnfwarp
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
Rewarp(){
|
||||||
|
ab="1.启用:离线后台+重启VPS后screen后台自动刷NF功能\n2.启用:离线后台+重启VPS后screen后台自动刷区域IP功能\n3.启用:离线后台+重启VPS后screen后台自动刷Wgcf-IPV4的IP段功能\n4.关闭:重启VPS自动刷奈飞IP或区域IP功能\n(离线Screen窗口请在Screen管理设置中删除)\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 )
|
||||||
|
[[ -e /root/WARP-CR.sh || -e /root/WARP-CP.sh ]] && yellow "经检测,你正在使用其他刷IP功能,请关闭它后再执行" && REnfwarp
|
||||||
|
screen -d >/dev/null 2>&1
|
||||||
|
wget -N --no-check-certificate https://gitlab.com/rwkgyg/cfwarp/raw/main/check.sh
|
||||||
|
readp "输入国家区域简称(例:新加坡,输入大写SG;美国,输入大写US):" gj
|
||||||
|
[[ -n $gj ]] && sed -i "s/dd/$gj/g" check.sh || (sed -i "s/dd/\$region/g" check.sh && green "当前设置WARP默认随机分配的国家区域: $g4 ")
|
||||||
|
readp "已是奈飞IP或者指定IP区域时,重新检测间隔时间(回车默认45秒),请输入间隔时间(例:50秒,输入50):" stop
|
||||||
|
[[ -n $stop ]] && sed -i "s/45s/${stop}s/g;s/45秒/${stop}秒/g" check.sh || green "默认间隔45秒"
|
||||||
|
readp "非奈飞IP或者非指定IP区域时,继续检测间隔时间(回车默认30秒),请输入间隔时间(例:50秒,输入50):" goon
|
||||||
|
[[ -n $goon ]] && sed -i "s/30s/${goon}s/g;s/30秒/${goon}秒/g" check.sh || green "默认间隔30秒"
|
||||||
|
[[ -e /root/check.sh ]] && screen -S aw -X quit ; screen -UdmS aw bash -c '/bin/bash /root/check.sh'
|
||||||
|
green "设置screen窗口名称'aw',离线后台自动刷奈飞IP" && sleep 2
|
||||||
|
grep -qE "^ *@reboot root screen -UdmS aw bash -c '/bin/bash /root/check.sh' >/dev/null 2>&1" /etc/crontab || echo "@reboot root screen -UdmS aw bash -c '/bin/bash /root/check.sh' >/dev/null 2>&1" >> /etc/crontab
|
||||||
|
green "添加VPS重启后screen后台自动刷奈飞IP功能,重启VPS后自动生效"
|
||||||
|
back;;
|
||||||
|
2 )
|
||||||
|
[[ -e /root/WARP-CP.sh || -e /root/check.sh ]] && yellow "经检测,你正在使用其他刷IP功能,请关闭它后再执行" && REnfwarp
|
||||||
|
screen -d >/dev/null 2>&1
|
||||||
|
wget -N --no-check-certificate https://gitlab.com/rwkgyg/cfwarp/raw/main/WARP-CR.sh
|
||||||
|
readp "输入国家区域简称(例:新加坡,输入大写SG;美国,输入大写US):" gj
|
||||||
|
[[ -n $gj ]] && sed -i "s/dd4/$gj/g" WARP-CR.sh || (sed -i "s/dd4/\$eg4/g" WARP-CR.sh && green "IPV4当前设置WARP默认分配的国家区域: $g4 ")
|
||||||
|
[[ -n $gj ]] && sed -i "s/dd6/$gj/g" WARP-CR.sh || (sed -i "s/dd6/\$eg6/g" WARP-CR.sh && green "IPV6当前设置WARP默认分配的国家区域: $g6 ")
|
||||||
|
[[ -n $gj ]] && sed -i "s/ddj/$gj/g" WARP-CR.sh || (sed -i "s/ddj/\$egj/g" WARP-CR.sh && green "Socks5当前设置WARP默认分配的国家区域: $s5gj ")
|
||||||
|
readp "已是指定IP区域时,重新检测间隔时间(回车默认60秒),请输入间隔时间(例:50秒,输入50):" stop
|
||||||
|
[[ -n $stop ]] && sed -i "s/60s/${stop}s/g;s/60秒/${stop}秒/g" WARP-CR.sh || green "默认间隔60秒"
|
||||||
|
readp "非指定IP区域时,重新检测间隔时间(回车默认30秒),请输入间隔时间(例:50秒,输入50):" goon
|
||||||
|
[[ -n $goon ]] && sed -i "s/30s/${goon}s/g;s/30秒/${goon}秒/g" WARP-CR.sh || green "默认间隔30秒"
|
||||||
|
[[ -e /root/WARP-CR.sh ]] && screen -S cr -X quit ; screen -UdmS cr bash -c '/bin/bash /root/WARP-CR.sh'
|
||||||
|
green "设置screen窗口名称'cr',离线后台自动刷WARP指定区域IP" && sleep 2
|
||||||
|
grep -qE "^ *@reboot root screen -UdmS cr bash -c '/bin/bash /root/WARP-CR.sh' >/dev/null 2>&1" /etc/crontab || echo "@reboot root screen -UdmS cr bash -c '/bin/bash /root/WARP-CR.sh' >/dev/null 2>&1" >> /etc/crontab
|
||||||
|
green "添加VPS重启后screen后台自动刷IP功能,重启VPS后自动生效"
|
||||||
|
back;;
|
||||||
|
3 )
|
||||||
|
[[ -e /root/WARP-CR.sh || -e /root/check.sh ]] && yellow "经检测,你正在使用其他刷IP功能,请关闭它后再执行" && REnfwarp
|
||||||
|
wgcfv4=$(curl -s4m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
[[ ! $wgcfv4 =~ on|plus ]] && yellow "当前Wgcf-IPV4未开启" && bash CFwarp.sh
|
||||||
|
screen -d >/dev/null 2>&1
|
||||||
|
wget -N --no-check-certificate https://gitlab.com/rwkgyg/cfwarp/raw/main/WARP-CP.sh
|
||||||
|
readp "输入WARP-IPV4的第二段.第三段的IP段(例:8.45.46.123 , 输入 45.46 ):" gj
|
||||||
|
[[ -n $gj ]] && sed -i "s/ipd/$gj/g" WARP-CP.sh || (sed -i "s/ipd/\$v4d/g" WARP-CP.sh && green "未输入,使用当前WARP默认IP段$(curl -s4m3 https://ip.gs -k | awk -F '.' '{print $2"."$3}')")
|
||||||
|
readp "已刷到设置的IP段时,重新检测间隔时间(回车默认60秒),请输入间隔时间(例:50秒,输入50):" stop
|
||||||
|
[[ -n $stop ]] && sed -i "s/60s/${stop}s/g;s/60秒/${stop}秒/g" WARP-CP.sh || green "默认间隔60秒"
|
||||||
|
readp "未刷到设置的IP段时,继续检测间隔时间(回车默认20秒),请输入间隔时间(例:50秒,输入50):" goon
|
||||||
|
[[ -n $goon ]] && sed -i "s/20s/${goon}s/g;s/20秒/${goon}秒/g" WARP-CP.sh || green "默认间隔20秒"
|
||||||
|
[[ -e /root/WARP-CP.sh ]] && screen -S cp -X quit ; screen -UdmS cp bash -c '/bin/bash /root/WARP-CP.sh'
|
||||||
|
green "设置screen窗口名称'cp',离线后台自动WARP的IP段" && sleep 2
|
||||||
|
grep -qE "^ *@reboot root screen -UdmS cp bash -c '/bin/bash /root/WARP-CP.sh' >/dev/null 2>&1" /etc/crontab || echo "@reboot root screen -UdmS cp bash -c '/bin/bash /root/WARP-CP.sh' >/dev/null 2>&1" >> /etc/crontab
|
||||||
|
green "添加VPS重启后screen后台自动刷WARP的IP段功能,重启VPS后自动生效"
|
||||||
|
back;;
|
||||||
|
4 )
|
||||||
|
sed -i '/check.sh/d' /etc/crontab ; sed -i '/WARP-CR.sh/d' /etc/crontab ; sed -i '/WARP-CP.sh/d' /etc/crontab
|
||||||
|
rm -rf check.sh WARP-CR.sh WARP-CP.sh
|
||||||
|
green "卸载完成";;
|
||||||
|
0 ) REnfwarp
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
REnfwarp(){
|
||||||
|
ab="1.在线前台临时刷奈飞NF\n2.离线后台+重启VPS后screen后台自动刷奈飞NF、WARP区域、Wgcf-IPV4的IP段三大功能\n3.screen管理设置\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 ) ReIP;;
|
||||||
|
2 ) Rewarp;;
|
||||||
|
3 ) wget -N https://gitlab.com/rwkgyg/screen-script/raw/main/screen.sh && bash screen.sh && back;;
|
||||||
|
0 ) bash CFwarp.sh
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
WARPonoff(){
|
||||||
|
ab="1.开启或者完全关闭Wgcf-WARP(+)\n2.开启或完全关闭Socks5-WARP(+)\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 )
|
||||||
|
[[ ! $(type -P wg-quick) ]] && red "Wgcf-WARP(+)未安装,无法启动或关闭,建议重新安装Wgcf-WARP(+)" && bash CFwarp.sh
|
||||||
|
checkwgcf
|
||||||
|
if [[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]]; then
|
||||||
|
yellow "当前Wgcf-WARP(+)状态:已运行中,现执行:完全关闭……"
|
||||||
|
rm -rf WARP-UP.sh
|
||||||
|
sed -i '/WARP-UP.sh/d' /etc/crontab >/dev/null 2>&1
|
||||||
|
wg-quick down wgcf >/dev/null 2>&1
|
||||||
|
systemctl disable wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
checkwgcf
|
||||||
|
[[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]] && green "关闭Wgcf-WARP(+)成功" || red "关闭Wgcf-WARP(+)失败"
|
||||||
|
elif [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then
|
||||||
|
yellow "当前Wgcf-WARP(+)为完全关闭状态,现执行:恢复运行……"
|
||||||
|
systemctl enable wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
CheckWARP
|
||||||
|
fi
|
||||||
|
ShowWGCF && WGCFmenu && back;;
|
||||||
|
2 )
|
||||||
|
[[ ! $(type -P warp-cli) ]] && red "Socks5-WARP(+)未安装,无法启动或关闭,建议重新安装Socks5-WARP(+)" && bash CFwarp.sh
|
||||||
|
if [[ $(warp-cli --accept-tos status) =~ 'Connected' ]]; then
|
||||||
|
yellow "当前Socks5-WARP(+)状态:已运行中,现执行:完全关闭……" && sleep 1
|
||||||
|
warp-cli --accept-tos disable-always-on >/dev/null 2>&1
|
||||||
|
[[ -e /root/check.sh ]] && screen -S aw -X quit ; screen -UdmS aw bash -c '/bin/bash /root/check.sh'
|
||||||
|
[[ -e /root/WARP-CR.sh ]] && screen -S cr -X quit ; screen -UdmS cr bash -c '/bin/bash /root/WARP-CR.sh'
|
||||||
|
[[ -e /root/WARP-CP.sh ]] && screen -S cp -X quit ; screen -UdmS cp bash -c '/bin/bash /root/WARP-CP.sh'
|
||||||
|
[[ $(warp-cli --accept-tos status) =~ 'Disconnected' ]] && green "临时关闭WARP(+)成功" || red "临时关闭WARP(+)失败"
|
||||||
|
elif [[ $(warp-cli --accept-tos status) =~ 'Disconnected' ]]; then
|
||||||
|
yellow "当前Socks5-WARP(+)为完全关闭状态,现执行:恢复运行……" && sleep 1
|
||||||
|
warp-cli --accept-tos enable-always-on >/dev/null 2>&1
|
||||||
|
[[ -e /root/check.sh ]] && screen -S aw -X quit ; screen -UdmS aw bash -c '/bin/bash /root/check.sh'
|
||||||
|
[[ -e /root/WARP-CR.sh ]] && screen -S cr -X quit ; screen -UdmS cr bash -c '/bin/bash /root/WARP-CR.sh'
|
||||||
|
[[ -e /root/WARP-CP.sh ]] && screen -S cp -X quit ; screen -UdmS cp bash -c '/bin/bash /root/WARP-CP.sh'
|
||||||
|
fi
|
||||||
|
ShowSOCKS5 && S5menu && back;;
|
||||||
|
0 ) WARPOC
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
cwg(){
|
||||||
|
wg-quick down wgcf >/dev/null 2>&1
|
||||||
|
systemctl disable wg-quick@wgcf >/dev/null 2>&1
|
||||||
|
$yumapt autoremove wireguard-tools
|
||||||
|
screen -S up -X quit ; rm -rf WARP-UP.sh ; sed -i '/WARP-UP.sh/d' /etc/crontab
|
||||||
|
dig9
|
||||||
|
}
|
||||||
|
cso(){
|
||||||
|
warp-cli --accept-tos disconnect >/dev/null 2>&1
|
||||||
|
warp-cli --accept-tos disable-always-on >/dev/null 2>&1
|
||||||
|
warp-cli --accept-tos delete >/dev/null 2>&1
|
||||||
|
[[ $release = Centos ]] && (yum autoremove cloudflare-warp -y) || (apt purge cloudflare-warp -y && rm -f /etc/apt/sources.list.d/cloudflare-client.list /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg)
|
||||||
|
}
|
||||||
|
|
||||||
|
WARPun(){
|
||||||
|
wj="rm -rf /usr/local/bin/wgcf /etc/wireguard/wgcf.conf /etc/wireguard/wgcf-profile.conf /etc/wireguard/wgcf-account.toml /etc/wireguard/wgcf+p.log /etc/wireguard/ID /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf"
|
||||||
|
cron1="rm -rf CFwarp.sh screen.sh check.sh WARP-CR.sh WARP-CP.sh WARP-UP.sh /usr/bin/cf"
|
||||||
|
cron2(){
|
||||||
|
sed -i '/check.sh/d' /etc/crontab ; sed -i '/WARP-CR.sh/d' /etc/crontab ; sed -i '/WARP-CP.sh/d' /etc/crontab ; sed -i '/WARP-UP.sh/d' /etc/crontab
|
||||||
|
}
|
||||||
|
cron3(){
|
||||||
|
screen -S up -X quit;screen -S aw -X quit;screen -S cr -X quit;screen -S cp -X quit
|
||||||
|
}
|
||||||
|
ab="1.卸载Wgcf-WARP(+)\n2.卸载Socks5-WARP(+)\n3.彻底卸载并清除WARP脚本及相关进程文件\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 ) [[ $(type -P wg-quick) ]] && (cwg ; $wj ; green "Wgcf-WARP(+)卸载完成" && ShowWGCF && WGCFmenu && back) || (yellow "并未安装Wgcf-WARP(+),无法卸载" && bash CFwarp.sh);;
|
||||||
|
2 ) [[ $(type -P warp-cli) ]] && (cso ; green "Socks5-WARP(+)卸载完成" && ShowSOCKS5 && S5menu && back) || (yellow "并未安装Socks5-WARP(+),无法卸载" && bash CFwarp.sh);;
|
||||||
|
3 ) [[ ! $(type -P wg-quick) && ! $(type -P warp-cli) ]] && (red "并没有安装任何的WARP功能,无法卸载" && CFwarp.sh) || (cwg ; cso ; $wj ; $cron1 ; cron2 ; cron3 ; green "WARP已全部卸载完成" && ShowSOCKS5 && ShowWGCF && WGCFmenu && S5menu && exit);;
|
||||||
|
0 ) WARPOC
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
WARPOC(){
|
||||||
|
ab="1.完全关闭与启用WARP(+)功能\n2.卸载WARP(+)功能\n0.返回上一层\n 请选择:"
|
||||||
|
readp "$ab" cd
|
||||||
|
case "$cd" in
|
||||||
|
1 ) WARPonoff;;
|
||||||
|
2 ) WARPun;;
|
||||||
|
0 ) bash CFwarp.sh
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
start_menu(){
|
||||||
|
ShowWGCF;ShowSOCKS5
|
||||||
|
clear
|
||||||
|
green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
|
echo -e "${bblue} ░██ ░██ ░██ ░██ ░██${plain} ░██ ░██ ░██ ░██ ██ ${red}██${plain} "
|
||||||
|
echo -e "${bblue} ░██ ░██ ░██ ░██${plain} ░██ ░██ ░██ ░██ ░██ ${red}░░██${plain} "
|
||||||
|
echo -e "${bblue} ░██ ██ ░██${plain} ██ ░██ ██ ░██ ░██ ░${red}██ ${plain} "
|
||||||
|
echo -e "${bblue} ░██ ██ ${plain} ░██ ██ ░██ ██ ░██ ${red}░██ ░██ ██${plain} "
|
||||||
|
echo -e "${bblue} ░██ ░${plain}██ ░██ ░██ ░██ ░██ ░${red}██ ░██ ░░██${plain}"
|
||||||
|
echo -e "${bblue} ░${plain}██ ░░██ ░██ ░░██ ░██ ░░${red}██ ░██ ░██ ██ ██${plain} "
|
||||||
|
green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
|
white "甬哥Gitlab项目 :gitlab.com/rwkgyg"
|
||||||
|
white "甬哥blogger博客 :ygkkk.blogspot.com"
|
||||||
|
white "甬哥YouTube频道 :www.youtube.com/c/甬哥侃侃侃kkkyg"
|
||||||
|
yellow "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
|
bblue " WARP-WGCF/SOCKS5安装脚本:2022.3.24更新 Beta 8 版本"
|
||||||
|
yellow " 切记:安装WARP成功后,进入脚本快捷方式:cf 其他说明:cf h"
|
||||||
|
white " ========================================================================================"
|
||||||
|
green " 1. 安装Wgcf-WARP:虚拟IPV4"
|
||||||
|
green " 2. 安装Wgcf-WARP:虚拟IPV6"
|
||||||
|
green " 3. 安装Wgcf-WARP:虚拟IPV4+IPV6"
|
||||||
|
[[ $cpu != AMD64 ]] && red " 4. 提示:当前VPS的CPU并非AMD64架构,目前不支持安装Socks5-WARP(+)" || green " 4. 安装Socks5-WARP:IPV4本地Socks5代理"
|
||||||
|
white " -------------------------------------------------------------------------------------------"
|
||||||
|
green " 5. WARP账户升级:WARP+账户与WARP+Teams账户"
|
||||||
|
green " 6. WARPR解锁NF奈飞:自动识别WARP配置环境"
|
||||||
|
green " 7. WARP开启、停止、卸载"
|
||||||
|
green " 0. 退出脚本 "
|
||||||
|
red "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
|
white " VPS系统信息如下:"
|
||||||
|
white " VPS操作系统: $(blue "$op") \c" && white " 内核版本: $(blue "$version") \c" && white " CPU架构 : $(blue "$cpu") \c" && white " 虚拟化类型: $(blue "$vi") \c" && white " TCP算法: $(blue "$bbr")"
|
||||||
|
IP_Status_menu
|
||||||
|
echo
|
||||||
|
readp "请输入数字:" Input
|
||||||
|
case "$Input" in
|
||||||
|
1 ) WGCFv4;;
|
||||||
|
2 ) WGCFv6;;
|
||||||
|
3 ) WGCFv4v6;;
|
||||||
|
4 ) [[ $cpu = AMD64 ]] && SOCKS5ins || bash CFwarp.sh;;
|
||||||
|
5 ) WARPupre;;
|
||||||
|
6 ) REnfwarp;;
|
||||||
|
7 ) WARPOC;;
|
||||||
|
* ) exit
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
if [ $# == 0 ]; then
|
||||||
|
start
|
||||||
|
start_menu
|
||||||
|
fi
|
||||||
|
screenup(){
|
||||||
|
screen -Ur up
|
||||||
|
}
|
||||||
|
screenaw(){
|
||||||
|
screen -Ur aw
|
||||||
|
}
|
||||||
|
screencr(){
|
||||||
|
screen -Ur cr
|
||||||
|
}
|
||||||
|
screencp(){
|
||||||
|
screen -Ur cp
|
||||||
|
}
|
||||||
|
wgcfup(){
|
||||||
|
wg-quick up wgcf
|
||||||
|
ShowWGCF && WGCFmenu
|
||||||
|
}
|
||||||
|
wgcfdn(){
|
||||||
|
wg-quick down wgcf
|
||||||
|
ShowWGCF && WGCFmenu
|
||||||
|
}
|
||||||
|
wgcfre(){
|
||||||
|
systemctl restart wg-quick@wgcf
|
||||||
|
ShowWGCF && WGCFmenu
|
||||||
|
}
|
||||||
|
s5up(){
|
||||||
|
warp-cli --accept-tos enable-always-on >/dev/null 2>&1
|
||||||
|
ShowSOCKS5 && S5menu
|
||||||
|
}
|
||||||
|
s5dn(){
|
||||||
|
warp-cli --accept-tos disable-always-on >/dev/null 2>&1
|
||||||
|
ShowSOCKS5 && S5menu
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $# > 0 ]]; then
|
||||||
|
case $1 in
|
||||||
|
wd ) wgcfdn 0;;
|
||||||
|
wu ) wgcfup 0;;
|
||||||
|
wr ) wgcfre 0;;
|
||||||
|
5d ) s5dn 0;;
|
||||||
|
5u ) s5up 0;;
|
||||||
|
sup ) screenup 0;;
|
||||||
|
saw ) screenaw 0;;
|
||||||
|
scr ) screencr 0;;
|
||||||
|
scp ) screencp 0;;
|
||||||
|
h ) menu;;
|
||||||
|
esac
|
||||||
|
fi
|
170
README.md
170
README.md
|
@ -1 +1,169 @@
|
||||||
# 1-CFwarp
|
-------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
### 已收到很多意见和建议,6月将彻底更新本项目及说明,同步油管视频教程。。。
|
||||||
|
|
||||||
|
### 广告:
|
||||||
|
|
||||||
|
### 甬哥博客正式上线:https://ygkkk.blogspot.com/
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
一键脚本:
|
||||||
|
```
|
||||||
|
wget -N --no-check-certificate https://gitlab.com/rwkgyg/cfwarp/raw/main/CFwarp.sh && bash CFwarp.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## CFwarp脚本更新说明:
|
||||||
|
|
||||||
|
### 2022.3.24 更新 BETA 8,添加快捷键功能
|
||||||
|
|
||||||
|
### 视频教程及应用简析注意点后续发布。大家自行“摸鱼”!!!以下版面很乱,后续即将重新整理
|
||||||
|
----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## 支持KVM、lxc、openvz等架构VPS的WARP一键综合脚本
|
||||||
|
|
||||||
|
- [x] 支持自动识别系统类型,CPU架构(X86/ARM),内核版本,虚拟化架构类型!
|
||||||
|
- [x] 支持Ubuntu 18 /Centos 7/Debain 10 以上最新系统,包含Centos各类衍生版本!
|
||||||
|
- [x] 支持纯IPV4,纯IPV6,双栈IPV4+IPV6三大类VPS,每类三种Wgcf-WARP安装形式,以及Socks5-WARP客户端!
|
||||||
|
- [x] 支持主菜单实时显示当前可用IP是否解锁奈飞Netflix,可选择前台手动、前后台自动、重启自动刷支持奈飞Netflix的IP!
|
||||||
|
- [x] 支持WARP普通账户升级:1、WARP+Teams无限流量账户,2、WARP+有限流量账户!
|
||||||
|
- [x] 支持screen管理菜单,以方便对一键screen无限刷流量、一键screen刷奈飞IP的管理及查询相关状态!
|
||||||
|
- [x] 支持自定义刷奈飞时间段间隔与选定奈飞国家区域
|
||||||
|
|
||||||
|
### 相关视频教程及项目
|
||||||
|
|
||||||
|
待更新
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
加入无限刷WARP+流量功能(方法如下)
|
||||||
|
|
||||||
|
下载好手机APP名称:1.1.1.1
|
||||||
|
|
||||||
|
添加WARP+账户提示26字符:右上角设置-账户-按键-复制许可证秘钥
|
||||||
|
|
||||||
|
刷WARP+流量提示36字符:右上角设置-高级-诊断-复制客户端配置ID
|
||||||
|
|
||||||
|
APP显示warp+流量更新:右上角设置-高级-连接选项-重置安全密钥,再回到APP主界面即可显示最新WARP+流量数据
|
||||||
|
|
||||||
|
提示400 bad request:密钥ID输入错误或者绑定设备数超过4个
|
||||||
|
|
||||||
|
超过5个设备如何删减:右上角设置-账户-管理设备,点暗不要的设备
|
||||||
|
|
||||||
|
有意见提ISSUES!!
|
||||||
|
|
||||||
|
关注甬哥侃侃侃油管频道:https://www.youtube.com/channel/UCxukdnZiXnTFvjF5B5dvJ5w
|
||||||
|
|
||||||
|
echo -e "search blue.kundencontroller.de\noptions rotate\nnameserver 2a02:180:6:5::1c\nnameserver 2a02:180:6:5::4\nnameserver 2a02:180:6:5::1e\nnameserver 2a02:180:6:5::1d" > /etc/resolv.conf
|
||||||
|
|
||||||
|
# 目录
|
||||||
|
|
||||||
|
* [vps的ip套上warp功能的优势及不足](#vps的ip套上warp功能的优势及不足)
|
||||||
|
|
||||||
|
* [warp多功能一键脚本](#warp多功能一键脚本)
|
||||||
|
|
||||||
|
* [warp多功能一键脚本各功能简析](#warp多功能一键脚本各功能简析)
|
||||||
|
|
||||||
|
* [自定义ip分流配置模板说明](#自定义ip分流配置模板说明)
|
||||||
|
|
||||||
|
* [相关附加说明](#相关附加说明)
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------
|
||||||
|
### vps的ip套上warp功能的优势及不足
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>给纯IPV4/纯IPV6 VPS添加WARP的好处</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
1:使只有IPV4/IPV6的VPS获取访问IPV6/IPV4的能力,套上WARP的ip,变成双栈VPS!
|
||||||
|
|
||||||
|
2:基本能隐藏VPS的真实IP!
|
||||||
|
|
||||||
|
3:加速VPS到CloudFlare CDN节点访问速度!
|
||||||
|
|
||||||
|
4:避开原VPS的IP需要谷歌验证码问题!
|
||||||
|
|
||||||
|
5:原IPV4下,WARP的IPV6替代HE tunnelbroker IPV6的隧道代理方案,做IPV6 VPS跳板机代理更加稳定!
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>给IPV4+IPV6双栈VPS添加WARP的好处</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
1:基本能隐藏VPS的真实IP!
|
||||||
|
|
||||||
|
2:WARP分配的IPV4或者IPV6的IP段,都支持奈非Netflix流媒体,无视VPS原IP限制!
|
||||||
|
|
||||||
|
3:加速VPS到CloudFlare CDN节点访问速度!
|
||||||
|
|
||||||
|
4:避开原VPS的IP需要谷歌验证码问题!
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>不稳定或者不足点</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
1:warp的IP与原生IP在Youtube上速度对比,并不一定有优势,具体看网络环境!
|
||||||
|
|
||||||
|
2:warp的IP归属国家一般与原生IP一致,但可能会自动改变!
|
||||||
|
|
||||||
|
3:由于warp是虚拟的IP,类似宝塔面板等相关工具可能需要另外的设置,请自行谷歌。
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
### warp多功能一键脚本各功能简析
|
||||||
|
|
||||||
|
待更新
|
||||||
|
|
||||||
|
注意:域名解析所填写的IP必须是VPS本地IP,与WARP分配的IP没关系!
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------
|
||||||
|
### 自定义ip分流配置模板说明(Socks5代理分流-待更新)
|
||||||
|
|
||||||
|
分流配置文件:outbounds配置文件或者routing配置文件,让IP、域名自定义。待更新
|
||||||
|
|
||||||
|
----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
### 相关附加说明
|
||||||
|
|
||||||
|
- 提示:配置文件wgcf.conf和注册文件wgcf-account.toml都已备份在/etc/wireguard目录下!
|
||||||
|
|
||||||
|
- 查看WARP当前统计状态:wg
|
||||||
|
|
||||||
|
- 相关WARP进程命令
|
||||||
|
|
||||||
|
手动临时关闭WARP网络接口
|
||||||
|
|
||||||
|
wg-quick down wgcf
|
||||||
|
|
||||||
|
手动开启WARP网络接口
|
||||||
|
|
||||||
|
wg-quick up wgcf
|
||||||
|
|
||||||
|
启动systemctl enable wg-quick@wgcf
|
||||||
|
|
||||||
|
开始systemctl start wg-quick@wgcf
|
||||||
|
|
||||||
|
状态systemctl status wg-quick@wgcf
|
||||||
|
|
||||||
|
重启systemctl restart wg-quick@wgcf
|
||||||
|
|
||||||
|
停止systemctl stop wg-quick@wgcf
|
||||||
|
|
||||||
|
关闭systemctl disable wg-quick@wgcf
|
||||||
|
|
||||||
|
systemctl is-active warp-svc
|
||||||
|
systemctl is-enabled warp-svc
|
||||||
|
warp-cli --accept-tos status
|
||||||
|
warp-cli --accept-tos account
|
||||||
|
warp-cli --accept-tos settings
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
#### 感谢P3terx,参考来源:https://github.com/P3TERX/warp.sh
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
sleep 5
|
||||||
|
green(){ echo -e "\033[32m\033[01m$1\033[0m";}
|
||||||
|
yellow(){ echo -e "\033[33m\033[01m$1\033[0m";}
|
||||||
|
|
||||||
|
info(){
|
||||||
|
v4=$(curl -s4m3 https://ip.gs -k)
|
||||||
|
v4d=$(curl -s4m3 https://ip.gs -k | awk -F '.' '{print $2"."$3}')
|
||||||
|
}
|
||||||
|
|
||||||
|
BEndpoint(){
|
||||||
|
grep Endpoint /etc/wireguard/wgcf.conf
|
||||||
|
if [[ -n $(grep -w 162.159.192.1 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.1/162.159.192.2/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.2 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.2/162.159.192.3/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.3 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.3/162.159.192.4/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.4 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.4/162.159.192.5/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.5 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.5/162.159.192.6/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.6 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.6/162.159.192.7/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.7 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.7/162.159.192.8/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.8 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.8/162.159.192.9/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.9 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.9/162.159.193.10/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.10 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.10/162.159.192.1/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
if [[ -n $(grep -w 162.159.193.1 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.1/162.159.193.2/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.2 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.2/162.159.193.3/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.3 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.3/162.159.193.4/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.4 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.4/162.159.193.5/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.5 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.5/162.159.193.6/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.6 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.6/162.159.193.7/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.7 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.7/162.159.193.8/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.8 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.8/162.159.193.9/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.9 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.9/162.159.193.1/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
systemctl restart wg-quick@wgcf
|
||||||
|
}
|
||||||
|
|
||||||
|
WGCFV4(){
|
||||||
|
while true; do
|
||||||
|
info
|
||||||
|
[[ "$v4d" = "ipd" ]] && green "恭喜!目前wgcf-ipv4的IP为($v4),设置的IP段为ipd,下轮检测将在你设置的60秒后自动执行" && sleep 60s || (BEndpoint && yellow "遗憾!目前wgcf-ipv4的IP($v4),设置的IP段为ipd,下轮检测将在你设置的20秒后自动执行" && sleep 20s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
green "开始刷wgcf-ipv4的IP,你设置的IP段为ipd" && WGCFV4
|
|
@ -0,0 +1,165 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
sleep 5
|
||||||
|
green(){ echo -e "\033[32m\033[01m$1\033[0m";}
|
||||||
|
yellow(){ echo -e "\033[33m\033[01m$1\033[0m";}
|
||||||
|
|
||||||
|
info1(){
|
||||||
|
UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
|
||||||
|
v6=$(curl -s6m3 https://ip.gs -k)
|
||||||
|
v4=$(curl -s4m3 https://ip.gs -k)
|
||||||
|
AE="阿联酋(United Arab Emirates)";AU="澳大利亚(Australia)";BG="保加利亚(Bulgaria)";BR="巴西(Brazil)";CA="加拿大(Canada)";CH="瑞士(Switzerland)";CL="智利(Chile)";CN="中国(China)";CO="哥伦比亚(Colombia)";DE="德国(Germany)";ES="西班牙(Spain)";FI="芬兰(Finland)";FR="法国(France)";GB="英国(United Kingdom)";HK="香港(Hong Kong)";ID="印度尼西亚(Indonesia)";IE="爱尔兰(Ireland)";IL="以色列(Israel)";IN="印度(India)";IT="意大利(Italy)";JP="日本(Japan)";KR="韩国(South Korea)";LU="卢森堡(Luxembourg)";MX="墨西哥(Mexico)";MY="马来西亚(Malaysia)";NL="荷兰(Netherlands)";NZ="新西兰(New Zealand)";PH="菲律宾(Philippines)";RO="罗马尼亚(Romania)";RU="俄罗斯(Russian)";SA="沙特(Saudi Arabia)";SE="瑞典(Sweden)";SG="新加坡(Singapore)";TW="台湾(Taiwan)";US="美国(United States)";VN="越南(Vietnam)";ZA="南非(South Africa)"
|
||||||
|
if [[ -n $v4 ]]; then
|
||||||
|
wgcfv4=$(curl -s4 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
eg4=$(curl -s --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v4 -k | awk -F "country_code" '{print $2}' | awk -F "region_code" '{print $1}' | sed "s/[,\":}]//g")
|
||||||
|
g4=$(eval echo \$$eg4)
|
||||||
|
fi
|
||||||
|
if [[ -n $v6 ]]; then
|
||||||
|
wgcfv6=$(curl -s6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
eg6=$(curl -s --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v6 -k | awk -F "country_code" '{print $2}' | awk -F "region_code" '{print $1}' | sed "s/[,\":}]//g")
|
||||||
|
g6=$(eval echo \$$eg6)
|
||||||
|
fi
|
||||||
|
mport=`warp-cli --accept-tos settings 2>/dev/null | grep 'WarpProxy on port' | awk -F "port " '{print $2}'`
|
||||||
|
s5ip=`curl -sx socks5h://localhost:$mport ip.gs -k`
|
||||||
|
egj=$(curl -s --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$S5ip -k | awk -F "country_code" '{print $2}' | awk -F "region_code" '{print $1}' | sed "s/[,\":}]//g")
|
||||||
|
s5gj=$(eval echo \$$egj)
|
||||||
|
}
|
||||||
|
s5c(){
|
||||||
|
warp-cli --accept-tos register >/dev/null 2>&1 && sleep 2
|
||||||
|
if [[ -e /etc/wireguard/ID ]]; then
|
||||||
|
warp-cli --accept-tos set-license $(cat /etc/wireguard/ID) >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BEndpoint(){
|
||||||
|
grep Endpoint /etc/wireguard/wgcf.conf
|
||||||
|
if [[ -n $(grep -w 2606:4700:d0::a29f:c001 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c001/2606:4700:d0::a29f:c002/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c002 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c002/2606:4700:d0::a29f:c003/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c003 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c003/2606:4700:d0::a29f:c004/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c004 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c004/2606:4700:d0::a29f:c005/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c005 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c005/2606:4700:d0::a29f:c006/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c006 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c006/2606:4700:d0::a29f:c007/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c007 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c007/2606:4700:d0::a29f:c008/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c008 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c008/2606:4700:d0::a29f:c009/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c009 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c009/2606:4700:d0::a29f:c001/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
if [[ -n $(grep -w 2606:4700:d0::a29f:c101 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c101/2606:4700:d0::a29f:c102/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c102 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c102/2606:4700:d0::a29f:c103/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c103 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c103/2606:4700:d0::a29f:c104/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c104 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c104/2606:4700:d0::a29f:c105/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c105 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c105/2606:4700:d0::a29f:c106/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c106 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c106/2606:4700:d0::a29f:c107/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c107 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c107/2606:4700:d0::a29f:c108/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c108 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c108/2606:4700:d0::a29f:c109/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c109 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c109/2606:4700:d0::a29f:c101/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
if [[ -n $(grep -w 162.159.192.1 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.1/162.159.192.2/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.2 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.2/162.159.192.3/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.3 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.3/162.159.192.4/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.4 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.4/162.159.192.5/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.5 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.5/162.159.192.6/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.6 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.6/162.159.192.7/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.7 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.7/162.159.192.8/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.8 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.8/162.159.192.9/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.9 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.9/162.159.193.10/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.10 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.10/162.159.192.1/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
if [[ -n $(grep -w 162.159.193.1 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.1/162.159.193.2/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.2 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.2/162.159.193.3/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.3 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.3/162.159.193.4/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.4 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.4/162.159.193.5/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.5 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.5/162.159.193.6/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.6 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.6/162.159.193.7/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.7 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.7/162.159.193.8/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.8 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.8/162.159.193.9/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.9 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.9/162.159.193.1/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
systemctl restart wg-quick@wgcf
|
||||||
|
}
|
||||||
|
|
||||||
|
info1
|
||||||
|
WGCFV4(){
|
||||||
|
while true; do
|
||||||
|
info1
|
||||||
|
[[ "$eg4" = "dd4" ]] && green "恭喜!目前wgcf-ipv4的IP为($v4),WARP默认地区为$g4,设置的地区为$(eval echo \$dd4),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (BEndpoint && yellow "遗憾!目前wgcf-ipv4的IP($v4),WARP默认地区为$g4,设置的地区为$(eval echo \$dd4) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
WGCFV6(){
|
||||||
|
while true; do
|
||||||
|
info1
|
||||||
|
[[ "$eg6" = "dd6" ]] && green "恭喜!目前wgcf-ipv6的IP为($v6),WARP默认地区为$g6,设置的地区为$(eval echo \$dd6),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (BEndpoint && yellow "遗憾!目前wgcf-ipv6的IP($v6),WARP默认地区为$g6,设置的地区为$(eval echo \$dd6) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
SOCKS5warp(){
|
||||||
|
while true; do
|
||||||
|
info1
|
||||||
|
[[ "$egj" = "ddj" ]] && green "恭喜!目前socks5的IP为($s5ip),WARP默认地区为$s5gj ,设置的地区为$(eval echo \$ddj),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (s5c && yellow "遗憾!目前socks5的IP($s5ip),WARP默认地区为$s5gj,设置的地区为$(eval echo \$ddj) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
SOCKS5wgcf4(){
|
||||||
|
while true; do
|
||||||
|
info1
|
||||||
|
[[ "$egj" = "ddj" ]] && green "恭喜!目前socks5的IP为($s5ip),WARP默认地区为$s5gj,设置的地区为$(eval echo \$ddj),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (s5c && yellow "遗憾!目前socks5的IP($s5ip),WARP默认地区为$s5gj,设置的地区为$(eval echo \$ddj) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
[[ "$eg4" = "dd4" ]] && green "恭喜!目前wgcf-ipv4的IP为($v4),WARP默认地区为$g4,设置的地区为$(eval echo \$dd4),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (BEndpoint && yellow "遗憾!目前wgcf-ipv4的IP($v4),WARP默认地区为$g4,设置的地区为$(eval echo \$dd4) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
SOCKS5wgcf6(){
|
||||||
|
while true; do
|
||||||
|
info1
|
||||||
|
[[ "$egj" = "ddj" ]] && green "恭喜!目前socks5的IP为($s5ip),WARP默认地区为$s5gj,设置的地区为$(eval echo \$ddj),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (s5c && yellow "遗憾!目前socks5的IP($s5ip),WARP默认地区为$s5gj,设置的地区为$(eval echo \$ddj) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
[[ "$eg6" = "dd6" ]] && green "恭喜!目前wgcf-ipv6的IP为($v6),WARP默认地区为$g6,设置的地区为$(eval echo \$dd6),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (BEndpoint && yellow "遗憾!目前wgcf-ipv6的IP($v6),WARP默认地区为$g6,设置的地区为$(eval echo \$dd6) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
WGCFV4V6(){
|
||||||
|
while true; do
|
||||||
|
info1
|
||||||
|
[[ "$eg4" = "dd4" ]] && green "恭喜!目前wgcf-ipv4的IP为($v4),WARP默认地区为$g4,设置的地区为$(eval echo \$dd4),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (BEndpoint && yellow "遗憾!目前wgcf-ipv4的IP($v4),WARP默认地区为$g4,设置的地区为$(eval echo \$dd4) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
[[ "$eg6" = "dd6" ]] && green "恭喜!目前wgcf-ipv6的IP为($v6),WARP默认地区为$g6,设置的地区为$(eval echo \$dd6),下轮检测将在你设置的60秒后自动执行" && sleep 60s || (BEndpoint && yellow "遗憾!目前wgcf-ipv6的IP($v6),WARP默认地区为$g6,设置的地区为$(eval echo \$dd6) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
[[ $(warp-cli --accept-tos status 2>/dev/null ) =~ 'Connected' && $wgcfv6 =~ on|plus ]] && green "双栈WARP循环执行:刷socks5与wgcf-ipv6的IP" && SOCKS5wgcf6
|
||||||
|
[[ $(warp-cli --accept-tos status 2>/dev/null ) =~ 'Connected' && $wgcfv4 =~ on|plus ]] && green "双栈WARP循环执行:刷socks5与wgcf-ipv4的IP" && SOCKS5wgcf4
|
||||||
|
if [[ $(warp-cli --accept-tos status 2>/dev/null ) =~ 'Connected' ]]; then
|
||||||
|
[[ ! $wgcfv6 =~ on|plus && ! $wgcfv4 =~ on|plus ]] && green "单栈WARP循环执行:刷socks5的IP" && SOCKS5warp
|
||||||
|
fi
|
||||||
|
[[ $wgcfv6 =~ on|plus && $wgcfv4 =~ on|plus ]] && green "双栈WARP单v4循环执行:仅刷wgcf-ipv4的IP" && WGCFV4
|
||||||
|
[[ $wgcfv6 = off && $wgcfv4 =~ on|plus ]] && green "单栈WARP循环执行:刷wgcf-ipv4的IP" && WGCFV4
|
||||||
|
[[ $wgcfv6 =~ on|plus && $wgcfv4 = off ]] && green "单栈WARP循环执行:刷wgcf-ipv6的IP" && WGCFV6
|
||||||
|
[[ -z $wgcfv6 && $wgcfv4 =~ on|plus ]] && green "单栈WARP循环执行:刷wgcf-ipv4的IP" && WGCFV4
|
||||||
|
[[ $wgcfv6 =~ on|plus && -z $wgcfv4 ]] && green "单栈WARP循环执行:刷wgcf-ipv6的IP" && WGCFV6
|
|
@ -0,0 +1,177 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
sleep 5
|
||||||
|
green(){ echo -e "\033[32m\033[01m$1\033[0m";}
|
||||||
|
yellow(){ echo -e "\033[33m\033[01m$1\033[0m";}
|
||||||
|
|
||||||
|
info(){
|
||||||
|
v6=$(curl -s6m3 https://ip.gs -k)
|
||||||
|
v4=$(curl -s4m3 https://ip.gs -k)
|
||||||
|
UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
|
||||||
|
if [[ -n $v6 ]]; then
|
||||||
|
wgcfv6=$(curl -s6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
result6=$(curl -6 --user-agent "${UA_Browser}" -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81215567" 2>&1)
|
||||||
|
[[ "$result6" == "404" ]] && NF6="遗憾哦,当前IP仅解锁奈飞Netflix自制剧..."
|
||||||
|
[[ "$result6" == "403" ]] && NF6="死心了,当前IP不支持解锁奈飞Netflix....."
|
||||||
|
[[ "$result6" == "000" ]] && NF6="检测到网络有问题,再次进入脚本可能就好了.."
|
||||||
|
[[ "$result6" == "200" ]] && NF6="恭喜呀,当前IP可解锁奈飞Netflix流媒体..."
|
||||||
|
fi
|
||||||
|
if [[ -n $v4 ]]; then
|
||||||
|
wgcfv4=$(curl -s4 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
|
||||||
|
result4=$(curl -4 --user-agent "${UA_Browser}" -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81215567" 2>&1)
|
||||||
|
[[ "$result4" == "404" ]] && NF4="遗憾哦,当前IP仅解锁奈飞Netflix自制剧..."
|
||||||
|
[[ "$result4" == "403" ]] && NF4="死心了,当前IP不支持解锁奈飞Netflix....."
|
||||||
|
[[ "$result4" == "000" ]] && NF4="检测到网络有问题,再次进入脚本可能就好了.."
|
||||||
|
[[ "$result4" == "200" ]] && NF4="恭喜呀,当前IP可解锁奈飞Netflix流媒体..."
|
||||||
|
fi
|
||||||
|
mport=`warp-cli --accept-tos settings 2>/dev/null | grep 'WarpProxy on port' | awk -F "port " '{print $2}'`
|
||||||
|
result=$(curl -sx socks5h://localhost:$mport -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81215567" 2>&1)
|
||||||
|
[[ "$result" == "404" ]] && NF="遗憾哦,当前IP仅解锁奈飞Netflix自制剧..."
|
||||||
|
[[ "$result" == "403" ]] && NF="死心了,当前IP不支持解锁奈飞Netflix....."
|
||||||
|
[[ "$result" == "000" ]] && NF="检测到网络有问题,再次进入脚本可能就好了.."
|
||||||
|
[[ "$result" == "200" ]] && NF="恭喜呀,当前IP可解锁奈飞Netflix流媒体..."
|
||||||
|
s5ip=`curl -sx socks5h://localhost:$mport ip.gs -k`
|
||||||
|
AE="阿联酋(United Arab Emirates)";AU="澳大利亚(Australia)";BG="保加利亚(Bulgaria)";BR="巴西(Brazil)";CA="加拿大(Canada)";CH="瑞士(Switzerland)";CL="智利(Chile)";CN="中国(China)";CO="哥伦比亚(Colombia)";DE="德国(Germany)";ES="西班牙(Spain)";FI="芬兰(Finland)";FR="法国(France)";GB="英国(United Kingdom)";HK="香港(Hong Kong)";ID="印度尼西亚(Indonesia)";IE="爱尔兰(Ireland)";IL="以色列(Israel)";IN="印度(India)";IT="意大利(Italy)";JP="日本(Japan)";KR="韩国(South Korea)";LU="卢森堡(Luxembourg)";MX="墨西哥(Mexico)";MY="马来西亚(Malaysia)";NL="荷兰(Netherlands)";NZ="新西兰(New Zealand)";PH="菲律宾(Philippines)";RO="罗马尼亚(Romania)";RU="俄罗斯(Russian)";SA="沙特(Saudi Arabia)";SE="瑞典(Sweden)";SG="新加坡(Singapore)";TW="台湾(Taiwan)";US="美国(United States)";VN="越南(Vietnam)";ZA="南非(South Africa)"
|
||||||
|
region=`tr [:lower:] [:upper:] <<< $(curl --user-agent "${UA_Browser}" -fs --max-time 10 --write-out %{redirect_url} --output /dev/null "https://www.netflix.com/title/80018499" | cut -d '/' -f4 | cut -d '-' -f1)`
|
||||||
|
[[ ! "$region" ]] && region="US"
|
||||||
|
}
|
||||||
|
|
||||||
|
s5c(){
|
||||||
|
warp-cli --accept-tos register >/dev/null 2>&1 && sleep 2
|
||||||
|
if [[ -e /etc/wireguard/ID ]]; then
|
||||||
|
warp-cli --accept-tos set-license $(cat /etc/wireguard/ID) >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BEndpoint(){
|
||||||
|
grep Endpoint /etc/wireguard/wgcf.conf
|
||||||
|
if [[ -n $(grep -w 2606:4700:d0::a29f:c001 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c001/2606:4700:d0::a29f:c002/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c002 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c002/2606:4700:d0::a29f:c003/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c003 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c003/2606:4700:d0::a29f:c004/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c004 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c004/2606:4700:d0::a29f:c005/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c005 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c005/2606:4700:d0::a29f:c006/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c006 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c006/2606:4700:d0::a29f:c007/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c007 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c007/2606:4700:d0::a29f:c008/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c008 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c008/2606:4700:d0::a29f:c009/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c009 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c009/2606:4700:d0::a29f:c001/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
if [[ -n $(grep -w 2606:4700:d0::a29f:c101 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c101/2606:4700:d0::a29f:c102/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c102 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c102/2606:4700:d0::a29f:c103/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c103 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c103/2606:4700:d0::a29f:c104/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c104 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c104/2606:4700:d0::a29f:c105/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c105 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c105/2606:4700:d0::a29f:c106/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c106 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c106/2606:4700:d0::a29f:c107/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c107 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c107/2606:4700:d0::a29f:c108/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c108 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c108/2606:4700:d0::a29f:c109/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 2606:4700:d0::a29f:c109 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/2606:4700:d0::a29f:c109/2606:4700:d0::a29f:c101/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
if [[ -n $(grep -w 162.159.192.1 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.1/162.159.192.2/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.2 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.2/162.159.192.3/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.3 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.3/162.159.192.4/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.4 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.4/162.159.192.5/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.5 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.5/162.159.192.6/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.6 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.6/162.159.192.7/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.7 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.7/162.159.192.8/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.8 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.8/162.159.192.9/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.192.9 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.192.9/162.159.193.10/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.10 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.10/162.159.192.1/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
if [[ -n $(grep -w 162.159.193.1 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.1/162.159.193.2/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.2 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.2/162.159.193.3/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.3 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.3/162.159.193.4/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.4 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.4/162.159.193.5/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.5 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.5/162.159.193.6/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.6 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.6/162.159.193.7/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.7 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.7/162.159.193.8/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.8 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.8/162.159.193.9/g" /etc/wireguard/wgcf.conf
|
||||||
|
elif [[ -n $(grep -w 162.159.193.9 /etc/wireguard/wgcf.conf) ]]; then
|
||||||
|
sed -i "s/162.159.193.9/162.159.193.1/g" /etc/wireguard/wgcf.conf
|
||||||
|
fi
|
||||||
|
systemctl restart wg-quick@wgcf
|
||||||
|
}
|
||||||
|
|
||||||
|
info
|
||||||
|
WGCFV4(){
|
||||||
|
while true; do
|
||||||
|
info
|
||||||
|
[[ "$result4" == "200" && "$region" = "dd" ]] && green "目前wgcf-ipv4的IP($v4)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (BEndpoint && yellow "目前wgcf-ipv4的IP($v4) $NF4,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
WGCFV6(){
|
||||||
|
while true; do
|
||||||
|
info
|
||||||
|
[[ "$result6" == "200" && "$region" = "dd" ]] && green "目前wgcf-ipv6的IP($v6)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (BEndpoint && yellow "目前wgcf-ipv6的IP($v6) $NF6,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
SOCKS5warp(){
|
||||||
|
while true; do
|
||||||
|
info
|
||||||
|
[[ "$result" == "200" && "$region" = "dd" ]] && green "目前socks5的IP($s5ip)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (s5c && yellow "目前socks5的IP($s5ip) $NF,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
SOCKS5wgcf4(){
|
||||||
|
while true; do
|
||||||
|
info
|
||||||
|
[[ "$result" == "200" && "$region" = "dd" ]] && green "目前socks5的IP($s5ip)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (s5c && yellow "目前socks5的IP($s5ip) $NF,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
[[ "$result4" == "200" && "$region" = "dd" ]] && green "目前wgcf-ipv4的IP($v4)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (BEndpoint && yellow "目前wgcf-ipv4的IP($v4) $NF4,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
SOCKS5wgcf6(){
|
||||||
|
while true; do
|
||||||
|
info
|
||||||
|
[[ "$result" == "200" && "$region" = "dd" ]] && green "目前socks5的IP($s5ip)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (s5c && yellow "目前socks5的IP($s5ip) $NF,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
[[ "$result6" == "200" && "$region" = "dd" ]] && green "目前wgcf-ipv6的IP($v6)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (BEndpoint && yellow "目前wgcf-ipv6的IP($v6) $NF6,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
WGCFV4V6(){
|
||||||
|
while true; do
|
||||||
|
info
|
||||||
|
[[ "$result4" == "200" && "$region" = "dd" ]] && green "目前wgcf-ipv4的IP($v4)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (BEndpoint && yellow "目前wgcf-ipv4的IP($v4) $NF4,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
[[ "$result6" == "200" && "$region" = "dd" ]] && green "目前wgcf-ipv6的IP($v6)支持奈飞,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的45秒后自动执行" && sleep 45s || (BEndpoint && yellow "目前wgcf-ipv6的IP($v6) $NF6,WARP默认地区为$(eval echo \$$region) ,设置的地区为$(eval echo \$dd) ,下轮检测将在你设置的30秒后自动执行" && sleep 30s)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
[[ $(warp-cli --accept-tos status 2>/dev/null ) =~ 'Connected' && $wgcfv6 =~ on|plus ]] && green "双栈WARP循环执行:刷socks5与wgcf-ipv6的IP" && SOCKS5wgcf6
|
||||||
|
[[ $(warp-cli --accept-tos status 2>/dev/null ) =~ 'Connected' && $wgcfv4 =~ on|plus ]] && green "双栈WARP循环执行:刷socks5与wgcf-ipv4的IP" && SOCKS5wgcf4
|
||||||
|
if [[ $(warp-cli --accept-tos status 2>/dev/null ) =~ 'Connected' ]]; then
|
||||||
|
[[ ! $wgcfv6 =~ on|plus && ! $wgcfv4 =~ on|plus ]] && green "单栈WARP循环执行:刷socks5的IP" && SOCKS5warp
|
||||||
|
fi
|
||||||
|
[[ $wgcfv6 =~ on|plus && $wgcfv4 =~ on|plus ]] && green "双栈WARP单v4循环执行:仅刷wgcf-ipv4的IP" && WGCFV4
|
||||||
|
[[ $wgcfv6 = off && $wgcfv4 =~ on|plus ]] && green "单栈WARP循环执行:刷wgcf-ipv4的IP" && WGCFV4
|
||||||
|
[[ $wgcfv6 =~ on|plus && $wgcfv4 = off ]] && green "单栈WARP循环执行:刷wgcf-ipv6的IP" && WGCFV6
|
||||||
|
[[ -z $wgcfv6 && $wgcfv4 =~ on|plus ]] && green "单栈WARP循环执行:刷wgcf-ipv4的IP" && WGCFV4
|
||||||
|
[[ $wgcfv6 =~ on|plus && -z $wgcfv4 ]] && green "单栈WARP循环执行:刷wgcf-ipv6的IP" && WGCFV6
|
|
@ -0,0 +1,558 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import signal
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
from socket import AF_INET, SOCK_STREAM, socket
|
||||||
|
from socketserver import BaseServer, StreamRequestHandler, ThreadingTCPServer
|
||||||
|
|
||||||
|
__author__ = 'Youchao Feng'
|
||||||
|
support_os = ('Darwin', 'Linux')
|
||||||
|
current_os = platform.system()
|
||||||
|
|
||||||
|
|
||||||
|
def byte_to_int(b):
|
||||||
|
"""
|
||||||
|
Convert Unsigned byte to int
|
||||||
|
:param b: byte value
|
||||||
|
:return: int value
|
||||||
|
"""
|
||||||
|
return b & 0xFF
|
||||||
|
|
||||||
|
|
||||||
|
def port_from_byte(b1, b2):
|
||||||
|
"""
|
||||||
|
:param b1: First byte of port
|
||||||
|
:param b2: Second byte of port
|
||||||
|
:return: Port in Int
|
||||||
|
"""
|
||||||
|
return byte_to_int(b1) << 8 | byte_to_int(b2)
|
||||||
|
|
||||||
|
|
||||||
|
def host_from_ip(a, b, c, d):
|
||||||
|
a = byte_to_int(a)
|
||||||
|
b = byte_to_int(b)
|
||||||
|
c = byte_to_int(c)
|
||||||
|
d = byte_to_int(d)
|
||||||
|
return "%d.%d.%d.%d" % (a, b, c, d)
|
||||||
|
|
||||||
|
|
||||||
|
def get_command_name(value):
|
||||||
|
"""
|
||||||
|
Gets command name by value
|
||||||
|
:param value: value of Command
|
||||||
|
:return: Command Name
|
||||||
|
"""
|
||||||
|
if value == 1:
|
||||||
|
return 'CONNECT'
|
||||||
|
elif value == 2:
|
||||||
|
return 'BIND'
|
||||||
|
elif value == 3:
|
||||||
|
return 'UDP_ASSOCIATE'
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def build_command_response(reply):
|
||||||
|
start = b'\x05%s\x00\x01\x00\x00\x00\x00\x00\x00'
|
||||||
|
return start % reply.get_byte_string()
|
||||||
|
|
||||||
|
|
||||||
|
def close_session(session):
|
||||||
|
session.get_client_socket().close()
|
||||||
|
logging.info("Session[%s] closed", session.get_id())
|
||||||
|
|
||||||
|
|
||||||
|
def run_daemon_process(stdout='/dev/null',
|
||||||
|
stderr=None,
|
||||||
|
stdin='/dev/null',
|
||||||
|
pid_file=None,
|
||||||
|
start_msg='started with pid %s'):
|
||||||
|
"""
|
||||||
|
This forks the current process into a daemon.
|
||||||
|
The stdin, stdout, and stderr arguments are file names that
|
||||||
|
will be opened and be used to replace the standard file descriptors
|
||||||
|
in sys.stdin, sys.stdout, and sys.stderr.
|
||||||
|
These arguments are optional and default to /dev/null.
|
||||||
|
Note that stderr is opened unbuffered, so
|
||||||
|
if it shares a file with stdout then interleaved output
|
||||||
|
may not appear in the order that you expect.
|
||||||
|
"""
|
||||||
|
# flush io
|
||||||
|
sys.stdout.flush()
|
||||||
|
sys.stderr.flush()
|
||||||
|
# Do first fork.
|
||||||
|
try:
|
||||||
|
if os.fork() > 0:
|
||||||
|
sys.exit(0) # Exit first parent.
|
||||||
|
except OSError as e:
|
||||||
|
sys.stderr.write("fork #1 failed: (%d) %s\n" % (e.errno, e.strerror))
|
||||||
|
sys.exit(1)
|
||||||
|
# Decouple from parent environment.
|
||||||
|
os.chdir("/")
|
||||||
|
os.umask(0)
|
||||||
|
os.setsid()
|
||||||
|
# Do second fork.
|
||||||
|
try:
|
||||||
|
if os.fork() > 0:
|
||||||
|
sys.exit(0) # Exit second parent.
|
||||||
|
except OSError as e:
|
||||||
|
sys.stderr.write("fork #2 failed: (%d) %s\n" % (e.errno, e.strerror))
|
||||||
|
sys.exit(1)
|
||||||
|
# Open file descriptors and print start message
|
||||||
|
if not stderr:
|
||||||
|
stderr = stdout
|
||||||
|
si = open(stdin, 'r')
|
||||||
|
so = open(stdout, 'a+')
|
||||||
|
se = open(stderr, 'ba+', 0) # unbuffered
|
||||||
|
pid = str(os.getpid())
|
||||||
|
sys.stderr.write(start_msg % pid)
|
||||||
|
sys.stderr.flush()
|
||||||
|
if pid_file:
|
||||||
|
open(pid_file, 'w+').write("%s\n" % pid)
|
||||||
|
# Redirect standard file descriptors.
|
||||||
|
os.dup2(si.fileno(), sys.stdin.fileno())
|
||||||
|
os.dup2(so.fileno(), sys.stdout.fileno())
|
||||||
|
os.dup2(se.fileno(), sys.stderr.fileno())
|
||||||
|
|
||||||
|
|
||||||
|
class Session:
|
||||||
|
index = 0
|
||||||
|
|
||||||
|
def __init__(self, client_socket):
|
||||||
|
Session.index += 1
|
||||||
|
self.__id = Session.index
|
||||||
|
self.__client_socket = client_socket
|
||||||
|
self._attr = {}
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
return self.__id
|
||||||
|
|
||||||
|
def set_attr(self, key, value):
|
||||||
|
self._attr[key] = value
|
||||||
|
|
||||||
|
def get_client_socket(self):
|
||||||
|
return self.__client_socket
|
||||||
|
|
||||||
|
|
||||||
|
class AddressType:
|
||||||
|
IPV4 = 1
|
||||||
|
DOMAIN_NAME = 3
|
||||||
|
IPV6 = 4
|
||||||
|
|
||||||
|
|
||||||
|
class SocksCommand:
|
||||||
|
CONNECT = 1
|
||||||
|
BIND = 2
|
||||||
|
UDP_ASSOCIATE = 3
|
||||||
|
|
||||||
|
|
||||||
|
class SocksMethod:
|
||||||
|
NO_AUTHENTICATION_REQUIRED = 0
|
||||||
|
GSS_API = 1
|
||||||
|
USERNAME_PASSWORD = 2
|
||||||
|
|
||||||
|
|
||||||
|
class ServerReply:
|
||||||
|
def __init__(self, value):
|
||||||
|
self.__value = value
|
||||||
|
|
||||||
|
def get_byte_string(self):
|
||||||
|
if self.__value == 0:
|
||||||
|
return b'\x00'
|
||||||
|
elif self.__value == 1:
|
||||||
|
return b'\x01'
|
||||||
|
elif self.__value == 2:
|
||||||
|
return b'\x02'
|
||||||
|
elif self.__value == 3:
|
||||||
|
return b'\x03'
|
||||||
|
elif self.__value == 4:
|
||||||
|
return b'\x04'
|
||||||
|
elif self.__value == 5:
|
||||||
|
return b'\x05'
|
||||||
|
elif self.__value == 6:
|
||||||
|
return b'\x06'
|
||||||
|
elif self.__value == 7:
|
||||||
|
return b'\x07'
|
||||||
|
elif self.__value == 8:
|
||||||
|
return b'\x08'
|
||||||
|
|
||||||
|
def get_value(self):
|
||||||
|
return self.__value
|
||||||
|
|
||||||
|
|
||||||
|
class ReplyType:
|
||||||
|
SUCCEEDED = ServerReply(0)
|
||||||
|
GENERAL_SOCKS_SERVER_FAILURE = ServerReply(1)
|
||||||
|
CONNECTION_NOT_ALLOWED_BY_RULESET = ServerReply(2)
|
||||||
|
NETWORK_UNREACHABLE = ServerReply(3)
|
||||||
|
HOST_UNREACHABLE = ServerReply(4)
|
||||||
|
CONNECTION_REFUSED = ServerReply(5)
|
||||||
|
TTL_EXPIRED = ServerReply(6)
|
||||||
|
COMMAND_NOT_SUPPORTED = ServerReply(7)
|
||||||
|
ADDRESS_TYPE_NOT_SUPPORTED = ServerReply(8)
|
||||||
|
|
||||||
|
|
||||||
|
class SocketPipe:
|
||||||
|
BUFFER_SIZE = 1024 * 1024
|
||||||
|
|
||||||
|
def __init__(self, socket1, socket2):
|
||||||
|
self._socket1 = socket1
|
||||||
|
self._socket2 = socket2
|
||||||
|
self.__running = False
|
||||||
|
|
||||||
|
self.t1 = threading.Thread(target=self.__transfer, args=(self._socket1, self._socket2))
|
||||||
|
self.t2 = threading.Thread(target=self.__transfer, args=(self._socket2, self._socket1))
|
||||||
|
|
||||||
|
def __transfer(self, socket1, socket2):
|
||||||
|
while self.__running:
|
||||||
|
try:
|
||||||
|
data = socket1.recv(self.BUFFER_SIZE)
|
||||||
|
if len(data) > 0:
|
||||||
|
socket2.sendall(data)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
except IOError:
|
||||||
|
self.stop()
|
||||||
|
self.stop()
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
self.__running = True
|
||||||
|
|
||||||
|
self.t1.start()
|
||||||
|
self.t2.start()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
self._socket1.close()
|
||||||
|
self._socket2.close()
|
||||||
|
self.__running = False
|
||||||
|
|
||||||
|
def is_running(self):
|
||||||
|
return self.__running
|
||||||
|
|
||||||
|
|
||||||
|
class CommandExecutor:
|
||||||
|
def __init__(self, remote_server_host, remote_server_port, session):
|
||||||
|
self.__proxy_socket = socket(AF_INET, SOCK_STREAM)
|
||||||
|
self.__remote_server_host = remote_server_host
|
||||||
|
self.__remote_server_port = remote_server_port
|
||||||
|
self.__client = session.get_client_socket()
|
||||||
|
self.__session = session
|
||||||
|
|
||||||
|
def do_connect(self):
|
||||||
|
"""
|
||||||
|
Do SOCKS CONNECT method
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
|
address = self.__get_address()
|
||||||
|
logging.info("Connect request to %s", address)
|
||||||
|
result = self.__proxy_socket.connect_ex(address)
|
||||||
|
if result == 0:
|
||||||
|
self.__client.send(build_command_response(ReplyType.SUCCEEDED))
|
||||||
|
socket_pipe = SocketPipe(self.__client, self.__proxy_socket)
|
||||||
|
socket_pipe.start()
|
||||||
|
while socket_pipe.is_running():
|
||||||
|
pass
|
||||||
|
elif result == 60:
|
||||||
|
self.__client.send(build_command_response(ReplyType.TTL_EXPIRED))
|
||||||
|
elif result == 61:
|
||||||
|
self.__client.send(build_command_response(ReplyType.NETWORK_UNREACHABLE))
|
||||||
|
else:
|
||||||
|
logging.error('Connection Error:[%s] is unknown', result)
|
||||||
|
self.__client.send(build_command_response(ReplyType.NETWORK_UNREACHABLE))
|
||||||
|
|
||||||
|
def do_bind(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_udp_associate(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __get_address(self):
|
||||||
|
return self.__remote_server_host, self.__remote_server_port
|
||||||
|
|
||||||
|
|
||||||
|
class User:
|
||||||
|
def __init__(self, username, password):
|
||||||
|
self.__username = username
|
||||||
|
self.__password = password
|
||||||
|
|
||||||
|
def get_username(self):
|
||||||
|
return self.__username
|
||||||
|
|
||||||
|
def get_password(self):
|
||||||
|
return self.__password
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '<user: username=%s, password=%s>' % (self.get_username(), self.__password)
|
||||||
|
|
||||||
|
|
||||||
|
class UserManager:
|
||||||
|
def __init__(self):
|
||||||
|
self.__users = {}
|
||||||
|
|
||||||
|
def add_user(self, user):
|
||||||
|
self.__users[user.get_username()] = user
|
||||||
|
|
||||||
|
def remove_user(self, username):
|
||||||
|
if username in self.__users:
|
||||||
|
del self.__users[username]
|
||||||
|
|
||||||
|
def check(self, username, password):
|
||||||
|
if username in self.__users and self.__users[username].get_password() == password:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def get_user(self, username):
|
||||||
|
return self.__users[username]
|
||||||
|
|
||||||
|
def get_users(self):
|
||||||
|
return self.__users
|
||||||
|
|
||||||
|
|
||||||
|
class Socks5RequestHandler(StreamRequestHandler):
|
||||||
|
def __init__(self, request, client_address, server):
|
||||||
|
StreamRequestHandler.__init__(self, request, client_address, server)
|
||||||
|
|
||||||
|
def handle(self):
|
||||||
|
session = Session(self.connection)
|
||||||
|
logging.info('Create session[%s] for %s:%d', 1, self.client_address[0], self.client_address[1])
|
||||||
|
# print(self.server.allowed)
|
||||||
|
if self.server.allowed and self.client_address[0] not in self.server.allowed:
|
||||||
|
logging.info('Remote IP not in allowed list. Closing connection')
|
||||||
|
close_session(session)
|
||||||
|
return
|
||||||
|
client = self.connection
|
||||||
|
client.recv(1)
|
||||||
|
method_num, = struct.unpack('b', client.recv(1))
|
||||||
|
meth_bytes = client.recv(method_num)
|
||||||
|
methods = struct.unpack('b' * method_num, meth_bytes)
|
||||||
|
auth = self.server.is_auth()
|
||||||
|
if methods.__contains__(SocksMethod.NO_AUTHENTICATION_REQUIRED) and not auth:
|
||||||
|
client.send(b"\x05\x00")
|
||||||
|
elif methods.__contains__(SocksMethod.USERNAME_PASSWORD) and auth:
|
||||||
|
client.send(b"\x05\x02")
|
||||||
|
if not self.__do_username_password_auth():
|
||||||
|
logging.info('Session[%d] authentication failed', session.get_id())
|
||||||
|
close_session(session)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
logging.info('Client requested unknown method (%s, %s->%s). Cannot continue.', methods, method_num,
|
||||||
|
meth_bytes)
|
||||||
|
client.send(b"\x05\xFF")
|
||||||
|
return
|
||||||
|
|
||||||
|
version, command, reserved, address_type = struct.unpack('B' * 4, client.recv(4))
|
||||||
|
host = None
|
||||||
|
port = None
|
||||||
|
if address_type == AddressType.IPV4:
|
||||||
|
ip_a, ip_b, ip_c, ip_d, port = struct.unpack('!' + ('b' * 4) + 'H', client.recv(6))
|
||||||
|
host = host_from_ip(ip_a, ip_b, ip_c, ip_d)
|
||||||
|
elif address_type == AddressType.DOMAIN_NAME:
|
||||||
|
host_length, = struct.unpack('b', client.recv(1))
|
||||||
|
host = client.recv(host_length)
|
||||||
|
port, = struct.unpack('!H', client.recv(2))
|
||||||
|
elif address_type == AddressType.IPV6:
|
||||||
|
ip6_01, ip6_02, ip6_03, ip6_04, \
|
||||||
|
ip6_05, ip6_06, ip6_07, ip6_08, \
|
||||||
|
ip6_09, ip6_10, ip6_11, ip6_12, \
|
||||||
|
ip6_13, ip6_14, ip6_15, ip6_16, \
|
||||||
|
port = struct.unpack('!' + ('b' * 16) + 'H', client.recv(18))
|
||||||
|
|
||||||
|
logging.warn("Address type not implemented: %s (IPV6 Connect)", address_type)
|
||||||
|
logging.info("Params: %s, port: %s", (
|
||||||
|
ip6_01, ip6_02, ip6_03, ip6_04, ip6_05, ip6_06, ip6_07, ip6_08, ip6_09, ip6_10, ip6_11, ip6_12, ip6_13,
|
||||||
|
ip6_14, ip6_15, ip6_16), port)
|
||||||
|
client.send(build_command_response(ReplyType.ADDRESS_TYPE_NOT_SUPPORTED))
|
||||||
|
return
|
||||||
|
|
||||||
|
else: # address type not support
|
||||||
|
logging.warn("Address type not supported: %s", address_type)
|
||||||
|
client.send(build_command_response(ReplyType.ADDRESS_TYPE_NOT_SUPPORTED))
|
||||||
|
return
|
||||||
|
|
||||||
|
command_executor = CommandExecutor(host, port, session)
|
||||||
|
if command == SocksCommand.CONNECT:
|
||||||
|
logging.info("Session[%s] Request connect %s:%s", session.get_id(), host, port)
|
||||||
|
command_executor.do_connect()
|
||||||
|
close_session(session)
|
||||||
|
|
||||||
|
def __do_username_password_auth(self):
|
||||||
|
client = self.connection
|
||||||
|
client.recv(1)
|
||||||
|
length = byte_to_int(struct.unpack('b', client.recv(1))[0])
|
||||||
|
username = client.recv(length)
|
||||||
|
length = byte_to_int(struct.unpack('b', client.recv(1))[0])
|
||||||
|
password = client.recv(length)
|
||||||
|
user_manager = self.server.get_user_manager()
|
||||||
|
if user_manager.check(username, password):
|
||||||
|
client.send(b"\x01\x00")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
client.send(b"\x01\x01")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class Socks5Server(ThreadingTCPServer):
|
||||||
|
"""
|
||||||
|
SOCKS5 proxy server
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, port, auth=False, user_manager=UserManager(), allowed=None):
|
||||||
|
ThreadingTCPServer.__init__(self, ('', port), Socks5RequestHandler)
|
||||||
|
self.__port = port
|
||||||
|
self.__users = {}
|
||||||
|
self.__auth = auth
|
||||||
|
self.__user_manager = user_manager
|
||||||
|
self.__sessions = {}
|
||||||
|
self.allowed = allowed
|
||||||
|
|
||||||
|
self.th = threading.Thread(target=self.serve_forever)
|
||||||
|
|
||||||
|
def serve_forever(self, poll_interval=0.5):
|
||||||
|
logging.info("Create SOCKS5 server at port %d", self.__port)
|
||||||
|
ThreadingTCPServer.serve_forever(self, poll_interval)
|
||||||
|
|
||||||
|
def finish_request(self, request, client_address):
|
||||||
|
BaseServer.finish_request(self, request, client_address)
|
||||||
|
|
||||||
|
def is_auth(self):
|
||||||
|
return self.__auth
|
||||||
|
|
||||||
|
def set_auth(self, auth):
|
||||||
|
self.__auth = auth
|
||||||
|
|
||||||
|
def get_all_managed_session(self):
|
||||||
|
return self.__sessions
|
||||||
|
|
||||||
|
def get_bind_port(self):
|
||||||
|
return self.__port
|
||||||
|
|
||||||
|
def get_user_manager(self):
|
||||||
|
return self.__user_manager
|
||||||
|
|
||||||
|
def set_user_manager(self, user_manager):
|
||||||
|
self.__user_manager = user_manager
|
||||||
|
|
||||||
|
def run_in_thread(self):
|
||||||
|
self.th.start()
|
||||||
|
|
||||||
|
def stop_server_thread(self):
|
||||||
|
self.server_close()
|
||||||
|
self.shutdown()
|
||||||
|
self.th.join()
|
||||||
|
|
||||||
|
|
||||||
|
def check_os_support():
|
||||||
|
if not support_os.__contains__(current_os):
|
||||||
|
print('Not support in %s' % current_os)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def stop(pid_file):
|
||||||
|
check_os_support()
|
||||||
|
print('Stopping server...', end=' ')
|
||||||
|
try:
|
||||||
|
f = open(pid_file, 'r')
|
||||||
|
pid = int(f.readline())
|
||||||
|
os.kill(pid, signal.SIGTERM)
|
||||||
|
os.remove(pid_file)
|
||||||
|
print(" [OK]")
|
||||||
|
except OSError:
|
||||||
|
print("pysocks is not running")
|
||||||
|
except IOError:
|
||||||
|
print("pysocks is not running")
|
||||||
|
|
||||||
|
|
||||||
|
def status(pid_file):
|
||||||
|
check_os_support()
|
||||||
|
try:
|
||||||
|
f = open(pid_file, 'r')
|
||||||
|
pid = int(f.readline())
|
||||||
|
print('pysocks(pid %d) is running...' % pid)
|
||||||
|
except IOError:
|
||||||
|
print("pysocks is stopped")
|
||||||
|
|
||||||
|
|
||||||
|
def start_command(args):
|
||||||
|
enable_log = True
|
||||||
|
log_file = args.logfile
|
||||||
|
auth = args.auth is not None
|
||||||
|
pid_file = args.pidfile
|
||||||
|
user_manager = UserManager()
|
||||||
|
should_daemonisze = not args.foreground
|
||||||
|
if auth:
|
||||||
|
for user in args.auth:
|
||||||
|
user_pwd = user.split(':')
|
||||||
|
user_manager.add_user(User(user_pwd[0], user_pwd[1]))
|
||||||
|
if enable_log:
|
||||||
|
logging.basicConfig(level=logging.INFO,
|
||||||
|
format='%(asctime)s %(levelname)s - %(message)s',
|
||||||
|
filename=log_file,
|
||||||
|
filemode='a')
|
||||||
|
console = logging.StreamHandler(sys.stdout)
|
||||||
|
console.setLevel(logging.INFO)
|
||||||
|
formatter = logging.Formatter('%(asctime)s %(levelname)-5s %(lineno)-3d - %(message)s')
|
||||||
|
console.setFormatter(formatter)
|
||||||
|
logging.getLogger().addHandler(console)
|
||||||
|
|
||||||
|
Socks5Server.allow_reuse_address = True
|
||||||
|
socks5_server = Socks5Server(args.port, auth, user_manager, allowed=args.allow_ip)
|
||||||
|
try:
|
||||||
|
if support_os.__contains__(current_os) and should_daemonisze:
|
||||||
|
run_daemon_process(pid_file=pid_file, start_msg='Start SOCKS5 server at pid %s\n')
|
||||||
|
socks5_server.serve_forever()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
socks5_server.server_close()
|
||||||
|
socks5_server.shutdown()
|
||||||
|
logging.info("SOCKS5 server shutdown")
|
||||||
|
|
||||||
|
|
||||||
|
def stop_command(args):
|
||||||
|
pid_file = pid_file = args.pidfile
|
||||||
|
stop(pid_file)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def status_command(args):
|
||||||
|
pid_file = args.pidfile
|
||||||
|
status(pid_file)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
default_pid_file = os.path.join(os.path.expanduser('~'), '.pysocks.pid')
|
||||||
|
default_log_file = os.path.join(os.path.expanduser('~'), 'pysocks.log')
|
||||||
|
parser = argparse.ArgumentParser(description='start a simple socks5 server',
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
subparsers = parser.add_subparsers(help='sub-command help')
|
||||||
|
parser_start = subparsers.add_parser('start', help='start a SOCKS5 server', description='start a SOCKS5 server',
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
parser_start.add_argument('-p', '--port', type=int, help='specify server port, default 1080', default=1080)
|
||||||
|
parser_start.add_argument('-f', '--foreground', help='stay in foreground (prevents daemonization)',
|
||||||
|
action='store_true', default=False)
|
||||||
|
parser_start.add_argument('-i', '--allow-ip', nargs='+', help='allowed client IP list')
|
||||||
|
parser_start.add_argument('-a', '--auth', nargs='+', help='allowed users')
|
||||||
|
parser_start.add_argument('-L', '--logfile', help='log file', default=default_log_file)
|
||||||
|
parser_start.add_argument('-P', '--pidfile', help='pid file', default=default_pid_file)
|
||||||
|
parser_start.set_defaults(func=start_command)
|
||||||
|
parser_stop = subparsers.add_parser('stop', help='stop a SOCKS5 server', description='stop a SOCKS5 server',
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
parser_stop.add_argument('-P', '--pidfile', help='pid file', default=default_pid_file)
|
||||||
|
parser_stop.set_defaults(func=stop_command)
|
||||||
|
parser_status = subparsers.add_parser('status', help='print SOCKS5 server status',
|
||||||
|
description='print SOCKS5 server status',
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
parser_status.add_argument('-P', '--pidfile', help='pid file', default=default_pid_file)
|
||||||
|
parser_status.set_defaults(func=status_command)
|
||||||
|
args = parser.parse_args()
|
||||||
|
args.func(args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue