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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user