🚀
DNSControl
🚀
DNSControl
  • Introduction to DNSControl
  • Getting Started
    • Overview
    • Examples
    • Migrating zones to DNSControl
    • TypeScript autocomplete and type checking
  • Language Reference
    • JavaScript DSL
    • Top Level Functions
      • D
      • DEFAULTS
      • DOMAIN_ELSEWHERE
      • DOMAIN_ELSEWHERE_AUTO
      • D_EXTEND
      • FETCH
      • HASH
      • IP
      • NewDnsProvider
      • NewRegistrar
      • PANIC
      • REV
      • REVCOMPAT
      • getConfiguredDomains
      • require
      • require_glob
    • Domain Modifiers
      • A
      • AAAA
      • ALIAS
      • AUTODNSSEC_OFF
      • AUTODNSSEC_ON
      • CAA
      • CAA_BUILDER
      • CNAME
      • DHCID
      • DNAME
      • DNSKEY
      • DISABLE_IGNORE_SAFETY_CHECK
      • DMARC_BUILDER
      • DS
      • DefaultTTL
      • DnsProvider
      • FRAME
      • HTTPS
      • IGNORE
      • IGNORE_NAME
      • IGNORE_TARGET
      • IMPORT_TRANSFORM
      • IMPORT_TRANSFORM_STRIP
      • INCLUDE
      • LOC
      • LOC_BUILDER_DD
      • LOC_BUILDER_DMM_STR
      • LOC_BUILDER_DMS_STR
      • LOC_BUILDER_STR
      • M365_BUILDER
      • MX
      • NAMESERVER
      • NAMESERVER_TTL
      • NAPTR
      • NO_PURGE
      • NS
      • PTR
      • PURGE
      • SOA
      • SPF_BUILDER
      • SRV
      • SSHFP
      • SVCB
      • TLSA
      • TXT
      • URL
      • URL301
      • Service Provider specific
        • Akamai Edge Dns
          • AKAMAICDN
        • Amazon Route 53
          • R53_ALIAS
        • Azure DNS
          • AZURE_ALIAS
        • Cloudflare DNS
          • CF_REDIRECT
          • CF_SINGLE_REDIRECT
          • CF_TEMP_REDIRECT
          • CF_WORKER_ROUTE
        • ClouDNS
          • CLOUDNS_WR
    • Record Modifiers
      • TTL
      • Service Provider specific
        • Amazon Route 53
          • R53_ZONE
          • R53_EVALUATE_TARGET_HEALTH
    • Why CNAME/MX/NS targets require a "dot"
  • Provider
    • Supported providers
    • Akamai Edge DNS
    • Amazon Route 53
    • AutoDNS
    • AXFR+DDNS
    • Azure DNS
    • Azure Private DNS
    • BIND
    • Bunny DNS
    • CentralNic Reseller (CNR) - formerly RRPProxy
    • Cloudflare
    • ClouDNS
    • CSC Global
    • deSEC
    • DigitalOcean
    • DNS Made Easy
    • DNSimple
    • DNS-over-HTTPS
    • DOMAINNAMESHOP
    • Dynadot
    • easyname
    • Exoscale
    • Gandi_v5
    • Gcore
    • Google Cloud DNS
    • Hetzner DNS Console
    • HEXONET
    • hosting.de
    • Huawei Cloud DNS
    • Hurricane Electric DNS
    • Internet.bs
    • INWX
    • Linode
    • Loopia
    • LuaDNS
    • Microsoft DNS Server on Microsoft Windows Server
    • Mythic Beasts
    • Namecheap
    • Name.com
    • Netcup
    • Netlify
    • NS1
    • OpenSRS
    • Oracle Cloud
    • OVH
    • Packetframe
    • Porkbun
    • PowerDNS
    • Realtime Register
    • RWTH DNS-Admin
    • Sakura Cloud
    • SoftLayer DNS
    • TransIP
    • Vultr
  • Commands
    • preview/push
    • check-creds
    • get-zones
    • get-certs
    • fmt
    • creds.json
    • Global Flag
    • Disabling Colors
  • Advanced features
    • CI/CD example for GitLab
    • CLI variables
    • Nameservers and Delegations
    • Notifications
    • Useful code tricks
    • JSON Reports
  • Developer info
    • Code Style Guide
    • Documentation Style Guide
    • DNSControl is an opinionated system
    • Writing new DNS providers
    • Creating new DNS Resource Types (rtypes)
    • Integration Tests
    • Test a branch
    • Unit Testing DNS Data
    • Bug Triage Process
    • Bring-Your-Own-Secrets for automated testing
    • Debugging with dlv
    • ALIAS Records
    • TXT record testing
    • DNS records ordering
  • Release
    • How to build and ship a release
    • Changelog v3.16.0
    • GitHub releases
