diff --git a/asn.go b/asn.go index e2ae300..384b097 100644 --- a/asn.go +++ b/asn.go @@ -47,7 +47,7 @@ func convertASN(cmd *cobra.Command, args []string) error { } defer db.Close() - os.MkdirAll(outDir, 0755) + os.MkdirAll(outDir, 0777) countryCIDRs := make(map[uint][]string) networks := db.Networks(maxminddb.SkipAliasedNetworks) @@ -75,7 +75,7 @@ func convertASN(cmd *cobra.Command, args []string) error { defer func() { <-semaphore }() code := fmt.Sprintf("AS%d", number) - err := os.WriteFile(outDir+"/"+code+".list", []byte(strings.Join(cidrs, "\n")), 0755) + err := os.WriteFile(outDir+"/"+code+".list", []byte(strings.Join(cidrs, "\n")), 0666) if err != nil { fmt.Println(code, " output err: ", err) } diff --git a/clash.go b/clash.go index 5cd2998..9e52b40 100644 --- a/clash.go +++ b/clash.go @@ -41,7 +41,7 @@ func convertClash(cmd *cobra.Command, args []string) error { if err != nil { return err } - os.MkdirAll(outDir, 0755) + os.MkdirAll(outDir, 0777) var ( domainFull = make(map[string][]string) @@ -110,7 +110,7 @@ func convertClash(cmd *cobra.Command, args []string) error { switch outType { case "sing-box": for name, domain := range domainFull { - os.MkdirAll(outDir+"/"+name, 0755) + os.MkdirAll(outDir+"/"+name, 0777) if len(domain) != 0 || len(domainSuffix[name]) != 0 || len(domainKeyword[name]) != 0 || len(domainRegex[name]) != 0 { domainRule := []sing.DefaultHeadlessRule{ { diff --git a/geoip.go b/geoip.go index f4bcd70..887bd88 100644 --- a/geoip.go +++ b/geoip.go @@ -53,7 +53,7 @@ func convertIP(cmd *cobra.Command, args []string) error { if err != nil { return err } - os.MkdirAll(outDir, 0755) + os.MkdirAll(outDir, 0777) var ( wg sync.WaitGroup @@ -94,7 +94,7 @@ func convertIP(cmd *cobra.Command, args []string) error { switch outType { case "clash": - os.MkdirAll(outDir+"/classical", 0755) + os.MkdirAll(outDir+"/classical", 0777) for code, cidrs := range countryCIDRs { ipcidrMap := map[string][]string{ @@ -104,12 +104,12 @@ func convertIP(cmd *cobra.Command, args []string) error { if err != nil { fmt.Println(code, " coding err: ", err) } - err = os.WriteFile(outDir+"/"+code+".yaml", ipcidrOut, 0755) + err = os.WriteFile(outDir+"/"+code+".yaml", ipcidrOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } ipcidrOut = []byte(strings.Join(cidrs, "\n")) - err = os.WriteFile(outDir+"/"+code+".list", ipcidrOut, 0755) + err = os.WriteFile(outDir+"/"+code+".list", ipcidrOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } @@ -126,12 +126,12 @@ func convertIP(cmd *cobra.Command, args []string) error { if err != nil { fmt.Println(code, " coding err: ", err) } - err = os.WriteFile(outDir+"/classical/"+code+".yaml", classicalOut, 0755) + err = os.WriteFile(outDir+"/classical/"+code+".yaml", classicalOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } classicalOut = []byte(strings.Join(cidrs, "\n")) - err = os.WriteFile(outDir+"/classical/"+code+".list", classicalOut, 0755) + err = os.WriteFile(outDir+"/classical/"+code+".list", classicalOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } diff --git a/geosite.go b/geosite.go index aca23ca..575009d 100644 --- a/geosite.go +++ b/geosite.go @@ -43,7 +43,7 @@ func convertSite(cmd *cobra.Command, args []string) error { if err != nil { return err } - os.MkdirAll(outDir, 0755) + os.MkdirAll(outDir, 0777) var ( domains = make(map[string][]string) @@ -157,7 +157,7 @@ func convertSite(cmd *cobra.Command, args []string) error { switch outType { case "clash": - os.MkdirAll(outDir+"/classical", 0755) + os.MkdirAll(outDir+"/classical", 0777) for code, domain := range domains { domainMap := map[string][]string{ "payload": domain, @@ -166,12 +166,12 @@ func convertSite(cmd *cobra.Command, args []string) error { if err != nil { fmt.Println(code, " coding err: ", err) } - err = os.WriteFile(outDir+"/"+code+".yaml", domainOut, 0755) + err = os.WriteFile(outDir+"/"+code+".yaml", domainOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } domainOut = []byte(strings.Join(domain, "\n")) - err = os.WriteFile(outDir+"/"+code+".list", domainOut, 0755) + err = os.WriteFile(outDir+"/"+code+".list", domainOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } @@ -186,12 +186,12 @@ func convertSite(cmd *cobra.Command, args []string) error { if err != nil { fmt.Println(code, " coding err: ", err) } - err = os.WriteFile(outDir+"/classical/"+code+".yaml", classicalOut, 0755) + err = os.WriteFile(outDir+"/classical/"+code+".yaml", classicalOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } classicalOut = []byte(strings.Join(classical[code], "\n")) - err = os.WriteFile(outDir+"/classical/"+code+".list", classicalOut, 0755) + err = os.WriteFile(outDir+"/classical/"+code+".list", classicalOut, 0666) if err != nil { fmt.Println(code, " output err: ", err) } diff --git a/output/meta/meta_ruleset.go b/output/meta/meta_ruleset.go index 0e24c61..39cdf58 100644 --- a/output/meta/meta_ruleset.go +++ b/output/meta/meta_ruleset.go @@ -16,7 +16,7 @@ func SaveMetaRuleSet(buf []byte, b string, f string, outputPath string) error { if err != nil { return err } - targetFile, err := os.OpenFile(outputPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) + targetFile, err := os.OpenFile(outputPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) if err != nil { return err }