feat: search engine adds proxy addresses and adds SSRF verification.

This commit is contained in:
hjz
2026-04-15 08:53:09 +08:00
committed by lyingbug
parent 092044b68f
commit 7bd36bf954
16 changed files with 228 additions and 14 deletions
@@ -3,6 +3,7 @@ package web_search
import (
"context"
"fmt"
"time"
"google.golang.org/api/customsearch/v1"
"google.golang.org/api/option"
@@ -29,8 +30,13 @@ func NewGoogleProvider(params types.WebSearchProviderParameters) (interfaces.Web
return nil, fmt.Errorf("engine ID is required for Google provider")
}
httpClient, err := NewSearchHTTPClient(30*time.Second, params.ProxyURL)
if err != nil {
return nil, err
}
clientOpts := []option.ClientOption{
option.WithAPIKey(params.APIKey),
option.WithHTTPClient(httpClient),
}
srv, err := customsearch.NewService(context.Background(), clientOpts...)
if err != nil {