mirror of https://github.com/poanetwork/quorum.git
c215989c10
Co-authored-by: amalraj.manigmail.com <amalraj.manigmail.com> Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Flash Sheridan <flash@pobox.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Nguyen Kien Trung <trung.n.k@gmail.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: Rob Mulholand <rmulholand@8thlight.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com> Co-authored-by: soc1c <soc1c@users.noreply.github.com> Co-authored-by: Rafael Matias <rafael@skyle.net> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Lucas Hendren <lhendre2@gmail.com> Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com> Co-authored-by: ywzqwwt <39263032+ywzqwwt@users.noreply.github.com> Co-authored-by: zcheng9 <zcheng9@hawk.iit.edu> Co-authored-by: zzy96 <zhou0250@e.ntu.edu.sg> Co-authored-by: kikilass <36239971+kikilass@users.noreply.github.com> Co-authored-by: Darrel Herbst <dherbst@gmail.com> Co-authored-by: Ross <9055337+Chadsr@users.noreply.github.com> Co-authored-by: Jeffery Robert Walsh <rlxrlps@gmail.com> Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com> Co-authored-by: Piotr Dyraga <piotr.dyraga@keep.network> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Michael Forney <mforney@mforney.org> Co-authored-by: Samuel Marks <807580+SamuelMarks@users.noreply.github.com> |
||
---|---|---|
.. | ||
CODE_OF_CONDUCT.md | ||
LICENSE | ||
README.md | ||
access_application.go | ||
access_identity_provider.go | ||
access_organization.go | ||
access_policy.go | ||
access_service_tokens.go | ||
account_members.go | ||
account_roles.go | ||
accounts.go | ||
argo.go | ||
auditlogs.go | ||
cloudflare.go | ||
custom_hostname.go | ||
custom_pages.go | ||
dns.go | ||
duration.go | ||
errors.go | ||
filter.go | ||
firewall.go | ||
firewall_rules.go | ||
go.mod | ||
go.sum | ||
ips.go | ||
keyless.go | ||
load_balancing.go | ||
lockdown.go | ||
logpush.go | ||
options.go | ||
origin_ca.go | ||
page_rules.go | ||
railgun.go | ||
rate_limiting.go | ||
registrar.go | ||
renovate.json | ||
spectrum.go | ||
ssl.go | ||
universal_ssl.go | ||
user.go | ||
user_agent.go | ||
virtualdns.go | ||
waf.go | ||
workers.go | ||
workers_kv.go | ||
zone.go |
README.md
cloudflare-go
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.