From 1fe6677f404d56c7e96376b75332c5fd25faf385 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Tue, 17 Oct 2023 22:18:32 +0800 Subject: [PATCH] chore: use strings.ContainsRune instead --- https.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/https.go b/https.go index e105caf8..6f7a2c2d 100644 --- a/https.go +++ b/https.go @@ -378,7 +378,7 @@ func (proxy *ProxyHttpServer) NewConnectDialToProxyWithHandler(https_proxy strin return nil } if u.Scheme == "" || u.Scheme == "http" { - if strings.IndexRune(u.Host, ':') == -1 { + if !strings.ContainsRune(u.Host, ':') { u.Host += ":80" } return func(network, addr string) (net.Conn, error) { @@ -418,7 +418,7 @@ func (proxy *ProxyHttpServer) NewConnectDialToProxyWithHandler(https_proxy strin } } if u.Scheme == "https" || u.Scheme == "wss" { - if strings.IndexRune(u.Host, ':') == -1 { + if !strings.ContainsRune(u.Host, ':') { u.Host += ":443" } return func(network, addr string) (net.Conn, error) {