Documentation
¶
Index ¶
- Variables
- func IsCloudflareIP(ipAddress string) (ret bool, err error)
- type ApiError
- type ApiResponse
- type Client
- func (client *Client) AddCustomHostname(ctx context.Context, zone, hostname string) (hostnameID string, err error)
- func (client *Client) FetchCloudflareIps(ctx context.Context) (res CloudflareIpsResult, err error)
- func (client *Client) GetCustomHostnameDetails(ctx context.Context, zone, hostnameID string) (res CustomHostname, err error)
- func (client *Client) RemoveCustomHostname(ctx context.Context, zone, hostnameID string) (err error)
- type CloudflareIpsResult
- type CustomHostname
- type CustomHostnameOwnershipVerification
- type CustomHostnameOwnershipVerificationHTTP
- type CustomHostnameSSL
- type CustomHostnameSSLCertificates
- type CustomHostnameSSLSettings
- type CustomHostnameStatus
- type CustomMetadata
- type SSLValidationError
- type SSLValidationRecord
Constants ¶
This section is empty.
Variables ¶
var IpsJson []byte
Functions ¶
func IsCloudflareIP ¶
TODO: return error?
Types ¶
type ApiResponse ¶
type ApiResponse struct { Result json.RawMessage `json:"result"` Success bool `json:"success"` Errors []ApiError `json:"errors"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddCustomHostname ¶
func (*Client) FetchCloudflareIps ¶
func (client *Client) FetchCloudflareIps(ctx context.Context) (res CloudflareIpsResult, err error)
Fetch the IPs used on the Cloudflare network Ips are fetched from https://api.cloudflare.com/client/v4/ips and can be formated using | python3 -m json.tool Changelog: https://www.cloudflare.com/en-gb/ips/ API Docs: https://developers.cloudflare.com/api/operations/cloudflare-i-ps-cloudflare-ip-details
func (*Client) GetCustomHostnameDetails ¶
type CloudflareIpsResult ¶
type CloudflareIpsResult struct { Ipv4Cidrs []string `json:"ipv4_cidrs"` Ipv6Cidrs []string `json:"ipv6_cidrs"` Etag string `json:"etag"` }
CustomHostnameOwnershipVerificationHTTP represents a response from the Custom Hostnames endpoints.
type CustomHostname ¶
type CustomHostname struct { ID string `json:"id,omitempty"` Hostname string `json:"hostname,omitempty"` CustomOriginServer string `json:"custom_origin_server,omitempty"` CustomOriginSNI string `json:"custom_origin_sni,omitempty"` SSL *CustomHostnameSSL `json:"ssl,omitempty"` CustomMetadata CustomMetadata `json:"custom_metadata,omitempty"` Status CustomHostnameStatus `json:"status,omitempty"` VerificationErrors []string `json:"verification_errors,omitempty"` OwnershipVerification CustomHostnameOwnershipVerification `json:"ownership_verification,omitempty"` OwnershipVerificationHTTP CustomHostnameOwnershipVerificationHTTP `json:"ownership_verification_http,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` }
CustomHostname represents a custom hostname in a zone.
type CustomHostnameOwnershipVerification ¶
type CustomHostnameOwnershipVerification struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Value string `json:"value,omitempty"` }
CustomHostnameOwnershipVerification represents ownership verification status of a given custom hostname.
type CustomHostnameOwnershipVerificationHTTP ¶
type CustomHostnameOwnershipVerificationHTTP struct { HTTPUrl string `json:"http_url,omitempty"` HTTPBody string `json:"http_body,omitempty"` }
CustomHostnameOwnershipVerificationHTTP represents a response from the Custom Hostnames endpoints.
type CustomHostnameSSL ¶
type CustomHostnameSSL struct { ID string `json:"id,omitempty"` Status string `json:"status,omitempty"` Method string `json:"method,omitempty"` Type string `json:"type,omitempty"` Wildcard *bool `json:"wildcard,omitempty"` CustomCertificate string `json:"custom_certificate,omitempty"` CustomKey string `json:"custom_key,omitempty"` CertificateAuthority string `json:"certificate_authority,omitempty"` Issuer string `json:"issuer,omitempty"` SerialNumber string `json:"serial_number,omitempty"` Settings CustomHostnameSSLSettings `json:"settings,omitempty"` Certificates []CustomHostnameSSLCertificates `json:"certificates,omitempty"` // Deprecated: use ValidationRecords. // If there a single validation record, this will equal ValidationRecords[0] for backwards compatibility. SSLValidationRecord ValidationRecords []SSLValidationRecord `json:"validation_records,omitempty"` ValidationErrors []SSLValidationError `json:"validation_errors,omitempty"` }
CustomHostnameSSL represents the SSL section in a given custom hostname.
type CustomHostnameSSLCertificates ¶
type CustomHostnameSSLCertificates struct { Issuer string `json:"issuer"` SerialNumber string `json:"serial_number"` Signature string `json:"signature"` ExpiresOn *time.Time `json:"expires_on"` IssuedOn *time.Time `json:"issued_on"` FingerprintSha256 string `json:"fingerprint_sha256"` ID string `json:"id"` }
CustomHostnameSSLCertificates represent certificate properties like issuer, expires date and etc.
type CustomHostnameSSLSettings ¶
type CustomHostnameSSLSettings struct { HTTP2 string `json:"http2,omitempty"` HTTP3 string `json:"http3,omitempty"` TLS13 string `json:"tls_1_3,omitempty"` MinTLSVersion string `json:"min_tls_version,omitempty"` Ciphers []string `json:"ciphers,omitempty"` EarlyHints string `json:"early_hints,omitempty"` }
CustomHostnameSSLSettings represents the SSL settings for a custom hostname.
type CustomHostnameStatus ¶
type CustomHostnameStatus string
CustomHostnameStatus is the enumeration of valid state values in the CustomHostnameSSL.
const ( // PENDING status represents state of CustomHostname is pending. PENDING CustomHostnameStatus = "pending" // ACTIVE status represents state of CustomHostname is active. ACTIVE CustomHostnameStatus = "active" // MOVED status represents state of CustomHostname is moved. MOVED CustomHostnameStatus = "moved" // DELETED status represents state of CustomHostname is removed. DELETED CustomHostnameStatus = "deleted" )
type CustomMetadata ¶
type CustomMetadata map[string]interface{}
CustomMetadata defines custom metadata for the hostname. This requires logic to be implemented by Cloudflare to act on the data provided.
type SSLValidationError ¶
type SSLValidationError struct {
Message string `json:"message,omitempty"`
}
SSLValidationError represents errors that occurred during SSL validation.
type SSLValidationRecord ¶
type SSLValidationRecord struct { CnameTarget string `json:"cname_target,omitempty"` CnameName string `json:"cname,omitempty"` TxtName string `json:"txt_name,omitempty"` TxtValue string `json:"txt_value,omitempty"` HTTPUrl string `json:"http_url,omitempty"` HTTPBody string `json:"http_body,omitempty"` Emails []string `json:"emails,omitempty"` }
SSLValidationRecord displays Domain Control Validation tokens.