Git Product home page Git Product logo

sniproxy's Introduction

XIU2/SNIProxy

Go Version Release Version GitHub license GitHub Star GitHub Fork

🧷 自用的一个功能很简单的 SNIProxy 顺便分享出来给有同样需求的人,用得上的话可以点个⭐支持下~

SNIProxy 是一个根据传入域名(SNI)来自动端口转发至该域名源服务器的工具,常用于网站多服务器负载均衡,而且因为是通过明文的 SNI 来获取目标域名,因此不需要 SSL 解密再加密,转发速度和效率自然也大大提高了。

Important

注意!SNIProxy 只是起到一个端口转发、负载均衡的作用。简单的来说就是 SNIProxy 收到的所有数据都会被原封不动的转发给目标源服务器(包括明文的 SNI 域名信息,任何第三方例如墙依然能直接看到),因此 SNIProxy 是 无法用来番墙 的(否则就是脱裤子放屁 —— 多此一举! 毕竟墙早就可以 域名(SNI)阻断 了)。

分享我其他开源项目:TrackersList.com - 全网热门 BT Tracker 列表!有效提高 BT 下载速度~
CloudflareSpeedTest - 🌩「自选优选 IP」测试 Cloudflare CDN 延迟和速度,获取最快 IP~
UserScript - 🐵 Github 高速下载、知乎增强、自动无缝翻页、护眼模式 等十几个油猴脚本~


# 软件介绍

  1. 支持 全平台、全系统(Go 语言特性)
  2. 支持 Socks5 前置代理(比如可以再套一层 WARP,这样 SNIProxy 的出口 IP 就是 Cloudflare 的了)
  3. 支持 允许所有域名 仅允许指定域名(包含域名自身及其所有子域名)

Warning

