Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
go-ethereum/vendor/github.com/cloudflare/cloudflare-go
Felix Lange 0568e81701
p2p/dnsdisc: add implementation of EIP-1459 (#20094)
5 years ago
..
CODE_OF_CONDUCT.md p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
LICENSE p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
README.md p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
access_application.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
access_identity_provider.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
access_organization.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
access_policy.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
access_service_tokens.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
account_members.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
account_roles.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
accounts.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
argo.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
auditlogs.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
cloudflare.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
custom_hostname.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
custom_pages.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
dns.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
duration.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
errors.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
filter.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
firewall.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
firewall_rules.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
go.mod p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
go.sum p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
ips.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
keyless.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
load_balancing.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
lockdown.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
logpush.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
options.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
origin_ca.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
page_rules.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
railgun.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
rate_limiting.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
registrar.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
renovate.json p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
spectrum.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
ssl.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
universal_ssl.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
user.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
user_agent.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
virtualdns.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
waf.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
workers.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
workers_kv.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago
zone.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 5 years ago

README.md

cloudflare-go

GoDoc Build Status Go Report Card

Note: This library is under active development as we expand it to cover our (expanding!) API. Consider the public API of this package a little unstable as we work towards a v1.0.

A Go library for interacting with Cloudflare's API v4. This library allows you to:

  • Manage and automate changes to your DNS records within Cloudflare
  • Manage and automate changes to your zones (domains) on Cloudflare, including adding new zones to your account
  • List and modify the status of WAF (Web Application Firewall) rules for your zones
  • Fetch Cloudflare's IP ranges for automating your firewall whitelisting

A command-line client, flarectl, is also available as part of this project.

Features

The current feature list includes:

  • Cache purging
  • Cloudflare IPs
  • Custom hostnames
  • DNS Records
  • Firewall (partial)
  • Keyless SSL
  • Load Balancing
  • Logpush Jobs
  • Organization Administration
  • Origin CA
  • Railgun administration
  • Rate Limiting
  • User Administration (partial)
  • Virtual DNS Management
  • Web Application Firewall (WAF)
  • Zone Lockdown and User-Agent Block rules
  • Zones

Pull Requests are welcome, but please open an issue (or comment in an existing issue) to discuss any non-trivial changes before submitting code.

Installation

You need a working Go environment.

go get github.com/cloudflare/cloudflare-go

Getting Started

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/cloudflare/cloudflare-go"
)

func main() {
	// Construct a new API object
	api, err := cloudflare.New(os.Getenv("CF_API_KEY"), os.Getenv("CF_API_EMAIL"))
	if err != nil {
		log.Fatal(err)
	}

	// Fetch user details on the account
	u, err := api.UserDetails()
	if err != nil {
		log.Fatal(err)
	}
	// Print user details
	fmt.Println(u)

	// Fetch the zone ID
	id, err := api.ZoneIDByName("example.com") // Assuming example.com exists in your Cloudflare account already
	if err != nil {
		log.Fatal(err)
	}

	// Fetch zone details
	zone, err := api.ZoneDetails(id)
	if err != nil {
		log.Fatal(err)
	}
	// Print zone details
	fmt.Println(zone)
}

Also refer to the API documentation for how to use this package in-depth.

License

BSD licensed. See the LICENSE file for details.