赞
踩
参考:
vscode网页版的正确打开方式(建立tunnel-p2p连接)_vscode打开网页_怪力左手的博客-CSDN博客
vscode内网穿透,白嫖10M带宽穿透,remote tunnels远程开发插件,不嫖白不嫖_哔哩哔哩_bilibili
在vps(ubuntu20.04 可出网,无公网ip)上输入如下命令:
需要chisel这个工具,通过websocket转发tcp连接和启动socks5代理,
- cd /tmp;
- curl -L -O https://github.com/jpillora/chisel/releases/download/v1.8.1/chisel_1.8.1_linux_amd64.gz ;
- curl -L -O https://github.com/jpillora/chisel/releases/download/v1.8.1/chisel_1.8.1_windows_amd64.gz;
-
-
- # https://github.com/jpillora/chisel/releases
后来发现,可以不需要下载code-server,/tmp/code会自己下载
- # https://github.com/coder/code-server
- cd /tmp;
-
- curl -L -O https://github.com/coder/code-server/releases/download/v4.13.0/code-server-4.13.0-linux-amd64.tar.gz
- tar -xzvf ./code-server-4.13.0-linux-amd64.tar.gz
-
- /tmp/code-server-4.13.0-linux-amd64/bin/code-server --help
-
- setsid /tmp/chisel server -v -p 60080 --socks5 &
- export PASSWORD="qq5201314";
- setsid /tmp/code-server-4.13.0-linux-amd64/bin/code-server --bind-addr 0.0.0.0:9090 &
-
- # cat ~/.config/code-server/config.yaml
/tmp/code会自行下载vscode-server-linux-x64.tar.gz
- Open this link in your browser https://vscode.dev/tunnel/fv-az801-175/tmp
-
- [2023-05-27 12:00:28] info [tunnels::connections::relay_tunnel_host] Opened new client on channel 2
- [2023-05-27 12:00:28] info [tunnels::connections::relay_tunnel_host] Opened new client on channel 3
- [2023-05-27 12:00:30] info [rpc.0] Checking /root/.vscode-cli/servers/Stable-b3e4e68a0bc097f0ae7907b217c1119af9e03435/log.txt and /root/.vscode-cli/servers/Stable-b3e4e68a0bc097f0ae7907b217c1119af9e03435/pid.txt for a running server...
- [2023-05-27 12:00:30] info [rpc.0] Downloading Visual Studio Code server -> /tmp/.tmpanzfN4/vscode-server-linux-x64.tar.gz
- [2023-05-27 12:00:33] info [rpc.0] Starting server...
- [2023-05-27 12:00:33] info [rpc.0] Server started
# https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server
- # https://code.visualstudio.com/download
-
- cd /tmp;
- curl -L -O https://az764295.vo.msecnd.net/stable/b3e4e68a0bc097f0ae7907b217c1119af9e03435/vscode_cli_alpine_x64_cli.tar.gz
- tar -xzvf ./vscode_cli_alpine_x64_cli.tar.gz
-
- #/tmp/code -h
-
- /tmp/code tunnel --accept-server-license-terms
-
- # 需要输入验证码登录你的github账户,确保你的网络能访问github
点击这个头像显示github已经登录的账户名
打开如下网址(确保你的网络能访问github):
https://vscode.dev/tunnel/fv-az201-614/tmp
显示如下界面:
从命令面板输入conn选择第一条:
在图片的中间位置,有个端口:添加一个转发端口60080(是上面的/tmp/chisel监听的tcp端口)
添加启动端口后,会出来一个URL,复制并打开他,然后需要登录github(和上面的github账户要保持一致),登录后进入下一页面,点击continue,再次跳转,显示Not found.
此时复制本页面的cookie:
.Tunnels.Relay.WebForwarding.Cookies=CfDJ8ILUty0yradLtZEmZVyVSFbthyATb86mjzIvcosSmmEn5R2Rb2zyuDk0HbF3iWdw2Fqsgfw0cafpZAeFj-EvTU7VwxEO9pEEqZ3sLVXkKYUWmZNWILMUBN8drykp8TEn5gsMIzwfXw2E4afg0YmXp5GrM-Px822eK1FK_QfiFUKpXDWWykrBoeDU_TwSpsSmLjj2ieBcMU2hRt1Z3FpDcuxtiXdEdE9hRF9UTpxfGODERWvd-pUTWvhDiSro40DOhSlVwxSS0_igahsEH4tNG6FH_Uqiipub7VkxeVq4h-gN6fY83OtBwnMf5kWEbYGgRpZL1f_WFe4eOUvrHI7JWgGO9quG55OOWUCvZZvV8ayqaTr3ZlM_qL6xfvt1kp5X0BaHDLHEKQquoPsvFYJZbhQ3Ph5lF_CRSyOg4zkyfPLPWwTr9X-h_CSntQeeI0RbmsDpiukvYBj57Uf2ekP8_cP2b1JL0EUsEP7mMKqKNB9Sde9QiGUceu5ARfGarWdDYcrfioPwA9Dx-WsLs2tiinYvrAf7XDACBkoM-FXlCYusWr6ji3XI0MfD1NDZ1bOUC6mdzyToFQRfOOOqbnQRzg5qT9pihI6T5H58Y1NDdARY0CM-R2XhOhxVCD2rsTpwqe7u5WQPiQDjKNECximWxfs_Wa1N52ic-Ffd3-FMPubXF-GP25_g0v_yT-GbveeVk7gwX37HW_3DsC06hpS7Wwc44SD_igNlMiP0xnv5-gCwX5B6YxyEfX8edoWYjWZaRZ2uDZS_SIutow8o_fo6qTamBHgbV8G4TZ8Mh6rWaJmqOTaDpOIhBsFS2sjxXJHzGTib9Gn0KhrfFMX7l_hV-AMW8BP4XrjwUU2mnpK5D_VdTbmVR-w6DgihKdmivMi4MFz5Su53prVBryWK-NNbXx-B6RshHdJkn12BHdbu6gvf9KDPIT6eqZXzJQ5mlMOYfRQecmD1avrmlcE12WGE97aPgFBZ6EwAl24hWw6il1pW8mxv4oOzEoNXMBt-F37iY67MI-irYzfLu4K_amfnSfnJFphSJ_XqTIRMRpJnBm2yfgfztd46flteetSnWu5Fuo53zh0D6AfG_ZPeIOUGS4JUVnkJL844wNjN6WU2PCam30Or8Zj3Qcv1pPNvIZm7vvw9G-SHX-ymxWmAsegb2mvK0z3JdInP38LeDuBPb77SoUpsEN25cakuE95GO8IW75lmk7ukQW41s1VgxD_juQ5pqNK_wCMw2GEKh5baF3mU1q1TKa1YZJYO0ULBubw5a_rnKU1PcTQMUnsVCTIx5cJakPIkM0Fiso0gJTDEHeOhvMcb_Itn6NucLHW-FudifxtHap71Eq0ZFMgstkyqYgvGVXj_n1g2fGl6iPfhm5LrCeHzaBXtt9SWUgXi79tLI1xKC5XTm-ebqWLNEQHy6U8nf667TFp57uYUkRitMq8h5jTpb8Z0unH7qPnnTo1xeQ; tunnel_phishing_protection=v3kzr7k9.usw3
在本地PC上,启动chisel客户端:
chisel.exe client -v --header "Cookie: .Tunnels.Relay.WebForwarding.Cookies=CfDJ8ILUty0yradLtZEmZVyVSFbthyATb86mjzIvcosSmmEn5R2Rb2zyuDk0HbF3iWdw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qcv1pPNvIZm7vvw9G-SHX-ymxWmAsegb2mvK0z3JdInP38LeDuBPb77SoUpsEN25cakuE95GO8IW75lmk7ukQW41s1VgxD_juQ5pqNK_wCMw2GEKh5baF3mU1q1TKa1YZJYO0ULBubw5a_rnKU1PcTQMUnsVCTIx5cJakPIkM0Fiso0gJTDEHeOhvMcb_Itn6NucLHW-FudifxtHap71Eq0ZFMgstkyqYgvGVXj_n1g2fGl6iPfhm5LrCeHzaBXtt9SWUgXi79tLI1xKC5XTm-ebqWLNEQHy6U8nf667TFp57uYUkRitMq8h5jTpb8Z0unH7qPnnTo1xeQ; tunnel_phishing_protection=v3kzr7k9.usw3" https://v3kzr7k9-60080.usw3.devtunnels.ms/ 0.0.0.0:6080:socks
这样本地的tcp6080就是sock5服务,可以用作xshell连接ubuntu vps的SSH服务.
- # cd /tmp; python3 -m http.server 80 &
-
- # cp /tmp/code /var/www/html/
-
-
- curl -o z:\code3 -x socks5h://127.0.0.1:6080 "http://127.0.0.1:80/code"
-
如下图所示:下载速度大约是10kb-25kb,但若没有经过chisel,而是直接穿透apache的http服务(tcp30080),经过认证(登录github)后,下载速度大约是550kb-600kb每秒
问题(尚未找到方法解决):
github异地登录,需要验证码,导致无法打开(Visual Studio Code for the Webhttps://vscode.dev/tunnel/fv-az47-59):
- root@fv-az47-59:/tmp# /tmp/code tunnel --accept-server-license-terms
- *
- * Visual Studio Code Server
- *
- * By using the software, you agree to
- * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
- * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
- *
- To grant access to the server, please log into https://github.com/login/device and use code 80BD-5360
- ✔ What would you like to call this machine? ·
- [2023-05-27 11:47:00] info Names can only contain letters, numbers, and '-'. Spaces, commas, and all other special characters are not allowed. Please try a different name.
- ✔ What would you like to call this machine? · # 需要输入验证码登录你的github账户,确保你的网络能访问github
- [2023-05-27 11:47:14] info Names cannot be longer than 20 characters. Please try a different name.
- ✔ What would you like to call this machine? · fv-az47-59
- [2023-05-27 11:47:19] info Creating tunnel with the name: fv-az47-59
-
- Open this link in your browser https://vscode.dev/tunnel/fv-az47-59/tmp
-
- ^C[2023-05-27 11:48:16] info Shutting down: Ctrl-C receive
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。