2025-06-01 22:06:34 +03:00
|
|
|
package cloudflare
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"net"
|
|
|
|
|
"net/http"
|
2026-04-29 22:11:30 +03:00
|
|
|
"time"
|
2025-06-01 22:06:34 +03:00
|
|
|
)
|
|
|
|
|
|
2025-06-08 19:51:17 +03:00
|
|
|
type CloudflareApiOption func(api *CloudflareApi)
|
2025-06-01 22:06:34 +03:00
|
|
|
|
|
|
|
|
func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) CloudflareApiOption {
|
2025-06-08 19:51:17 +03:00
|
|
|
return func(api *CloudflareApi) {
|
2026-04-29 22:11:30 +03:00
|
|
|
api.client.Timeout = 30 * time.Second
|
2025-06-01 22:06:34 +03:00
|
|
|
api.client.Transport = &http.Transport{
|
|
|
|
|
DialContext: dialContext,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|