Skip to content

Commit

Permalink
Chore: refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
Loyalsoldier committed Jul 6, 2024
1 parent e380044 commit 8c55b32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
34 changes: 10 additions & 24 deletions plugin/special/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,17 @@ func (s *stdout) Output(container lib.Container) error {
}
}

switch len(wantList) {
case 0:
for entry := range container.Loop() {
cidrList, err := s.generateCIDRList(entry)
if err != nil {
continue
}
for _, cidr := range cidrList {
io.WriteString(os.Stdout, cidr+"\n")
}
for entry := range container.Loop() {
if len(wantList) > 0 && !wantList[entry.GetName()] {
continue
}
default:
for name := range wantList {
entry, found := container.GetEntry(name)
if !found {
continue
}

cidrList, err := s.generateCIDRList(entry)
if err != nil {
continue
}
for _, cidr := range cidrList {
io.WriteString(os.Stdout, cidr+"\n")
}

cidrList, err := s.generateCIDRList(entry)
if err != nil {
continue
}
for _, cidr := range cidrList {
io.WriteString(os.Stdout, cidr+"\n")
}
}

Expand Down
6 changes: 3 additions & 3 deletions plugin/v2ray/dat_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ func (g *geoIPDatOut) Output(container lib.Container) error {
}
}

// Sort to make reproducible builds
g.sort(geoIPList)

if !g.OneFilePerList && updated {
// Sort to make reproducible builds
g.sort(geoIPList)

geoIPBytes, err := proto.Marshal(geoIPList)
if err != nil {
return err
Expand Down

0 comments on commit 8c55b32

Please sign in to comment.