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

关于clash的proxy-providers有点小需求 #183

Closed
xy9860 opened this issue Jun 7, 2020 · 10 comments
Closed

关于clash的proxy-providers有点小需求 #183

xy9860 opened this issue Jun 7, 2020 · 10 comments

Comments

@xy9860
Copy link

xy9860 commented Jun 7, 2020

我在模板里面使用了proxy-providers配置,打算生成一个包含proxy-providers的配置文件,然后clash在去请求proxy-providers里面写的地址。但是第一步生成配置必须要需要提供url参数,如果提供了的话最后生成的配置中就会含有proxies字段。希望能提供选项在完全使用proxy-providers配置的话取消url参数,阻止生成proxies字段。

还有关于group的生成,我使用以下两种格式:

group_name`select`!!provider_name
group_name`select`!!GROUP=provider_name

都只能得到:

- name: group_name
  type: select
  proxies:
    - DIRECT

预期的生成结果为:

- name: group_name
  type: select
  use:
    - provider_name

生成provider的group的正确格式该怎么写?

@Edger
Copy link

Edger commented Jun 10, 2020

同问

@tindy2013
Copy link
Owner

Added in commit 0a7e1ca

@xy9860
Copy link
Author

xy9860 commented Jun 23, 2020

最新版本provider功能正常,前面的需求我也搞定了

@xy9860 xy9860 closed this as completed Jun 23, 2020
@Edger
Copy link

Edger commented Jun 24, 2020

@xy9860

请教取消url参数,阻止生成proxies字段应该怎么配置?

@tindy2013
Copy link
Owner

Added in commit d042f00
url 中填入 nullnode 以插入占位符 该占位符不会出现在任何导出的配置中

@xy9860
Copy link
Author

xy9860 commented Jun 24, 2020

@xy9860

请教取消url参数,阻止生成proxies字段应该怎么配置?

根据开发者最新的提交,需要更改以下两个地方,interfaces.cpp 1631行后面新增如下代码

    if(url == "nullnode")
        nodes.clear();

subexport.cpp 1342行开始改为

    if(nodes.size())
    {
        if(ext.clash_new_field_name)
            yamlnode["proxies"] = proxies;
        else
            yamlnode["Proxy"] = proxies;
    }

这样编译后,请求 /sub?target=clash&url=nullnode 就没有proxies字段了,前提是你的模板里面也没有

方便的编译方法是安装alpine linux的虚拟机,然后git拉取源码,修改好后执行 /bin/sh scripts/build.alpine.release.sh

第二次编译需要改下这个脚本,不然会报错

@Edger
Copy link

Edger commented Jun 25, 2020

@xy9860
请教取消url参数,阻止生成proxies字段应该怎么配置?

根据开发者最新的提交,需要更改以下两个地方,interfaces.cpp 1631行后面新增如下代码

    if(url == "nullnode")
        nodes.clear();

subexport.cpp 1342行开始改为

    if(nodes.size())
    {
        if(ext.clash_new_field_name)
            yamlnode["proxies"] = proxies;
        else
            yamlnode["Proxy"] = proxies;
    }

这样编译后,请求 /sub?target=clash&url=nullnode 就没有proxies字段了,前提是你的模板里面也没有

方便的编译方法是安装alpine linux的虚拟机,然后git拉取源码,修改好后执行 /bin/sh scripts/build.alpine.release.sh

第二次编译需要改下这个脚本,不然会报错

好的,感谢

@sjtuross
Copy link

sjtuross commented Apr 2, 2022

url中使用nullnode,模板中也去除了proxies: ~,但生成的clash config里还是有proxies: ~

@hu1994101
Copy link

@tindy2013 大佬有空帮忙看看,现在url中使用nullnode,模板中也去除了proxies: ~,但生成的clash config里还是有proxies: ~

@Se7enMuting
Copy link

@tindy2013 大佬有空帮忙看看,现在url中使用nullnode,模板中也去除了proxies: ~,但生成的clash config里还是有proxies: ~

我也发现这个问题
#797

yamlnode["proxies"] = proxies;

强迫症烦了,希望可以改一下

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

6 participants