internal/checker+gui: remove voice-srv test (Discord doesn't expose regional voice servers via public DNS)
Build / test (push) Failing after 30s
Build / build-windows (push) Has been skipped
Release / release (push) Failing after 3m20s

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 19:02:11 +03:00
parent 9ea777d7b7
commit 11c4eb7f4a
9 changed files with 27 additions and 484 deletions
-108
View File
@@ -190,111 +190,3 @@ func TestVoiceQualityBurst_ZeroCount(t *testing.T) {
"localhost", 19302, 0, 5*time.Millisecond)
assert.Error(t, err)
}
// TestVoiceServerProbe_HappyAndBlocked: against a fake SOCKS5 server, one
// hostname (localhost) succeeds (REP=00) and another (127.0.0.1) gets
// blocked (REP=05). Both resolve at the OS level, so Resolved should be
// {localhost, 127.0.0.1}; Reachable should be {localhost}; Unreachable
// should be {127.0.0.1}.
func TestVoiceServerProbe_HappyAndBlocked(t *testing.T) {
// Stand up a tiny fake SOCKS5 server that completes greet+CONNECT
// only for hostname "localhost"; CONNECT to "127.0.0.1" is refused
// with REP=05. We don't need full RFC 1928 — just enough to drive
// the probe path.
ln, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
defer ln.Close()
go func() {
for {
c, err := ln.Accept()
if err != nil {
return
}
go func(c net.Conn) {
defer c.Close()
_ = c.SetDeadline(time.Now().Add(2 * time.Second))
// Read greeting: VER NMETHODS METHODS...
hdr := make([]byte, 2)
if _, err := readFull(c, hdr); err != nil {
return
}
if hdr[0] != 0x05 {
return
}
methods := make([]byte, hdr[1])
if _, err := readFull(c, methods); err != nil {
return
}
// Reply: no-auth.
_, _ = c.Write([]byte{0x05, 0x00})
// Read CONNECT request: VER CMD RSV ATYP...
h2 := make([]byte, 4)
if _, err := readFull(c, h2); err != nil {
return
}
var host string
switch h2[3] {
case 0x01:
ip := make([]byte, 4)
_, _ = readFull(c, ip)
host = net.IP(ip).String()
case 0x03:
l := make([]byte, 1)
_, _ = readFull(c, l)
name := make([]byte, int(l[0]))
_, _ = readFull(c, name)
host = string(name)
}
port := make([]byte, 2)
_, _ = readFull(c, port)
// Reply REP=00 only for hostname "localhost"; refuse otherwise.
if host == "localhost" {
_, _ = c.Write([]byte{0x05, 0x00, 0x00, 0x01, 0, 0, 0, 0, 0, 0})
} else {
_, _ = c.Write([]byte{0x05, 0x05, 0x00, 0x01, 0, 0, 0, 0, 0, 0})
}
}(c)
}
}()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
res, err := runVoiceServerProbe(ctx,
[]string{"localhost", "127.0.0.1"}, ln.Addr().String(),
false, "", "", 1*time.Second)
require.NoError(t, err)
assert.ElementsMatch(t, []string{"localhost", "127.0.0.1"}, res.Resolved)
assert.Equal(t, []string{"localhost"}, res.Reachable)
assert.Equal(t, []string{"127.0.0.1"}, res.UnreachableButResolved)
assert.Empty(t, res.Unresolved)
}
// TestVoiceServerProbe_EmptyHostnameList: zero-length input → zero-length
// Resolved/Reachable, no error.
func TestVoiceServerProbe_EmptyHostnameList(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
res, err := runVoiceServerProbe(ctx,
[]string{}, "127.0.0.1:1", false, "", "", 100*time.Millisecond)
require.NoError(t, err)
assert.Empty(t, res.Resolved)
assert.Empty(t, res.Reachable)
assert.Empty(t, res.Unresolved)
}
// readFull is a tiny helper to avoid importing io just for this.
func readFull(c net.Conn, buf []byte) (int, error) {
got := 0
for got < len(buf) {
n, err := c.Read(buf[got:])
got += n
if err != nil {
return got, err
}
}
return got, nil
}