go-openbmclapi icon indicating copy to clipboard operation
go-openbmclapi copied to clipboard

tunneler 功能配置问题

Open ApliNi opened this issue 1 year ago • 8 comments

您好, 我尝试启用 tunneler 功能时遇到问题, 即使使用默认的正则表达式也无法启动:

tunneler:
  enable: true
  tunnel-program: ./addr.cmd
  output-regex: (?<host>.+):(?<port>\d+)
  tunnel-timeout: 0
Go-OpenBmclAPI  Copyright (C) 2023 Kevin Z <[email protected]>
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it under certain conditions;
Use subcommand 'license' for more information

[ERRO][21:38:55]: 无法解析配置文件: error parsing regexp: invalid or unsupported Perl syntax: `(?<`
[ERRO][21:38:55]: 节点正在退出, 代码 1
[ERRO][21:38:55]: 请在提交问题前阅读 https://github.com/LiterMC/go-openbmclapi?tab=readme-ov-file#faq
[WARN][21:38:55]: 检测到您是新手 Windows 用户. 我们正在帮助您打开浏览器 ...

ApliNi avatar Apr 28 '24 13:04 ApliNi

请将?<xxx>改为?P<xxx>

zyxkad avatar Apr 28 '24 13:04 zyxkad

请将?<xxx>改为?P<xxx>

感谢, 可以正常启动了, 但直到现在节点没有正常上线, 日志输出到此为止, 我没法判断它是否正常运行

我的 ./addr.cmd 脚本内容是 cat addr.txt

[INFO][21:51:47]: 正在开始打洞, 执行 "./addr.cmd"
[INFO][21:51:47]: [tunneler/stderr]: '.' �����ڲ����ⲿ���Ҳ���ǿ����еij���
[INFO][21:51:47]: [tunneler/stderr]: �����������

ApliNi avatar Apr 28 '24 13:04 ApliNi

你的打洞程序编码不对,请换成UTF8

建议直接把系统编码换成 UTF8

其实最好 switch to linux

zyxkad avatar Apr 28 '24 13:04 zyxkad

这个问题还没修,别关

zyxkad avatar Apr 28 '24 14:04 zyxkad

那请问可以添加一个功能, 读取文件中的地址而非获取程序输出吗?

ApliNi avatar Apr 28 '24 14:04 ApliNi

读取程序输出的原因是想动态,如果你的洞是静态的那直接写配置文件里并且分开运行两个程序就好

zyxkad avatar Apr 28 '24 14:04 zyxkad

我的想法是可以让打洞程序单独运行并将 utf8 编码的日志输出到文件, 可以解决 windows 系统的 cmd 脚本没法实现输出 utf8 编码的内容到控制台

ApliNi avatar Apr 28 '24 14:04 ApliNi

我整了个小程序解决这个文件读取的问题 https://github.com/ApliNi/go_println_txt

ApliNi avatar Apr 28 '24 15:04 ApliNi