mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
trim for custom ip file.
This commit is contained in:
parent
3e5c2bc8e3
commit
2cbf23bceb
@ -121,7 +121,7 @@ func ReadAddrFile(path string) []*net.TCPAddr {
|
||||
lines := strings.Split(str, "\n")
|
||||
var ret []*net.TCPAddr
|
||||
for _, l := range lines {
|
||||
ip := strings.Split(l, ":")
|
||||
ip := strings.Split(strings.TrimSpace(l), ":")
|
||||
if len(ip) == 2 {
|
||||
port, _ := strconv.Atoi(ip[1])
|
||||
ret = append(ret, &net.TCPAddr{IP: net.ParseIP(ip[0]), Port: port})
|
||||
|
Loading…
x
Reference in New Issue
Block a user