mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-10-10 04:03:11 +08:00
chore: reduce memory usage in converter (#3159)
This commit is contained in:
@@ -16,13 +16,13 @@ import (
|
||||
func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
||||
data := DecodeBase64(buf)
|
||||
|
||||
arr := strings.Split(string(data), "\n")
|
||||
rawLines := bytes.Split(data, []byte("\n"))
|
||||
|
||||
proxies := make([]map[string]any, 0, len(arr))
|
||||
proxies := make([]map[string]any, 0, len(rawLines))
|
||||
names := make(map[string]int, 200)
|
||||
|
||||
for _, line := range arr {
|
||||
line = strings.TrimRight(line, " \r")
|
||||
for _, raw := range rawLines {
|
||||
line := strings.TrimRight(string(raw), " \r")
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user