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
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -74,7 +75,10 @@ func (c *Config) readConfig() (*ini.File, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return ini.LoadSources(
|
return ini.LoadSources(
|
||||||
ini.LoadOptions{AllowBooleanKeys: true},
|
ini.LoadOptions{
|
||||||
|
AllowBooleanKeys: true,
|
||||||
|
UnparseableSections: []string{"Rule"},
|
||||||
|
},
|
||||||
C.ConfigPath,
|
C.ConfigPath,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -316,8 +320,14 @@ func (c *Config) parseRules(cfg *ini.File) error {
|
||||||
|
|
||||||
rulesConfig := cfg.Section("Rule")
|
rulesConfig := cfg.Section("Rule")
|
||||||
// parse rules
|
// parse rules
|
||||||
for _, key := range rulesConfig.Keys() {
|
reader := bufio.NewReader(strings.NewReader(rulesConfig.Body()))
|
||||||
rule := strings.Split(key.Name(), ",")
|
for {
|
||||||
|
line, _, err := reader.ReadLine()
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
rule := strings.Split(string(line), ",")
|
||||||
if len(rule) < 3 {
|
if len(rule) < 3 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user