Powered by GitBook
On this page
  • Configuration
  • Metadata
  • Usage
  • Activation
Edit on GitHub
  1. Provider

Gcore

PreviousGandi_v5NextGoogle Cloud DNS

Last updated 5 months ago

Configuration

To use this provider, add an entry to creds.json with TYPE set to GCORE along with a Gcore account API token.

Example:

creds.json
{
  "gcore": {
    "TYPE": "GCORE",
    "api-key": "your-gcore-api-key"
  }
}

Metadata

This provider supports the following metadata fields specific to Gcore, to support Gcore's GeoDNS and failover features.

All metadata values are a string, instead of a number/int or a boolean value. If you want to set a number or a boolean value, you must specify them in their string forms.

Record level metadata

These metadata fields can be set on each individual record:

  • gcore_asn: Comma separated string of ASNs the record should be served to.

  • gcore_continents: Comma separated string of continents the record should be served to. Valid values are: as,na,an,sa,oc,eu,af.

  • gcore_countries: Comma separated string of countries and regions the record should be served to. Countries and regions are represented by their two-letter code ().

  • gcore_latitude and gcore_longitude: Coordinate of the server's location the record is pointing to. Used for GeoDistance feature.

  • gcore_notes: Arbitrary notes for the record.

  • gcore_weight: Weight of the record, used in load balancing.

  • gcore_ip: Comma separated string of IPs/CIDRs the record should be served to.

Failover (Healthcheck) metadata

These metadata fields are shared within the same RRSet (record name and type combo). The failover metadata MUST be set on all the records within the RRSet, and MUST be exactly the same across all records.

  • gcore_failover_protocol: Protocol to perform healthcheck on the server the record is pointing to. Valid values: HTTP, TCP, UDP, ICMP

  • gcore_failover_port: The port (as a string) to connect to the server.

  • gcore_failover_frequency: How often healthcheck should be performed, in seconds as a string. Valid values: 10-3600

  • gcore_failover_timeout: How long healthcheck should wait for server's response, in seconds as a string. Valid values: 1-10

  • gcore_failover_method: HTTP method used in the healthcheck. Only applies if gcore_failover_protocol is set to HTTP.

  • gcore_failover_command: Bytes to be sent to the server in the healthcheck. Only applies if gcore_failover_protocol is set to TCP or UDP.

  • gcore_failover_url: Relative URL to be requested, e.g. /. Only applies if gcore_failover_protocol is set to HTTP.

  • gcore_failover_tls: If SSL/TLS should be used when connecting to origin server. Can be either true or false as a string.

  • gcore_failover_regexp: Regular expression of expected contents in the response.

  • gcore_failover_http_status_code: Expected HTTP status code as a string. Only applies if gcore_failover_protocol is set to HTTP.

  • gcore_failover_host: Host field in the HTTP request header. Only applies if gcore_failover_protocol is set to HTTP.

Filters

The gcore_filters metadata is a semicolon delimited string of several "filter" values.

