mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
Fix: Rule with ipv6 address
This commit is contained in:
parent
0724d4ea52
commit
1d0d5667fd
|
@ -1,6 +1,7 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
@ -74,7 +75,10 @@ func (c *Config) readConfig() (*ini.File, error) {
|
|||
return nil, err
|
||||
}
|
||||
return ini.LoadSources(
|
||||
ini.LoadOptions{AllowBooleanKeys: true},
|
||||
ini.LoadOptions{
|
||||
AllowBooleanKeys: true,
|
||||
UnparseableSections: []string{"Rule"},
|
||||
},
|
||||
C.ConfigPath,
|
||||
)
|
||||
}
|
||||
|
@ -316,8 +320,14 @@ func (c *Config) parseRules(cfg *ini.File) error {
|
|||
|
||||
rulesConfig := cfg.Section("Rule")
|
||||
// parse rules
|
||||
for _, key := range rulesConfig.Keys() {
|
||||
rule := strings.Split(key.Name(), ",")
|
||||
reader := bufio.NewReader(strings.NewReader(rulesConfig.Body()))
|
||||
for {
|
||||
line, _, err := reader.ReadLine()
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
rule := strings.Split(string(line), ",")
|
||||
if len(rule) < 3 {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user