Xray-core: certificate files relative path problem

[windows v25.3.6]

suppose the file “xray.exe” is in folder “F1”, and you run command “…/F1/xray.exe” from folder “F2”.

geoip.dat and geosite.dat should be in “F1” folder, which shows that the relative path for geofiles begins from the folder where “xray.exe” is there.

but certificate files should be in “F2” folder, which shows that the relative path for certificate files begins from the folder where the “command” is executed.

"certificateFile": "mycert.crt",
"keyFile": "mycert.key"

This issue has caused the mitm-config to not work in v2rayN and v2rayNG, because the The folder where the command is executed is unspecified.

///

as a result, like geofiles, the relative path for certificate files should begins from the folder where “xray” is there.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

~我们搞java的会专门写个工具类,从class所在包到jar包,一直到所有的classpath,还有调用者jar包所在位置,再到启动目录~ ~大大小小加一起有十几个位置要查~ ~只能说羡慕~

自适应目录载入资源,要注意安全问题,害怕出非预期行为 我觉得如果发现了多个位置都有证书,应该直接停止程序

@patterniha 我觉得 command 显式指定的应当只基于 command-run folder,比如 ./a/xray -c config.json

其它情况,如果有环境变量的就优先环境变量,没找到的再基于 xray folder,你据此 PR 一下吧,我会合并

Therefore, “geo” and “config” behave correctly,

and only “certificate” and “access/error” need to be changed.

@patterniha 我觉得 command 显式指定的应当只基于 command-run folder,比如 ./a/xray -c config.json

其它情况,如果有环境变量的就优先环境变量,没找到的再基于 xray folder,你据此 PR 一下吧,我会合并