Each filter is a comma separated string of 2 or 3 fields:

  • 2 fields: type,strict.

  • 3 fields: type,strict,limit.

As for the meaning of the fields:

  • type is the type of the filter, e.g. healthcheck, geodistance.

  • strict specifies what happens if the filter returns no records. If strict is false, then all records will be returned. If strict is true, then no records will be returned.

  • limit specifies the maximum number of records to be returned. This is an optional field.

Let's take an example gcore_filters value: healthcheck,false;geodistance,false;first_n,false,2

This example filter specifies 3 filters: healthcheck, geodistance, first_n. For all three filters, the strict field is set to false. For first_n filter, the max number of records to return is 2.

But this is too complicated for me! (Generating metadata with GCore itself)

GCore provider will also display the record metadata in the corrections list. If you're overwhelmed by the instructions above, you can do the following instead:

  1. Add your records manually on Gcore's DNS control panel, and set all the metadata/filters you need.

  2. Run dnscontrol preview. You will see DNSControl wants to delete your records:

    - DELETE test.example.com A 1.1.1.1 {"gcore_asn":"1234,2345","gcore_continents":"af,an,as,eu,na,oc,sa","gcore_countries":"cn,us","gcore_filters":"geodistance,false;first_n,false,2","gcore_ip":"1.2.3.4","gcore_latitude":"34.567","gcore_longitude":"12.89","gcore_notes":"test","gcore_weight":"12"} ttl=60

    Here DNSControl has generated all the metadata above based on your existing records.

  3. Copy the metadata into your dnsconfig.js file.

Usage

An example configuration:

dnsconfig.js
var REG_NONE = NewRegistrar("none");
var DSP_GCORE = NewDnsProvider("gcore");

D("example.com", REG_NONE, DnsProvider(DSP_GCORE),
    A("test", "1.2.3.4"),
);

Example with metadata

An example configuration with metadata set:

dnsconfig.js
var REG_NONE = NewRegistrar("none");
var DSP_GCORE = NewDnsProvider("gcore");

D("example.com", REG_NONE, DnsProvider(DSP_GCORE),
    A('@', '1.1.1.1', TTL('1m'), {
        gcore_filters: 'geodistance,false;first_n,false,2',
        gcore_failover_protocol: 'HTTP',
        gcore_failover_port: '443',
        gcore_failover_frequency: '30',
        gcore_failover_timeout: '10',
        gcore_failover_method: 'GET',
        gcore_failover_url: '/',
        gcore_failover_tls: 'true',
        gcore_failover_regexp: '',
        gcore_failover_host: 'example.com',
        gcore_asn: '1234,2345',
        gcore_continents: 'as,na,an,sa,oc,eu,af',
        gcore_countries: 'cn,us',
        gcore_latitude: '12.345',
        gcore_longitude: '67.890',
        gcore_notes: 'test',
        gcore_weight: '12',
        gcore_ip: '1.2.3.4',
    }),
    A('@', '1.1.1.2', TTL('1m'), {
        gcore_filters: 'geodistance,false;first_n,false,2',
        gcore_failover_protocol: 'HTTP',
        gcore_failover_port: '443',
        gcore_failover_frequency: '30',
        gcore_failover_timeout: '10',
        gcore_failover_method: 'GET',
        gcore_failover_url: '/',
        gcore_failover_tls: 'true',
        gcore_failover_regexp: '',
        gcore_failover_host: 'example.com',
        gcore_asn: '1234,2345',
        gcore_continents: 'as,na,an,sa,oc,eu,af',
        gcore_countries: 'cn,us',
        gcore_latitude: '12.890',
        gcore_longitude: '34.567',
        gcore_notes: 'test',
        gcore_weight: '34',
        gcore_ip: '1.2.3.5',
    }),
);

Activation

DNSControl depends on a Gcore account API token.

You can obtain your API token on this page:

ISO 3166-1 alpha-2
https://accounts.gcore.com/profile/api-tokens