mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-14 00:51:12 +03:00
20 lines
398 B
Go
20 lines
398 B
Go
package cloudflare
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
type CloudflareApiOption func(api *CloudflareApi)
|
|
|
|
func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) CloudflareApiOption {
|
|
return func(api *CloudflareApi) {
|
|
api.client.Timeout = 30 * time.Second
|
|
api.client.Transport = &http.Transport{
|
|
DialContext: dialContext,
|
|
}
|
|
}
|
|
}
|