MCPcopy
hub / github.com/badafans/better-cloudflare-ip / getURLContent

Function getURLContent

main.go:529–540  ·  view source on GitHub ↗
(targetURL string)

Source from the content-addressed store, hash-verified

527var downloadClient = &http.Client{Timeout: 30 * time.Second}
528
529func getURLContent(targetURL string) (string, error) {
530 resp, err := downloadClient.Get(targetURL)
531 if err != nil {
532 return "", err
533 }
534 defer resp.Body.Close()
535 body, err := io.ReadAll(io.LimitReader(resp.Body, 32*1024*1024))
536 if err != nil {
537 return "", err
538 }
539 return string(body), nil
540}
541
542func getFileContent(filename string) (string, error) {
543 data, err := os.ReadFile(filename)

Callers 1

downloadAllDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected