fscarmen / warp-sh

WARP script is move to: https://gitlab.com/fscarmen/warp
942 stars 203 forks source link

warp是否可以使用新协议 #106

Closed maohais closed 1 month ago

maohais commented 2 months ago

Cloudflare 正式宣布 WARP 将提供 MASQUE 支持

在 Cloudflare WARP 中构建新协议 https://www.cloudflare-cn.com/lp/masque-building-a-new-protocol-into-cloudflare-warp/

通过该协议可以在中国地区连接warp 脚本是否可以直接使用该协议连接warp

fscarmen commented 2 months ago

我要试试。

kay-zhu commented 1 month ago

同求,谢谢!

maohais commented 1 month ago

我要试试。

可以看一下这个linux上的配置方法,不知道对你有没有帮助

kay-zhu commented 1 month ago

能否像之前那样,新协议写进sing-box或xray,实现奈飞和ai解锁?主要是原来的warp解锁的方式engage失效了

fscarmen commented 1 month ago

我要试试。

可以看一下这个linux上的配置方法,不知道对你有没有帮助

谢谢,这个 Mode: WarpProxy (菜单5)这两天试了一下,换了协议,重连状态一直是 Status update: Connecting (不成功)

能否像之前那样,新协议写进sing-box或xray

这个要看 sing-box 和 xray 那边了,不过我估计是不可能了,因为 cf 对 MASQUE 协议是闭源的,不知道如何做第三方客户端了。

maohais commented 1 month ago

谢谢,这个 Mode: WarpProxy (菜单5)这两天试了一下,换了协议,重连状态一直是 Status update: Connecting (不成功)

在脚本中选择WarpProxy模式后连接失败,然后修改配置文件(新建 mdm.xml 放到 /var/lib/cloudflare-warp)启用新协议以后执行sudo systemctl start warp-svc重启服务,再进行连接是能连接上了

fscarmen commented 1 month ago

在脚本中选择WarpProxy模式后连接失败,然后修改配置文件(新建 mdm.xml 放到 /var/lib/cloudflare-warp)启用新协议以后执行sudo systemctl start warp-svc重启服务,再进行连接是能连接上了

我这里还是一直不行呢。

root@instance-20240923-111328:~# warp-cli settings | egrep -i 'proto|mode:'
(user set)      Mode: WarpProxy on port 40000
(Not set)       WARP tunnel protocol: WireGuard

root@instance-20240923-111328:~# ss -nltp
State  Recv-Q Send-Q Local Address:Port    Peer Address:Port Process                                    
LISTEN 0      4096         0.0.0.0:5355         0.0.0.0:*     users:(("systemd-resolve",pid=333,fd=12)) 
LISTEN 0      128          0.0.0.0:22           0.0.0.0:*     users:(("sshd",pid=878,fd=4))             
LISTEN 0      1024       127.0.0.1:40000        0.0.0.0:*     users:(("warp-svc",pid=6107,fd=26))       
LISTEN 0      4096   127.0.0.53%lo:53           0.0.0.0:*     users:(("systemd-resolve",pid=333,fd=19)) 
LISTEN 0      20         127.0.0.1:25           0.0.0.0:*     users:(("exim4",pid=674,fd=4))            
LISTEN 0      4096      127.0.0.54:53           0.0.0.0:*     users:(("systemd-resolve",pid=333,fd=21)) 
LISTEN 0      4096            [::]:5355            [::]:*     users:(("systemd-resolve",pid=333,fd=14)) 
LISTEN 0      128             [::]:22              [::]:*     users:(("sshd",pid=878,fd=3))             
LISTEN 0      20             [::1]:25              [::]:*     users:(("exim4",pid=674,fd=5))            

root@instance-20240923-111328:~# warp-cli disconnect
Success

root@instance-20240923-111328:~# cp /var/lib/cloudflare-warp/mdm.xml.bak /var/lib/cloudflare-warp/mdm.xml

root@instance-20240923-111328:~# cat /var/lib/cloudflare-warp/mdm.xml
<dict>
    <key>warp_tunnel_protocol</key>
    <string>masque</string>
</dict>

root@instance-20240923-111328:~# warp-cli settings | egrep -i 'proto|mode:'
(user set)      Mode: WarpProxy on port 40000
(local policy)  WARP tunnel protocol: MASQUE

root@instance-20240923-111328:~# warp-cli connect
Success

root@instance-20240923-111328:~# warp-cli status
Success
Status update: Connecting

root@instance-20240923-111328:~# systemctl status warp-svc
● warp-svc.service - Cloudflare Zero Trust Client Daemon
     Loaded: loaded (/lib/systemd/system/warp-svc.service; enabled; preset: enabled)
     Active: active (running) since Mon 2024-09-23 12:22:12 UTC; 2h 16min ago
   Main PID: 6107 (warp-svc)
      Tasks: 19 (limit: 651)
     Memory: 57.0M
        CPU: 29.976s
     CGroup: /system.slice/warp-svc.service
             └─6107 /bin/warp-svc

Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: tls=TLSv1.3
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: sni=plaintext
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: warp=off
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: gateway=off
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: rbi=off
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: kex=X25519
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: 2024-09-23T14:39:05.127Z DEBUG happy-eyeballs->
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: 2024-09-23T14:39:05.135Z  WARN happy-eyeballs->
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: 2024-09-23T14:39:05.135Z DEBUG happy-eyeballs->
Sep 23 14:39:05 instance-20240923-111328 warp-svc[6107]: 2024-09-23T14:39:05.135Z DEBUG happy-eyeballs->

