Skip to content

Commit

Permalink
fix: file permission (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
lonble authored Dec 26, 2024
1 parent 571632e commit aa98ffc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions asn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions clash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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{
{
Expand Down
12 changes: 6 additions & 6 deletions geoip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
12 changes: 6 additions & 6 deletions geosite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion output/meta/meta_ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit aa98ffc

Please sign in to comment.