【记录】SOCKS5 转 QUIC

Last updated on March 19, 2024 pm

准备工作

  1. 安装好 docker
  2. Warp 与 Tor 共存
  3. Nginx格式的域名证书和密钥,域名解析到服务器

SOCKS5 转 QUIC

1
2
3
4
5
6
7
docker run --rm --net=sswitch alpine ping socks5 # 记录 socks5 的 ip
mkdir -p ~/app/hysteria && cd ~/app/hysteria && nano docker-compose.yml && nano ./hysteria.json
# 将json文件里的 socks5:5353 中的 socks5 改为 socks5 对应的 ip (如172.18.0.2)
# 申请证书并上传,改名为 my.pem my.key
sudo docker-compose up -d && sudo docker-compose logs
iptables -t nat -L # 查看 QUIC 容器的 ip
iptables -t nat -A DOCKER -p udp --dport 32768:61000 -j DNAT --to-destination 172.18.0.4:3234 # 模仿 docker 的操作,将 32768:61000 都映射到 QUIC 容器的 3234 端口
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
version: '3.9'
services:
hysteria:
image: tobyxdd/hysteria
restart: always
ports:
- '13234:3234/udp'
volumes:
- ./hysteria.json:/etc/hysteria.json
- ./my.key:/home/ubuntu/my.key
- ./my.pem:/home/ubuntu/my.crt
command: ["server", "--config", "/etc/hysteria.json"]

networks:
default:
external: true
name: sswitch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"listen": ":3234",
"protocol": "udp",
"cert": "/home/ubuntu/my.crt",
"key": "/home/ubuntu/my.key",
"obfs": "26位随机英文数字字符",
"up_mbps": 100,
"down_mbps": 100,
"resolver": "udp://1.1.1.1:53",
"resolve_preference": "46",
"socks5_outbound": {
"server": "socks5:5353"
}
}

QUIC 转 SOCKS5

通用配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"server": "证书对应的域名:32768-61000",
"obfs": "前面的26位随机字符",
"idle_timeout": 30,
"hop_interval": 61,
"up_mbps": 10,
"down_mbps": 50,
"socks5": {
"listen": "0.0.0.0:1580"
},
"http": {
"listen": "0.0.0.0:8580"
}
}

Linux 平台

1
2
mkdir -p ~/app/hysteria && cd ~/app/hysteria && nano docker-compose.yml && nano ./hysteria.json
sudo docker-compose up -d && sudo docker-compose logs
1
2
3
4
5
6
7
8
9
10
11
12
version: '3.9'
services:
hysteria:
image: tobyxdd/hysteria
restart: always
ports:
- '1580:1580'
- '1580:1580/udp'
- '8580:8580'
volumes:
- ./hysteria.json:/etc/hysteria.json
command: ["--config", "/etc/hysteria.json"]

Windows 平台

下载对应平台的程序文件 QUIC
在程序目录创建配置文件和下面的 run.bat 文件

1
hysteria-windows-amd64.exe -c quic.json

或者 run.ps1 文件

1
2
3
4
# set-executionpolicy remotesigned
# New-PSDrive HKCR Registry HKEY_CLASSES_ROOT
# Set-ItemProperty HKCR:\\Microsoft.PowerShellScript.1\\Shell '(Default)' 0
.\hysteria-windows-amd64.exe -c .\quic.json

【记录】SOCKS5 转 QUIC
https://hexo.limour.top/-ji-lu-SOCKS5-zhuan-QUIC
Author
Limour
Posted on
July 1, 2023
Updated on
March 19, 2024
Licensed under