注意!SNIProxy 仅为我个人自写自用,可靠性、稳定性等方面不如专业的商业软件(如 Nginx、HAProxy),因此在正式的生产环境下不建议使用本软件,如造成损失,根据 GPL-3.0 本项目无需承担责任(溜了溜了~


SNIProxy 的工作流程大概如下:

  1. 解析传入连接中的 TLS/SSL 握手消息,以获取访客发送的 SNI 域名信息。
  2. 检查域名是否在允许列表中(或开启了 allow_all_hosts),如果不在将中断连接,反之继续。
  3. 使用系统 DNS 解析 SNI 域名获得 IP 地址(即该域名的源站服务器 IP 地址)。
  4. 将收到的数据原封不动的转发给该域名的源站 IP:443,在访客和源站之间建立一个 "桥梁" 进行持续的相互数据传输(即 TCP 中转/端口转发)。
// 将 example.com 域名指向 SNIProxy 服务器的 IP,然后:
访问 example.com <=> SNIProxy(解析 SNI 获得目标域名) <=> 源站(example.com)

// 例如:当有多台服务器配置 SNIProxy 后,可以在域名 DNS 解析中指向这些服务器 IP,这样访客就会被随机分配到其中一个服务器上,实现分流负载均衡等。
// 也可以依靠 DNS 区域解析来给不同地区、运营商的访客指向离它们更近、线路更优的服务器 IP,来间接提高网站的访问速度,提升用户体验。

// 如果 SNIProxy 开启了前置代理,那么就是这样:
访问 example.com <=> SNIProxy <=> Socks5(解析 SNI 获得目标域名) <=> 源站(example.com)

Tip

SNIProxy 本质上也是一种端口转发(中转),但不同于端口转发只能指定一个固定的目标 IP,SNIProxy 可以通过 DNS 解析传入的域名来获得灵活的目标 IP(传入不同的域名走不同目标 IP,可同时存在互不干扰)。


# 使用方法

「 点击查看 Linux 系统下的使用示例 」

以下命令仅为示例,版本号和文件名请前往 Releases 查看。

# 如果是第一次使用,则建议创建新文件夹(后续更新时,跳过该步骤)
mkdir sniproxy

# 进入文件夹(后续更新,只需要从这里重复下面的下载、解压命令即可)
cd sniproxy

# 下载 sniproxy 压缩包(自行根据需求替换 URL 中 [版本号] 和 [文件名])
wget -N https://github.com/XIU2/SNIProxy/releases/download/v1.0.1/sniproxy_linux_amd64.tar.gz
# 如果你是在国内服务器上下载,那么请使用下面这几个镜像加速:
# wget -N https://download.scholar.rr.nu/XIU2/SNIProxy/releases/download/v1.0.1/sniproxy_linux_amd64.tar.gz
# wget -N https://ghproxy.cc/https://github.com/XIU2/SNIProxy/releases/download/v1.0.1/sniproxy_linux_amd64.tar.gz
# wget -N https://ghproxy.net/https://github.com/XIU2/SNIProxy/releases/download/v1.0.1/sniproxy_linux_amd64.tar.gz
# wget -N https://gh-proxy.com/https://github.com/XIU2/SNIProxy/releases/download/v1.0.1/sniproxy_linux_amd64.tar.gz
# wget -N https://mirror.ghproxy.com/https://github.com/XIU2/SNIProxy/releases/download/v1.0.1/sniproxy_linux_amd64.tar.gz

# 如果下载失败的话,尝试删除 -N 参数(如果是为了更新,则记得提前删除旧压缩包 rm sniproxy_linux_amd64.tar.gz )

# 解压(不需要删除旧文件,会直接覆盖,自行根据需求替换 文件名)
tar -zxf sniproxy_linux_amd64.tar.gz

# 赋予执行权限
chmod +x sniproxy

# 编辑配置文件(根据下面的 配置文件说明 来自定义配置内容并保存(按下 Ctrl+X 然后再按 2 下回车)
nano config.yaml

# 运行(不带参数)
./sniproxy

# 运行(带参数示例)
./sniproxy -c "config.yaml"

# 后台运行(带参数示例)
nohup ./sniproxy -c "config.yaml" > "sni.log" 2>&1 &

另外,强烈建议顺便提高一下 系统文件句柄数上限,避免遇到报错 too many open files

另外,如果你希望 开机启动、守护进程(异常退出自动恢复)、后台运行、方便管理 等,那么可以将其 注册为系统服务


「 点击查看 Windows 系统下的使用示例 」

下载

下载已编译好的可执行文件并解压:

  1. Github Releases
  2. 蓝奏云(密码:xiu2)

配置

找到配置文件 config.yaml 右键菜单 - 打开方式 - 记事本。

根据下面的 配置文件说明 来自定义配置内容并保存。

运行

双击运行 sniproxy.exe 文件。

或者在 CMD 命令行中进入软件所在目录并运行 sniproxy.exe

# CMD 命令行中进入解压后的 sniproxy 程序所在目录(记得修改下面示例路径)
cd /d C:\xxx\sniproxy

# 运行(不带参数)
sniproxy.exe

# 运行(带参数示例)
sniproxy.exe -c "config.yaml"

「 点击查看 Mac 系统下的使用示例 」

下载已编译好的可执行文件并解压:

  1. Github Releases
  2. 蓝奏云(密码:xiu2)
# 通过命令行进入 sniproxy 压缩包所在目录(记得修改下面示例路径)
cd /xxx/xxx

# 解压(不需要删除旧文件,会直接覆盖,自行根据需求替换 文件名)
tar -zxf sniproxy_linux_amd64.tar.gz

# 赋予执行权限
chmod a+x sniproxy

# 编辑配置文件(根据下面的 配置文件说明 来自定义配置内容并保存(按下 Contrl+X 然后再按 2 下回车)
nano config.yaml

# 运行(不带参数)
./sniproxy

# 运行(带参数示例)
./sniproxy -c "config.yaml"

home@xiu:~# ./sniproxy -h

SNIProxy vX.X.X
https://github.com/XIU2/SNIProxy

参数:
    -c config.yaml
        配置文件 (默认 config.yaml)
    -l sni.log
        日志文件 (默认 无)
    -d
        调试模式 (默认 关)
    -v
        程序版本
    -h
        帮助说明

# 其他说明

# 配置文件说明 (config.yaml)

「 点击展开 查看内容 」

注意: 配置文件是 YAML 格式,即按照缩进(即每行前面的空格数量)来确定层级关系的,因此不懂的话请按照默认配置文件内示例的格式为准,其中 # 的是注释(会被程序忽略),不需要的配置可以注释掉。

目前配置文件中的配置项没几个,分别为:

# 监听端口(注意需要引号),常见示例如下:
# ":443"            省略 IP 只写端口,代表监听本机所有 IPv4+IPv6 地址的 443 端口
# "0.0.0.0:443"     代表监听本机所有 IPv4 地址的 443 端口
# "127.0.0.1:443"   代表监听本机本地 IPv4 地址的 443 端口(只有本机可访问)
# "[::]:443"        代表监听本机所有 IPv6 地址的 443 端口
# "[::1]:443"       代表监听本机本地 IPv6 地址的 443 端口(只有本机可访问)
# 上面示例中的 IP 地址也可以换成例如你的外网 IP,这样的话就只能从该外网 IP 访问了
listen_addr: ":443"

# 可选:启用 Socks5 前置代理
# (启用前:访客 <=> SNIProxy <=> 目标网站
# (启用后:访客 <=> SNIProxy <=> Socks5 <=> 目标网站
# (比如可以套 WARP,那样就变成:访客 <=> SNIProxy <=> WARP <=> 目标网站
enable_socks5: true
# 可选:配置 Socks5 代理地址
socks_addr: 127.0.0.1:40000

# 可选:允许所有域名(开启后会忽略下面的 rules 列表)
allow_all_hosts: true

# 可选:仅允许指定域名(和上面的 allow_all_hosts 二选一)
# 指定域名后,则代表允许 域名自身 及其 所有子域名 访问服务(以下方两个为例,√ 代表允许,× 代表阻止)
rules:
  - example.com #    example.com  √ 、a.example.com  √ 、a.a.example.com  √
  - b.example2.com # example2.com × 、b.example2.com √ 、c.b.example2.com √

一些示例:

  1. 允许所有域名访问
listen_addr: ":443"
allow_all_hosts: true

注意,开启 allow_all_hosts 时,可能会被他人扫描到而滥用,请悉知!
建议做一些限制,例如只使用 IPv6("[::]:443")或防火墙限制 443 端口的可访问 IP。

  1. 仅允许指定域名
listen_addr: ":443"
rules:
  - example.com
  - b.example2.com
  1. 允许所有域名访问 + 启用前置代理
listen_addr: ":443"
enable_socks5: true
socks_addr: 127.0.0.1:40000
allow_all_hosts: true
  1. 仅允许指定域名 + 启用前置代理
listen_addr: ":443"
enable_socks5: true
socks_addr: 127.0.0.1:40000
rules:
  - example.com
  - b.example2.com

# Linux 配置为系统服务 (systemd - 以支持开机启动、守护进程等)

「 点击展开 查看内容 」

新建一个空的名叫 sniproxy 的系统服务配置文件:

nano /etc/systemd/system/sniproxy.service

修改以下内容后(ExecStart= 后面的程序路径、参数)后粘贴进文件内:

[Unit]
Description=SNI Proxy
After=network.target

[Service]
ExecStart=/home/sniproxy/sniproxy -c /home/sniproxy/config.yaml -l /home/sniproxy/sni.log
Restart=on-failure

[Install]
WantedBy=multi-user.target

其中 Restart=on-failure 表示,当程序非正常退出时,会自动恢复启动,也就是常说的守护进程。

设置 sniproxy 开机启动并立即启动:

# 启用该系统服务 并 允许开机启动
systemctl enable sniproxy

# 立即启动
systemctl start sniproxy

其他可能会用到的命令:

# 停止
systemctl stop sniproxy

# 重启
systemctl restart sniproxy

# 查看运行状态
systemctl status sniproxy

# 查看完整日志
cat /home/sniproxy/sni.log

# 实时监听日志(会实时显示最新日志内容)
tail -f /home/sniproxy/sni.log

# 如果你修改了 /etc/systemd/system/sniproxy.service 配置文件,那么需要先重载配置后才能启动/重启 sniproxy 服务
systemctl daemon-reload

# 提高系统文件句柄数上限 (避免报错 too many open files)

「 点击展开 查看内容 」

Linux 系统下,一些人可能会遇到报错(日志如下):

接受连接请求时出错: accept tcp [::]:443: accept4: too many open files

这是因为系统的文件句柄数耗尽了(默认 1024),提高系统文件句柄数上限可有效缓解该问题(不能完全解决,因为理论上,当打开文件、连接等等足够多时,迟早会耗尽,一般来说不管是做代理还是做网站,这个操作都是必须的)。

  • 临时提高(重启后恢复为 1024)
ulimit -n 65535
  • 永久提高(重启后依然为 65535,当然打开文件后手动删除就恢复了)
echo "* soft nofile 65535
* hard nofile 65535
root soft nofile 65535
root hard nofile 65535" >> /etc/security/limits.conf

执行以上命令后,需要重启 SNIProxy 来使其生效,如果还不行请尝试重启系统。

systemctl restart sniproxy

问题反馈

如果你遇到什么问题,可以先去 IssuesDiscussions 里看看是否有别人问过了(记得去看下 Closed 的)。
如果没找到类似问题,请新开个 Issues 来告诉我!

Note

反馈问题、功能建议 无关的,请前往项目内部 论坛 讨论(上面的 💬 Discussions


赞赏支持

微信赞赏支付宝赞赏


手动编译

「 点击展开 查看内容 」

为了方便,我是在编译的时候将版本号写入代码中的 version 变量,因此你手动编译时,需要像下面这样在 go build 命令后面加上 -ldflags 参数来指定版本号:

go build -ldflags "-s -w -X main.version=v1.0.1"
# 在 SNIProxy 目录中通过命令行(例如 CMD、Bat 脚本)运行该命令,即可编译一个可在和当前设备同样系统、位数、架构的环境下运行的二进制程序(Go 会自动检测你的系统位数、架构)且版本号为 v1.0.1

如果想要在 Windows 64位系统下编译其他系统、架构、位数,那么需要指定 GOOSGOARCH 变量。

例如在 Windows 系统下编译一个适用于 Linux 系统 amd 架构 64 位的二进制程序:

SET GOOS=linux
SET GOARCH=amd64
go build -ldflags "-s -w -X main.version=v1.0.1"

例如在 Linux 系统下编译一个适用于 Windows 系统 amd 架构 32 位的二进制程序:

GOOS=windows
GOARCH=386
go build -ldflags "-s -w -X main.version=v1.0.1"

可以运行 go tool dist list 来查看当前 Go 版本支持编译哪些组合。


当然,为了方便批量编译,我会专门指定一个变量为版本号,后续编译直接调用该版本号变量即可。
同时,批量编译的话,还需要分开放到不同文件夹才行(或者文件名不同),需要加上 -o 参数指定。

:: Windows 系统下是这样:
SET version=v1.0.1
SET GOOS=linux
SET GOARCH=amd64
go build -o Releases\sniproxy_linux_amd64\sniproxy -ldflags "-s -w -X main.version=%version%"
# Linux 系统下是这样:
version=v1.0.1
GOOS=windows
GOARCH=386
go build -o Releases/sniproxy_windows_386/sniproxy.exe -ldflags "-s -w -X main.version=${version}"

Credit

The source code has been adapted from FastGitORG/F-Proxy-Agent and TachibanaSuzume/SNIProxyGo .

Thank them for their help!


License

The GPL-3.0 License.

sniproxy's People

Contributors

neotf avatar xiu2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sniproxy's Issues

当开启全部转发的时候,会产生很多自己转发给自己的请求,导致too many file 崩溃

问题描述

^[[1;0;32m2024/02/26 23:05:57 转发目标: 服务器IP:443^[[0m
^[[1;0;32m2024/02/26 23:05:57 连接来自: 服务器IP:54222^[[0m
^[[1;0;32m2024/02/26 23:05:57 转发目标: 服务器IP:443^[[0m
^[[1;0;32m2024/02/26 23:05:57 连接来自: 服务器IP:54222^[[0m
^[[1;0;32m2024/02/26 23:05:57 转发目标: 服务器IP:443^[[0m
^[[1;0;32m2024/02/26 23:05:57 连接来自: 服务器IP:54222^[[0m
^[[1;0;32m2024/02/26 23:05:57 转发目标: 服务器IP:443^[[0m
^[[1;0;32m2024/02/26 23:05:57 连接来自: 服务器IP:54222^[[0m
^[[1;0;31m2024/02/26 23:05:57 接受连接请求时出错: accept tcp [::]:443: accept4: too many open files^[[0m
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x557721]

goroutine 6 [running]:
main.startSniProxy.func1({0x5c8ac0?, 0xc00000c198})
C:/Github/SNIProxy/main.go:110 +0x101
created by main.startSniProxy

软件版本

v1.0.0

附加截图

No response

长时间运行报错:panic: runtime error: invalid memory address or nil pointer dereference

问题描述

运行一段时间过后程序会报错自动退出,使用了socket5代理,systemctl内的日志是:
7月 30 17:50:25 ECS774 sniproxy[1233074]: panic: runtime error: invalid memory address or nil pointer dereference
7月 30 17:50:25 ECS774 sniproxy[1233074]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x557721]
7月 30 17:50:25 ECS774 sniproxy[1233074]: goroutine 6 [running]:
7月 30 17:50:25 ECS774 sniproxy[1233074]: main.startSniProxy.func1({0x5c8ac0?, 0xc00000c1e0})
7月 30 17:50:25 ECS774 sniproxy[1233074]: C:/Github/SNIProxy/main.go:110 +0x101
7月 30 17:50:25 ECS774 sniproxy[1233074]: created by main.startSniProxy
7月 30 17:50:25 ECS774 sniproxy[1233074]: C:/Github/SNIProxy/main.go:103 +0x1a5
7月 30 17:50:25 ECS774 systemd[1]: sniproxy.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
7月 30 17:50:25 ECS774 systemd[1]: sniproxy.service: Failed with result 'exit-code'.
7月 30 17:50:25 ECS774 systemd[1]: sniproxy.service: Consumed 18.125s CPU time.

软件版本

v1.0.0

附加截图

No response

listen IPv6存在解析问题

问题描述

最早是前几天在Debian10的服务器上出现的,后在Windows上可复现,同样操作替换为IPv4时正常。
image

listen仅IPv6或本地,比如:

listen_addr: [::]:443
listen_addr: [::1]:443

报错:配置文件解析失败: yaml: line 1: did not find expected node content

listen特定IPv6地址,比如:

listen_addr: [240c::6666]:443

报错:配置文件解析失败: yaml: line 1: did not find expected key

软件版本

v1.0.0

bug

问题描述

运行一天好好的 第二天就这样了 日志刷了好几分钟才出来 下面全是这个

goroutine 2141496 [chan send]:
main.ioReflector({0x7f7793a1b048?, 0xc0a76f3380}, {0x5c83e0, 0xc0a74d3ec0}, 0x0, 0xc09c2f7620, {0xc06c7e24a0, 0x10}, {0xc06c8ba2b8, 0x11})
        C:/Github/SNIProxy/main.go:230 +0x2b1
created by main.forward
        C:/Github/SNIProxy/main.go:212 +0x325

goroutine 2141497 [chan send]:
main.onDisconnect({0x7f7793a1b048?, 0xc0a74d3ec0?}, 0xc0000a20d0?)
        C:/Github/SNIProxy/main.go:238 +0x3d
main.ioReflector({0x7f7793a1b048?, 0xc0a74d3ec0}, {0x5c83e0, 0xc0a76f3380}, 0x1, 0xc09c2f7620, {0xc06c7e24a0, 0x10}, {0xc06c8ba2b8, 0x11})
        C:/Github/SNIProxy/main.go:231 +0x2c3
created by main.forward
        C:/Github/SNIProxy/main.go:213 +0x44a

goroutine 2141508 [chan send]:
main.onDisconnect({0x7f7793a1b048?, 0xc0a74d3ec8?}, 0xc0001aa410?)
        C:/Github/SNIProxy/main.go:238 +0x3d
main.ioReflector({0x7f7793a1b048?, 0xc0a74d3ec8}, {0x5c83e0, 0xc0a92961f0}, 0x1, 0xc09c604180, {0xc06c7e2510, 0x10}, {0xc06c220db0, 0x11})
        C:/Github/SNIProxy/main.go:231 +0x2c3
created by main.forward
        C:/Github/SNIProxy/main.go:213 +0x44a

软件版本

最新版

附加截图

No response

dalao 考虑出个 docker 版的吗

功能需求

dalao 考虑出个 docker 版的吗? 服务器上的有 nginx 了, 要是能打包进镜像内, 然后分配个 ipv6 地址给容器就可以独立存在了. 实在是不太会打包镜像 😂

预期目标

打包到容器内, 通过容器一键启动

DNS

功能需求

DNS 53端口 会把域名解析到错误地址, 如果使用5353端口将解析到正确地址,
但是5353 端口被系统“DNS Client”服务 占用, 系统 ”DNS Client“ 使用5353 端口,也解析度到错误地址 , 使用外国dns 也一样解析错误!

以openDNS 208.67.222.222 为测试例子 53端口

C:\BIND9.16.43.x64>dig f-droid.org @208.67.222.222 -p 53

; <<>> DiG 9.16.43 <<>> f-droid.org @208.67.222.222 -p 53
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51303
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;f-droid.org.                   IN      A

;; ANSWER SECTION:
f-droid.org.            200     IN      A       104.244.43.228

;; Query time: 31 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Tue Oct 24 11:56:02 Malay Peninsula Standard Time 2023
;; MSG SIZE  rcvd: 45

以openDNS 208.67.222.222 为测试例子 5353端口

C:\BIND9.16.43.x64>dig f-droid.org @208.67.222.222 -p 5353

; <<>> DiG 9.16.43 <<>> f-droid.org @208.67.222.222 -p 5353
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51300
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;f-droid.org.                   IN      A

;; ANSWER SECTION:
f-droid.org.            368     IN      A       65.21.79.229
f-droid.org.            368     IN      A       136.243.44.143

;; Query time: 31 msec
;; SERVER: 208.67.222.222#5353(208.67.222.222)
;; WHEN: Tue Oct 24 11:56:09 Malay Peninsula Standard Time 2023
;; MSG SIZE  rcvd: 45

预期目标

  • config.yaml 支持 自定义DNS 和 端口
  • 支持 DNS-over-QUIC 和 DNSCrypt 协议 解析到正确IP

SNIProxy可否转发非TLS端口流量?

问题描述

经过测试SNIProxy可以正常转发TLS端口(例如443)流量,不能转发80端口流量。

如何设置才能转发非TLS端口流量呢?感谢~

软件版本

v1.0.0

附加截图

No response

接受连接请求时出错: accept tcp [::]:443: accept4: too many open files

问题描述

在启动监听后,当有请求传入时会出现:

2023/06/08 10:41:05 接受连接请求时出错: accept tcp [::]:443: accept4: too many open files
2023/06/08 10:41:05 转发目标: steamcommunity.com:443
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x144b1c]

goroutine 18 [running]:
main.startSniProxy.func1({0x1be218?, 0x4000114180})
	C:/Github/SNIProxy/main.go:110 +0xcc
created by main.startSniProxy
	C:/Github/SNIProxy/main.go:103 +0x174```

软件版本

XIU2/SNIProxy v1.0.0

附加截图

No response

谷歌浏览器最新版本 使用异常

问题描述

读取到的数据 [22 3 1 7 30 1 0 7 26 3 3 209 95 123 30 15 130 52 226 234 104 177 127 112 115 190 104 215 231 18 75 11 33 230 196 225 235 51 10 163 211 152 170 32 118 85 179 166 254 91 164 5 18 148 23 193 213 124 61 207 242 239 212 224 162 249 161 117 98 96 87 224 25 152 110 125 0 32 106 106 19 1 19 2 19 3 192 43 192 47 192 44 192 48 204 169 204 168 192 19 192 20 0 156 0 157 0 47 0 53 1 0 6 177 26 26 0 0 0 16 0 14 0 12 2 104 50 8 104 116 116 112 47 49 46 49 0 45 0 2 1 1 254 13 1 26 0 0 1 0 1 244 0 32 218 209 140 137 230 125 121 195 98 72 15 54 51 237 63 55 209 151 252 40 129 86 45 166 247 238 109 118 60 29 194 64 0 240 146 103 192 96 59 66 32 89 113 196 0 112 232 211 82 130 55 205 26 6 26 5 224 252 91 22 99 77 108 146 160 29 120 59 149 104 239 42 174 112 173 149 27 74 9 178 151 255 98 61 202 194 170 238 199 70 121 154 114 220 44 114 251 243 207 116 32 132 240 203 43 171 19 226 168 13 235 47 17 20 245 135 253 51 64 10 48 121 213 165 67 183 206 188 192 48 149 234 120 56 121 156 47 18 188 93 62 221 120 77 139 9 115 125 69 141 189 164 249 194 115 178 168 215 20 212 236 75 106 26 221 89 161 38 175 214 54 203 18 31 250 70 132 79 54 85 208 169 219 74 0 230 238 130 173 249 14 172 44 70 209 73 220 40 56 61 149 152 239 195 71 57 183 132 45 141 122 94 88 183 157 160 55 4 188 160 177 75 174 104 163 209 48 49 159 141 214 19 101 160 83 91 190 195 246 173 213 16 218 116 168 74 5 253 161 74 224 147 250 179 139 34 87 12 201 193 157 253 27 181 134 82 200 219 223 38 134 71 205 217 0 51 4 239 4 237 90 90 0 1 0 99 153 4 192 152 98 143 162 103 160 140 208 223 71 41 206 215 202 115 83 242 209 63 116 60 82 50 19 172 39 30 99 150 54 123 70 28 85 136 55 219 41 206 96 25 3 172 16 75 3 23 182 128 103 240 219 177 28 181 187 56 218 107 179 184 6 128 184 126 170 201 58 111 236 67 187 180 150 253 184 61 76 60 85 194 186 188 209 162 173 134 100 13 43 249 156 211 178 176 145 234 37 22 106 106 128 49 160 63 164 144 66 59 138 244 64 139 77 100 136 67 116 93 132 247 61 107 130 82 116 27 114 83 250 122 242 233 103 205 172 190 97 209 79 41 185 194 150 202 116 254 69 18 0 104 92 159 183 201 134 244 86 92 138 32 36 112 73 22 247 58 7 72 146 13 42 113 41 64 174 233 247 125 234 48 102 231 53 15 20 195 132 151 199 167 201 100 129 121 81 99 248 66 205 142 153 13 156 34 131 244 12 94 115 122 87 49 153 179 18 246 17 36 33 7 184 184 44 138 214 50 113 98 94 96 38 176 6 149 53 61 225 94 230 53 166 220 204 133 31 100 166 187 38 176 85 148 164 29 34 46 129 153 194 45 69 26 10 155 187 22 104 152 185 202 99 99 75 95 103 84 34 33 33 179 139 7 31 242 236 160 165 250 49 182 148 62 136 184 204 195 96 62 73 51 20 187 98 22 88 185 23 164 116 53 141 60 131 143 135 42 81 59 117 126 115 3 145 172 8 42 107 131 58 218 51 107 76 157 16 117 62 132 193 91 144 28 32 80 52 167 27 124 97 90 130 175 231 49 197 94 49 29 116 202 31 180 144 179 182 98 42 79 183 119 117 199 89 13 134 98 57 148 167 129 92 157 169 25 130 192 249 70 20 106 0 83 149 53 200 233 27 217 215 132 171 64 65 242 89 109 198 52 89 237 139 66 194 204 117 175 200 180 60 136 85 169 83 16 149 136 45 125 251 61 44 250 43 1 171 120 148 8 29 84 92 18 130 57 183 237 102 204 3 91 72 246 150 82 18 138 144 252 138 116 77 96 168 103 251 54 76 42 60 182 156 56 103 231 85 231 81 165 201 195 126 220 130 121 36 92 15 155 180 172 81 165 113 63 242 65 72 66 76 198 209 172 23 132 118 76 12 208 215 133 92 226 195 62 1 250 133 30 103 206 101 177 13 204 19 18 59 69 32 101 103 111 143 188 165 197 17 139 109 88 180 110 76 15 42 96 86 103 118 174 190 236 90 4 209 88 28 167 89 109 183 88 144 10 22 237 172 88 240 208 100 150 26 182 155 231 54 37 82 150]
2024/05/11 23:44:26.167 解析 Client Hello 消息失败
2024/05/11 23:44:26.167 未找到 SNI 域名, 忽略...

软件版本

v1.0

附加截图

No response

无法访问pixiv.net

问题描述

# 监听端口
listen_addr: :443

# 可选:启用 Socks5 前置代理
#enable_socks5: true
# 可选:配置 Socks5 代理地址
#socks_addr: 127.0.0.1:40000

# 可选:允许所有域名(会忽略下面的 rules 列表)
allow_all_hosts: true

# 可选:仅允许指定域名
#rules:
#  - example.com
#  - b.example2.com

该设置下无法访问pixiv,显示www.pixiv.net 花了太长时间进行响应
dns使用的是阿里和腾讯的DOH

软件版本

v1.0.0

附加截图

No response

能否添加本地SNI Proxy功能

功能需求

建议添加本地SNI Proxy功能,代理本机流量,类似 Watt Toolkit(原Steam++) 的Hosts网络加速功能和 steamcommunity 302。因为部分网站GFW仅屏蔽了SNI,没有屏蔽IP,在本机代理SNI然后修改hosts就可以直接访问。但是Watt Toolkit和steamcommunity 302都没法自定义域名规则

预期目标

达到Watt Toolkit或者steamcommunity 302类似的效果

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.