Because of problems left over from Surge, there are so many non-standard places now.
For Example:
# kebab-case but Proxy or Rule is not
log-level: info
# should be Proxies
Proxy:
# should be Rules
Rule:
Give your suggestions to enhance usability. BTW, the format of configuration should not be restricted to Surge.
I hope that use JSON to config. Program is easy to parse and verify it, but its difficult for our to write
i think we need some GUI utils to help our generate config. Not write config by ourself.
@xuhaoyang YAML is human friendly and it is easy to convert YAML to JSON.
采用小驼峰命名,应该更容易阅读,并且符合很多人的使用习惯(程序员)
如
logLevel: info
proxiesGroup:
@xuhaoyang
There are so many libs for yaml with mainstream language. As for GUI editor, there is a problem that has to be said: should the barrier for users be lower? clash live in the legal gray zone, I don't think it's a good thing. I prefer to let people who are willing to learn to have a good internet environment.
BTW, yaml 1.2 is fully JSON compatible, you can let your configuration in pure JSON.
采用小驼峰命名,应该更容易阅读,并且符合很多人的使用习惯(程序员)
如
logLevel: infoproxiesGroup:
但是使用这个代理的人中还是普通人最多,这种方式对一般人来说并不友好。
把配置容易写错的单元也加进配置的结构体里 , 然后只要读到了需要的就忽略其他的
比如有PROXY,PROXIES,PROXYS,
读到了PROXY就忽略其他两个,没读到就继续读
I hope that use JSON to config. Program is easy to parse and verify it, but its difficult for our to write
i think we need some GUI utils to help our generate config. Not write config by ourself.
YAML or TOML should be considered, but not JSON of course.
The syntax of JSON is too redundant to write manually.
And YAML and TOML can be both easily translated to JSON.
Because of problems left over from Surge, there are so many non-standard places now.
For Example:
# kebab-case but Proxy or Rule is not log-level: info # should be Proxies Proxy: # should be Rules Rule:Give your suggestions to enhance usability. BTW, the format of configuration should not be restricted to Surge.
Vote for kebab-case, the plural form may not be necessary.
https://github.com/Dreamacro/clash/issues/128#issuecomment-468931610
@lujiajing1126 Although JSON is hard to read and write, but it is easy for automated generate and parse.
So the best idea is to let Clash compatible with JSON, TOML and YAML.
@SukkaW YAML also easy for parsing and generating, and YAML is more friendly than TOML in clash.
kebab-case +1
I have a question,(will) the config file designed to be editable by using clash API ?
Rule:
- DOMAIN-SUFFIX,google.com,auto
- DOMAIN-KEYWORD,google,auto
- DOMAIN,google.com,auto
- DOMAIN-SUFFIX,ad.com,REJECT
- IP-CIDR,127.0.0.0/8,DIRECT
- SOURCE-IP-CIDR,192.168.1.201/32,DIRECT
- GEOIP,CN,DIRECT
- DNS-FAILED,DIRECT
- MATCH,auto
I want to add DNS-FAILED rule, so I can use special proxy when resolving failed.
@beyondkmp
The DNS-FAILED and FINAL are similar. They are order independent. In my opinion, Rule is order related.
Compare these two ways of configuration.
Rule:
- DOMAIN-SUFFIX,google.com,auto
- DNS-FAILED,DIRECT
Rule:
- DNS-FAILED,DIRECT
- DOMAIN-SUFFIX,google.com,auto
They will take the same effect. something contrary to our architecture. This is also why I renamed FINAL to MATCH.
@beyondkmp
The
DNS-FAILEDandFINALare similar. They are order independent. In my opinion,Ruleis order related.Compare these two ways of configuration.
Rule: - DOMAIN-SUFFIX,google.com,auto - DNS-FAILED,DIRECT Rule: - DNS-FAILED,DIRECT - DOMAIN-SUFFIX,google.com,autoThey will take the same effect. something contrary to our architecture. This is also why I renamed
FINALtoMATCH.
ok, I got it. But resolving some domains failed, I hope that these domains go directly instead of return empty error. Some old or uncommon domains always encounter this problem.
There are three cases that are widely used:
fooBarfoo-barfoo_barI vote for camel case(fooBar) since this is a Golang project, Golang prefers camel case, it is better to respect the project language.
@ruisiji This issue discusses standardized configuration. Do you mean code style?
@Dreamacro I mean config.yaml format:
port: 7890
socksPort: 7891
allowLan: true
proxies:
- a
- b
- c
proxyGroups:
- a
- b
- c
rules:
- a
- b
- c
@ruisiji But docker, which mainstay on Golang, its docker-compose.yml use snake case (https://docs.docker.com/compose/compose-file/)
@Dreamacro Snake case is used most by python projects.
As far as I know, docker compose is a python project at the beginning, so maybe docker compose want to keep the configuration format unchanged when migrate to golang.
个人认为 最外层用大写 次层用kebab case 看起来更整齐。
proxy-provider能不能改成下面的格式,现在配置是使用变量做key,确实不太合理。
Proxy Provider:
- name: provider1
type: http
url: https://example.com/provider1.yaml
- name: provider2
type: file
path: path/to/provider2.yaml
kebab-case +1
In 1.0.0 kebab-case was fully used.
Most helpful comment
Vote for
kebab-case, the plural form may not be necessary.