Skip to content

Support to export all lists to a plain yml #3211

Merged
MkQtS merged 3 commits into
masterfrom
go
Jan 23, 2026
Merged

Support to export all lists to a plain yml #3211
MkQtS merged 3 commits into
masterfrom
go

Conversation

@MkQtS

@MkQtS MkQtS commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

使用 --exportlists=_all_ 即可,会将所有最终规则列表输出到一个 yaml 文件,格式为:

lists:
  - name: 0x0
    length: 1
    rules:
      - domain:0x0.st
  - name: 115
    length: 14
    rules:
      - domain:115.com
      - domain:115cdn.com
      - domain:115cdn.net
...

@MkQtS MkQtS merged commit 1bd07b2 into master Jan 23, 2026
1 check passed
@MkQtS MkQtS deleted the go branch January 23, 2026 06:56

@database64128 database64128 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any existing application that uses this format? It does not seem to be documented anywhere other than the PR description.

Comment thread main.go
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]))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need length? It's trivial to get the length of rules after parsing the YAML file.

@MkQtS MkQtS Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@MkQtS MkQtS Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread main.go
if err := writePlainList(exportedList); err != nil {
fmt.Println("Failed to write list:", err)
continue
if exportedList == "_all_" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread main.go
return site, nil
}

func writePlainAll(siteList *[]string) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite unusual to pass a pointer to a slice, especially when you just immediately dereference the pointer. This should be fixed.

Comment thread main.go
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] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MkQtS

MkQtS commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

Is there any existing application that uses this format? It does not seem to be documented anywhere other than the PR description.

No, as I just added it. It's not documented yet.

@MkQtS

MkQtS commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

github-actions Bot added a commit to YW5vbnltb3Vz/domain-list-community that referenced this pull request Jan 23, 2026
* 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)
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

Successfully merging this pull request may close these issues.

2 participants