plugeth/vendor/github.com/cloudflare/cloudflare-go
Felix Lange 0568e81701
p2p/dnsdisc: add implementation of EIP-1459 (#20094)
This adds an implementation of node discovery via DNS TXT records to the
go-ethereum library. The implementation doesn't match EIP-1459 exactly,
the main difference being that this implementation uses separate merkle
trees for tree links and ENRs. The EIP will be updated to match p2p/dnsdisc.

To maintain DNS trees, cmd/devp2p provides a frontend for the p2p/dnsdisc
library. The new 'dns' subcommands can be used to create, sign and deploy DNS
discovery trees.
2019-09-25 11:38:13 +02:00
..
access_application.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
access_identity_provider.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
access_organization.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
access_policy.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
access_service_tokens.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
account_members.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
account_roles.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
accounts.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
argo.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
auditlogs.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
cloudflare.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
CODE_OF_CONDUCT.md p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
custom_hostname.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
custom_pages.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
dns.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
duration.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
errors.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
filter.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
firewall_rules.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
firewall.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
go.mod p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
go.sum p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
ips.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
keyless.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
LICENSE p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
load_balancing.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
lockdown.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
logpush.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
options.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
origin_ca.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
page_rules.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
railgun.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
rate_limiting.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
README.md p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
registrar.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
renovate.json p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
spectrum.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
ssl.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
universal_ssl.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
user_agent.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
user.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
virtualdns.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
waf.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
workers_kv.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
workers.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00
zone.go p2p/dnsdisc: add implementation of EIP-1459 (#20094) 2019-09-25 11:38:13 +02:00

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.