feat(proxy): allow configurable probe targets

This commit is contained in:
hank committed 2026-08-19 16:47:50 +08:00
1 parent ae62854abc
commit b0464a9863
4 files changed
+100 -5

No files matched your search

@@ -166,6 +166,22 @@ func (s *ProxyProbeServiceSuite) TestParseIPify_NoIP() {
require.ErrorContains(s.T(), err, "no IP found")
}
func (s *ProxyProbeServiceSuite) TestParseChatGPTTrace_Success() {
body := []byte("fl=abc\nh=chatgpt.com\nip=203.0.113.5\nts=1700000000\nloc=US\ntz=UTC\n")
info, latencyMs, err := s.prober.parseChatGPTTrace(body, 320)
require.NoError(s.T(), err)
require.Equal(s.T(), int64(320), latencyMs)
require.Equal(s.T(), "203.0.113.5", info.IP)
require.Equal(s.T(), "US", info.CountryCode)
}
func (s *ProxyProbeServiceSuite) TestParseChatGPTTrace_NoIP() {
body := []byte("fl=abc\nh=chatgpt.com\nloc=US\n")
_, _, err := s.prober.parseChatGPTTrace(body, 100)
require.Error(s.T(), err)
require.ErrorContains(s.T(), err, "chatgpt-trace: no ip= found")
}
func TestProxyProbeServiceSuite(t *testing.T) {
suite.Run(t, new(ProxyProbeServiceSuite))
}