From 02fe483d743823b0ffa0979c08d6cabd9de9c4ae Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Tue, 14 Feb 2023 17:50:59 +0900 Subject: [PATCH] Add more shortcut --- go/pkg/speedtest/speedtest.go | 12 ++---------- ui/mainwindow.ui | 9 +++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/go/pkg/speedtest/speedtest.go b/go/pkg/speedtest/speedtest.go index 47cefaa..d9a05f7 100644 --- a/go/pkg/speedtest/speedtest.go +++ b/go/pkg/speedtest/speedtest.go @@ -30,6 +30,7 @@ func UrlTest(client *http.Client, link string, timeout int32) (int32, error) { ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Millisecond) defer cancel() + req, err := http.NewRequestWithContext(ctx, "GET", link, nil) req.Header.Set("User-Agent", fmt.Sprintf("curl/7.%d.%d", rand.Int()%84, rand.Int()%2)) if err != nil { @@ -53,17 +54,8 @@ func UrlTest(client *http.Client, link string, timeout int32) (int32, error) { } func TcpPing(address string, timeout int32) (ms int32, err error) { - host, port, err := net.SplitHostPort(address) - if err != nil { - return - } - ip, err := net.ResolveIPAddr("ip", host) - if err != nil { - return - } - // startTime := time.Now() - c, err := net.DialTimeout("tcp", net.JoinHostPort(ip.String(), port), time.Duration(timeout)*time.Millisecond) + c, err := net.DialTimeout("tcp", address, time.Duration(timeout)*time.Millisecond) endTime := time.Now() if err == nil { ms = int32(endTime.Sub(startTime).Milliseconds()) diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 791ed15..a401512 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -711,6 +711,9 @@ Remove Duplicates + + Ctrl+Shift+D + @@ -756,6 +759,9 @@ Remove Unavailable + + Ctrl+Shift+R + @@ -838,6 +844,9 @@ Resolve domain + + Ctrl+Shift+I +