Release 1.3.1: fix hy2 UDP ping and shop link open.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Navis
2026-07-28 07:33:26 +03:00
co-authored by Cursor
parent 5d2cb6d76a
commit f7fded5b40
11 changed files with 163 additions and 29 deletions
+33
View File
@@ -0,0 +1,33 @@
package netcheck
import (
"context"
"strings"
"testing"
"time"
"vpnclient/internal/config"
)
func TestFriendlyDialError(t *testing.T) {
err := &netError{s: "dial tcp 1.2.3.4:22514: connectex: No connection could be made because the target machine actively refused it."}
got := friendlyDialError(err, true)
if !strings.Contains(got, "UDP") {
t.Fatalf("got %q", got)
}
}
type netError struct{ s string }
func (e *netError) Error() string { return e.s }
func (e *netError) Timeout() bool { return false }
func (e *netError) Temporary() bool { return false }
func TestPingProfileEmpty(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
r := PingProfile(ctx, "x", config.ProtocolHysteria2, "")
if r.OK || r.Error == "" {
t.Fatalf("%+v", r)
}
}