fix(resolver): fix async context leak, gRPC error swallowing, add 48 tests

Fix async resolve goroutine using caller's cancelable context by
switching to context.WithoutCancel. Fix NewGRPCPlugin silently
returning broken resolver on connection failure. Fix "resolover"
typo in log field. Add doc comments to all exported symbols.
This commit is contained in:
ginuerzh
2026-05-25 20:52:19 +08:00
parent acce86c0e4
commit 28d3ffa310
7 changed files with 916 additions and 9 deletions
+3
View File
@@ -15,17 +15,20 @@ import (
"github.com/go-gost/x/internal/plugin"
)
// httpPluginRequest is the JSON body sent to an HTTP resolver plugin.
type httpPluginRequest struct {
Network string `json:"network"`
Host string `json:"host"`
Client string `json:"client"`
}
// httpPluginResponse is the JSON response from an HTTP resolver plugin.
type httpPluginResponse struct {
IPs []string `json:"ips"`
OK bool `json:"ok"`
}
// httpPlugin is a Resolver implementation that delegates to an external HTTP service.
type httpPlugin struct {
url string
client *http.Client