Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

外部ip “ext” 标签增加绝对路径支持 #1448

Closed
Vxider opened this issue Dec 2, 2018 · 11 comments
Closed

外部ip “ext” 标签增加绝对路径支持 #1448

Vxider opened this issue Dec 2, 2018 · 11 comments

Comments

@Vxider
Copy link

Vxider commented Dec 2, 2018

从文件中加载 IP: 形如"ext:file:tag",文件存放在资源目录中,此处“资源目录”位置不明确。
比如mac系统下使用homebrew安装,通过的两种启动方式启动

  1. brew services start v2ray-core
  2. v2ray -config=xxx

“资源目录”位置不一致,希望可以增加绝对路径支持。

@Vxider Vxider changed the title 外部ip “ext 外部ip “ext” 标签增加绝对路径支持 Dec 2, 2018
@killua525
Copy link

个人感觉 用config 的路径比用binary的路径更好

@Vxider
Copy link
Author

Vxider commented Dec 5, 2018

抱歉,可能我没有描述清楚问题。

参考官方教程

{
     "type": "field",
     "outboundTag": "proxy", //被 gfw 屏蔽的域名走代理
     "domain": [
         "ext:h2y.dat:gfw"
     ]
 }

使用 "ext:h2y.dat:gfw"标签来指定一个外部文件,但此处h2y.dat必须放在V2Ray 运行文件的目录下,不能指定绝对路径,希望此处可以支持使用绝对路径,因为在不同的启动方式下,当前目录是不一样的。

@killua525
Copy link

抱歉,可能我没有描述清楚问题。

参考官方教程

{
     "type": "field",
     "outboundTag": "proxy", //被 gfw 屏蔽的域名走代理
     "domain": [
         "ext:h2y.dat:gfw"
     ]
 }

使用 "ext:h2y.dat:gfw"标签来指定一个外部文件,但此处h2y.dat必须放在V2Ray 运行文件的目录下,不能指定绝对路径,希望此处可以支持使用绝对路径,因为在不同的启动方式下,当前目录是不一样的。

了解我的意思是说h2y.dat 文件放在 -confg 指定的文件同目录下,个人感觉这样会更好一点儿,

@Vxider
Copy link
Author

Vxider commented Dec 5, 2018

h2y.dat放在 -config 指定的文件同目录下会出现如下问题:

>   v2ray -config=/usr/local/etc/v2ray/config.json

V2Ray 4.7.0 (Po) 20181129
A unified platform for anti-censorship.
main: failed to read config file: /usr/local/etc/v2ray/config.json > v2ray.com/core/main/json: failed to execute v2ctl to convert config file. > v2ray.com/core/common/platform/ctlcmd: failed to execute v2ctl: v2ray.com/ext/tools/conf/command: failed to parse json config > v2ray.com/ext/tools/conf/serial: failed to parse json config > v2ray.com/ext/tools/conf: invalid field rule > v2ray.com/ext/tools/conf: failed to parse domain rule: ext:h2y.dat:ad > v2ray.com/ext/tools/conf: failed to load external sites: AD from h2y.dat > v2ray.com/ext/tools/conf: failed to open file: h2y.dat > open /usr/local/bin/h2y.dat: no such file or directory

部分配置文件:

{
    "type": "field",
    "inboundTag": [
        "http",
        "socks"
    ],
    "outboundTag": "block",
    "domain": [
        "ext:h2y.dat:ad"
    ]
}

@killua525
Copy link

h2y.dat放在 -config 指定的文件同目录下会出现如下问题:

>   v2ray -config=/usr/local/etc/v2ray/config.json

V2Ray 4.7.0 (Po) 20181129
A unified platform for anti-censorship.
main: failed to read config file: /usr/local/etc/v2ray/config.json > v2ray.com/core/main/json: failed to execute v2ctl to convert config file. > v2ray.com/core/common/platform/ctlcmd: failed to execute v2ctl: v2ray.com/ext/tools/conf/command: failed to parse json config > v2ray.com/ext/tools/conf/serial: failed to parse json config > v2ray.com/ext/tools/conf: invalid field rule > v2ray.com/ext/tools/conf: failed to parse domain rule: ext:h2y.dat:ad > v2ray.com/ext/tools/conf: failed to load external sites: AD from h2y.dat > v2ray.com/ext/tools/conf: failed to open file: h2y.dat > open /usr/local/bin/h2y.dat: no such file or directory

部分配置文件:

{
    "type": "field",
    "inboundTag": [
        "http",
        "socks"
    ],
    "outboundTag": "block",
    "domain": [
        "ext:h2y.dat:ad"
    ]
}

了解,我们是一个意思,我的意思是说h2y.dat 默认放到配置路径,不要跟binary文件相同目录。 都需要改代码

@killua525
Copy link

killua525 commented Dec 5, 2018

V2RAY_LOCATION_ASSET=/usr/local/etc/v2ray
设置变量问题解决

launchctl setenv V2RAY_LOCATION_ASSET /usr/local/etc/v2ray
brew service restart v2ray-core

echo "setenv V2RAY_LOCATION_ASSET /usr/local/etc/v2ray " >>  ~/.conf.launchd

可以关了

@Vxider
Copy link
Author

Vxider commented Dec 6, 2018

这个设置好像对“h2y.dat”文件无效

launchctl setenv V2RAY_LOCATION_ASSET /usr/local/bin
brew service restart v2ray-core

h2y.dat 放置于 /usr/local/bin, 仍无法启动。

@killua525
Copy link

killua525 commented Dec 6, 2018

这个设置好像对“h2y.dat”文件无效

launchctl setenv V2RAY_LOCATION_ASSET /usr/local/bin
brew service restart v2ray-core

h2y.dat 放置于 /usr/local/bin, 仍无法启动。

去test 一下你的配置应该不是h2y这个文件的问题

大概率是bin 目录下另外两个dat文件没有放到修改后的路径

@Vxider
Copy link
Author

Vxider commented Dec 6, 2018

homebrew 安装v2ray 会自动把geo*文件链接到/usr/local/bin/目录,所以这两个文件路径应该是没有问题的

> ls /usr/local/bin/geo*
/usr/local/bin/geoip.dat   /usr/local/bin/geosite.dat

@killua525
Copy link

homebrew 安装v2ray 会自动把geo*文件链接到/usr/local/bin/目录,所以这两个文件路径应该是没有问题的

> ls /usr/local/bin/geo*
/usr/local/bin/geoip.dat   /usr/local/bin/geosite.dat

我的是ok的
应该 是你的环境问题吧
至少功能是支持的

@Vxider
Copy link
Author

Vxider commented Dec 6, 2018

我暂时把h2y.dat拷贝到homebrew目录中使用了,还是希望能够增加绝对路径支持,这样省好多事。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants