Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

在监听127.0.0.10.0.0.0之外的地址时使用出错 #449

Closed
NaBCberry opened this issue Jan 10, 2023 · 2 comments
Closed

在监听127.0.0.10.0.0.0之外的地址时使用出错 #449

NaBCberry opened this issue Jan 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@NaBCberry
Copy link

我使用了树莓派并安装ubuntu22.04LTS系统
目标是在树莓派上安装nonebot2和gocqhttp插件来管理qq机器人
无公网,树莓派固定ip地址192.168.0.12

一开始我按照一般流程修改了env.dev里的”HOST=“项,一开始我在此填入了127.0.0.1,但这样我就无法在同局域网内的另一台电脑访问http://192.168.0.12:33114/go-cqhttp/,
于是我将其修改为树莓派固定好的ip地址,这样就可以打开http://192.168.0.12:33114/go-cqhttp/了,
但是当我输入机器人账号并尝试登陆时,控制台显示反向ws服务器连接失败并一直尝试连接,
而后我修改了/home/ubuntu/.local/lib/python3.10/site-packages/nonebot_plugin_gocqhttp/process/下的config.py文件中第48行
"server_address": f"ws://127.0.0.1:{driver_config.port}/onebot/v11/ws",
并将其中的127.0.0.1改为192.168.0.12(即树莓派固定好的ip地址)
"server_address": f"ws://192.168.0.12:{driver_config.port}/onebot/v11/ws",
保存,开启nonebot,不再报错,事情解决

建议:不知道/home/ubuntu/.local/lib/python3.10/site-packages/nonebot_plugin_gocqhttp/process/config.py文件能否像
/home/ubuntu/.local/lib/python3.10/site-packages/nonebot_plugin_gocqhttp/init.py文件中的第61行
f"<u><e>http://{driver.config.host}:{driver.config.port}/go-cqhttp/</e></u>"一样,改为
"server_address": f"ws://{driver.config.host}:{driver_config.port}/onebot/v11/ws",
并在文件头调用相应模块来一劳永逸

@mnixry
Copy link
Owner

mnixry commented Jan 10, 2023

我認為在這種情況下 可能直接監聽 0.0.0.0 是更好的選擇
參考 #42

@mnixry mnixry added the wontfix This will not be worked on label Jan 10, 2023
@mnixry mnixry closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2023
@mnixry
Copy link
Owner

mnixry commented Jan 27, 2023

好像还真的会有人这么填写…… 要不你给个PR改吧

我以为都会要么填127.0.0.1要么填0.0.0.0

@mnixry mnixry reopened this Jan 27, 2023
@mnixry mnixry added enhancement New feature or request and removed wontfix This will not be worked on labels Jan 27, 2023
@mnixry mnixry changed the title env.xxx文件中HOST改为ip地址,连接反向ws服务器出错,已找到解决方案并试图提出建议 在监听127.0.0.10.0.0.0之外的地址时使用出错 Jan 27, 2023
@mnixry mnixry added bug Something isn't working and removed enhancement New feature or request labels Jan 27, 2023
@mnixry mnixry closed this as completed in b5cedd7 Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants