Conversation
database64128
left a comment
There was a problem hiding this comment.
Is there any existing application that uses this format? It does not seem to be documented anywhere other than the PR description.
| w.WriteString("lists:\n") | ||
| for _, site := range *siteList { | ||
| fmt.Fprintf(w, " - name: %s\n", strings.ToLower(site)) | ||
| fmt.Fprintf(w, " length: %d\n", len(finalMap[site])) |
There was a problem hiding this comment.
Why do we need length? It's trivial to get the length of rules after parsing the YAML file.
There was a problem hiding this comment.
Well, you can get length via some YAML tools, but I just want a quick summary of length. I'm planning to reduce some unnecessary lists which contains too few rules(not now, and I'm willing to consider/wait for other opinions), this helps me to find such lists via a simple search.
There was a problem hiding this comment.
First of all, I want to say that I appreciate the work you have done for this project! If you want to write tools that help maintainers such as yourself tidy up this repository, that is totally fine. You can create a cmd directory and add new command-line utilities in it, like cmd/summary/main.go.
Adding support for a new format to the main CLI is a totally different matter. As the maintainer of a proxy application that can consume lists produced by this project, I find this new format weird and kind of pointless (no offense to you).
There was a problem hiding this comment.
Thanks for your advice. I may adopt it later today or tomorrow. There are some tools to view/search rules in geosite, some end users need them. I hope this new plain list will help these users to use/improve geosite data(not designed for proxy applications).
| if err := writePlainList(exportedList); err != nil { | ||
| fmt.Println("Failed to write list:", err) | ||
| continue | ||
| if exportedList == "_all_" { |
There was a problem hiding this comment.
I don't like that this is a special case of the existing exportedList. If a new format is really warranted here, it should use a new dedicated flag.
| return site, nil | ||
| } | ||
|
|
||
| func writePlainAll(siteList *[]string) error { |
There was a problem hiding this comment.
It's quite unusual to pass a pointer to a slice, especially when you just immediately dereference the pointer. This should be fixed.
| fmt.Fprintf(w, " - name: %s\n", strings.ToLower(site)) | ||
| fmt.Fprintf(w, " length: %d\n", len(finalMap[site])) | ||
| w.WriteString(" rules:\n") | ||
| for _, entry := range finalMap[site] { |
There was a problem hiding this comment.
It's very inefficient to use map lookup for this purpose. Not to mention you did the lookup twice. siteList should not have been a string slice. It should have been a slice of a struct with a list's full information.
No, as I just added it. It's not documented yet. |
* https://github.com/v2fly/domain-list-community: Add new Binance API endpoint 'binanceru.net' (v2fly#3210) Support to export all lists to a plain yml (v2fly#3211)
使用
--exportlists=_all_即可,会将所有最终规则列表输出到一个 yaml 文件,格式为: