Optimize `LoopbackListenHost()` (#615)

This commit is contained in:
YenForYang 2021-09-14 06:54:37 -05:00 committed by GitHub
parent f6b024e157
commit be8b7b7d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@ package torrent
import "strings" import "strings"
func LoopbackListenHost(network string) string { func LoopbackListenHost(network string) string {
if strings.Contains(network, "4") { if strings.IndexByte(network, '4') != -1 {
return "127.0.0.1" return "127.0.0.1"
} else { } else {
return "::1" return "::1"