root@instance-20240923-111328:~# systemctl restart warp-svc

root@instance-20240923-111328:~# warp-cli status
Status update: Connecting
Success

root@instance-20240923-111328:~# warp-cli status
Status update: Connecting
Success
maohais commented 1 month ago

我今天也连不上了

fscarmen commented 1 month ago

我今天也连不上了

我是在墙外的机器试的,即与gfw无关,要看看有没奇葩办法连接了。

fscarmen commented 1 month ago

是漏了步,可以了,这两天更新一下。

fscarmen commented 1 month ago

已更新 2024.9.24 menu.sh v3.1.3 The Linux Client adds the MASQUE protocol option, available in both Proxy mode (menu 5) and WarpProxy mode (menu 14); Linux Client 增加 MASQUE 协议可选项,Proxy 模式(菜单5)和 WarpProxy 模式(菜单14)都可以使用

maohais commented 1 month ago

感谢大佬

fscarmen commented 1 month ago

对比了一下各个方案的速度,测试机器是 GCP LA 的,测试文件 https://speed.cloudflare.com/__down?bytes=1073741824

方案 版本 模式 协议 平均 第一次 第二次 第三次
原生网络 IPv4 96.7 M 88.0 M 101 M 101 M
client 2024.6.497 warp masque 47.0 M 47.7 M 45.6 M 47.8 M
client 2024.6.497 warp wireguard 42.7 M 42.4 M 42.9 M 42.8 M
client 2024.6.497 proxy masque 8997 k 9042 k 8977k 8972 k
client 2024.6.497 proxy wireguard 9699 k 9676 k 9767 k 9655 k
warp 1.0.20210914 IPv4 wireguard 47.0 M 46.3 M 48.5 M 46.3 M
warp-go 1.0.8 IPv4 wireguard-go 37.8 M 36.4 M 37.8 M 39.2 M
wireproxy 1.0.9 IPv4 Unknow 34.8 M 35.2 M 43.0 M 26.1 M
sing-box 1.10.0-beta.11 Ipv4 socks5 inbound 34.3 M 35.1 M 34.7 M 33.1 M
xray 1.8.24 IPv4 "kernelMode": true 48.6 M 48.0 M 48.3 M 49.6 M
xray 1.8.24 IPv4 "kernelMode": false 4167 k 4119 k 4326 k 4056 k
mihomo alpha-5812a7b IPv4 socks5 inbound 34.0 M 32.2 M 34.8 M 35.1M

sing-box 配置文件

{
    "log": {
        "level": "debug",
        "timestamp": true
    },
    "inbounds": [
        {
            "type": "mixed",
            "listen": "127.0.0.1",
            "listen_port": 5678
        }
    ],
    "outbounds": [
        {
            "type": "direct",
            "tag": "warp-IPv4",
            "detour": "warp",
            "domain_strategy": "ipv4_only"
        },
        {
            "type": "wireguard",
            "tag": "warp",
            "server": "162.159.192.1",
            "server_port": 2408,
            "local_address": [
                "172.16.0.2/32",
                "2606:4700:110:868a:ff3c:d701:290e:ca71/128"
            ],
            "private_key": "2Lq45EoQuWVxQtY6IE/TIxUeeqIvJ8uWck9NXTTewEY=",
            "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
            "reserved": [57, 104, 61],
            "mtu": 1280
        }
    ]
}

Xray 配置文件

{
    "log": {
      "loglevel": "debug",
      "dnsLog": true
    },
    "inbounds": [
        {
            "port": 1080,
            "listen": "127.0.0.1",
            "protocol": "socks"
        }
    ],
    "outbounds": [
        {
            "protocol": "wireguard",
            "settings": {
                "secretKey": "2Lq45EoQuWVxQtY6IE/TIxUeeqIvJ8uWck9NXTTewEY=",
                "address": [
                    "172.16.0.2/32",
                    "2606:4700:110:868a:ff3c:d701:290e:ca71/128"
                ],
                "peers": [
                    {
                        "publicKey": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
                        "allowedIPs": [
                            "0.0.0.0/0",
                            "::/0"
                        ],
                        "endpoint": "162.159.192.1:2408"
                    }
                ],
                "reserved": [57, 104, 61],
                "mtu": 1280,
                "kernelMode": false,
                "domainStrategy": "ForceIPv4"
            }
        }
    ]
}

mihomo 配置文件

mixed-port: 7890
log-level: debug

proxies:
  - name: 'warp'
    type: wireguard
    server: '162.159.192.1'
    port: '2408'
    ip: '172.16.0.2'
    ipv6: '2606:4700:110:868a:ff3c:d701:290e:ca71'
    public-key: 'bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo='
    private-key: '2Lq45EoQuWVxQtY6IE/TIxUeeqIvJ8uWck9NXTTewEY='
    reserved: [57, 104, 61]
    mtu: '1280'
    udp: true

rules:
  - MATCH,warp