sf

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupDeleteGraceRecords added in v1.1.2

func CleanupDeleteGraceRecords(cloudflareDNSRecords []cloudflare.DNSRecord, deleteGraceRecords []cloudflare.DNSRecord)

func CreateCloudflareDNSRecord

func CreateCloudflareDNSRecord(record cloudflare.DNSRecord)

CreateCloudflareDNSRecord is a wrapper function to create a DNS record

func CreateDeleteGraceRecord added in v1.1.2

func CreateDeleteGraceRecord(orphanedRecordName string)

func DeleteCloudflareDNSRecord

func DeleteCloudflareDNSRecord(record cloudflare.DNSRecord)

DeleteCloudflareDNSRecord is a wrapper function to delete a DNS record

func GetAdditionalRecords

func GetAdditionalRecords(userRecords []cloudflare.DNSRecord) []cloudflare.DNSRecord

GetAdditionalRecords gathers and checks configured additionalRecords

func GetCloudflareDNSRecords

func GetCloudflareDNSRecords() []cloudflare.DNSRecord

GetCloudflareDNSRecords gathers all DNS records in a given zone

func GetCloudflareZoneID

func GetCloudflareZoneID()

GetCloudflareZoneID creates a global var containing the zone id

func GetCurrentIP

func GetCurrentIP()

GetCurrentIP checks the current public IP

func GetDeleteGraceRecord added in v1.1.2

func GetDeleteGraceRecord(orphanedRecordName string, deleteGraceRecords []cloudflare.DNSRecord) cloudflare.DNSRecord

func GetDeleteGraceRecords added in v1.1.2

func GetDeleteGraceRecords() []cloudflare.DNSRecord

GetDeleteGraceRecords gathers all delete grace DNS records in a given zone

func GetMissingDNSRecords added in v1.0.6

func GetMissingDNSRecords(cloudflareDNSRecords []cloudflare.DNSRecord, userRecords []cloudflare.DNSRecord) []cloudflare.DNSRecord

GetMissingDNSRecords compares Cloudflare DNS records with Traefik rules and additionalRecords

func GetOrphanedDNSRecords added in v1.0.6

func GetOrphanedDNSRecords(cloudflareDNSRecords []cloudflare.DNSRecord, userRecords []cloudflare.DNSRecord) []cloudflare.DNSRecord

GetOrphanedDNSRecords compares Cloudflare DNS records with Traefik rules and additionalRecords

func GetTraefikRules

func GetTraefikRules(userRecords []cloudflare.DNSRecord) []cloudflare.DNSRecord

GetTraefikRules gathers and formats all Traefik http routers

func ParseFlags

func ParseFlags() (string, bool, bool)

ParseFlags returns the supplied flags

func SendSlackMessage

func SendSlackMessage()

SendSlackMessage sends a Slack message if configured

func SetupCloudflareClient

func SetupCloudflareClient()

SetupCloudflareClient creates a global var with a Cloudflare client instance

func UpdateCloudflareDNSRecords

func UpdateCloudflareDNSRecords(cloudflareDNSRecords []cloudflare.DNSRecord, userRecords []cloudflare.DNSRecord)

UpdateCloudflareDNSRecords updates the public IP and additionalRecords

func UpdateDeleteGraceRecord added in v1.1.2

func UpdateDeleteGraceRecord(deleteGraceRecord cloudflare.DNSRecord, orphanedRecordName string)

Types

type Configuration

type Configuration struct {
	RootDomain    string   `yaml:"rootDomain,omitempty"`
	IPProviders   []string `yaml:"ipProviders"`
	Notifications struct {
		Slack struct {
			WebhookURL string `yaml:"webhookURL"`
			Username   string `yaml:"username"`
			Channel    string `yaml:"channel"`
			IconURL    string `yaml:"iconURL"`
		} `yaml:"slack"`
	} `yaml:"notifications"`
	Traefik struct {
		URL          string   `yaml:"url"`
		Username     string   `yaml:"username"`
		Password     string   `yaml:"password"`
		IgnoredRules []string `yaml:"ignoredRules"`
	} `yaml:"traefik"`
	AdditionalRecords []cloudflare.DNSRecord `yaml:"additionalRecords"`
	Cloudflare        struct {
		Email       string `yaml:"email"`
		APIKey      string `yaml:"apiKey"`
		DeleteGrace int    `yaml:"deleteGrace"`
		ZoneName    string `yaml:"zoneName"`
		Defaults    struct {
			Type    string `yaml:"type"`
			Proxied bool   `yaml:"proxied"`
			TTL     int    `yaml:"ttl"`
		} `yaml:"defaults"`
	} `yaml:"cloudflare"`
}

Configuration is a struct to store the script's configuration

func GetConfig

func GetConfig(configFilePath string) Configuration

GetConfig creates a global var holding the configuration

type TraefikRouter

type TraefikRouter struct {
	EntryPoints []string `json:"entryPoints"`
	Middlewares []string `json:"middlewares,omitempty"`
	Service     string   `json:"service"`
	Rule        string   `json:"rule"`
	TLS         struct {
		CertResolver string `json:"certResolver"`
		Domains      []struct {
			Main string   `json:"main"`
			Sans []string `json:"sans"`
		} `json:"domains"`
	} `json:"tls,omitempty"`
	Status   string   `json:"status"`
	Using    []string `json:"using"`
	Name     string   `json:"name"`
	Provider string   `json:"provider"`
	Priority int64    `json:"priority,omitempty"`
}

TraefikRouter is a struct to store a router object of Traefik

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL