lib

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DNSPodAPIUrl = "https://dnsapi.cn/Record.Modify"

Variables

View Source
var Logger = ILogger{}

Functions

func CheckIPv4Format added in v0.1.2

func CheckIPv4Format(ip string) error

func GetConfigFilePath

func GetConfigFilePath() (string, error)

func GetIPv4

func GetIPv4() (string, error)

func GetIPv4ByUrl

func GetIPv4ByUrl(url string) (string, error)

func SendEmail

func SendEmail(subject string, content string) error

func SendIPChangeEmail added in v0.1.2

func SendIPChangeEmail(newIP string, oldIP string) error

func SendStartupEmail added in v0.1.2

func SendStartupEmail(newIP string) error

func UpdateCloudflareRecord added in v0.1.4

func UpdateCloudflareRecord(req *http.Request) error

func UpdateCloudflareRecords added in v0.1.4

func UpdateCloudflareRecords(ip string) error

func UpdateDNSPodRecord added in v0.1.3

func UpdateDNSPodRecord(values url.Values) error

func UpdateDNSPodRecords added in v0.1.3

func UpdateDNSPodRecords(ip string) error

Types

type DnsRecord added in v0.1.4

type DnsRecord struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Content string `json:"content"`
	TTL     int    `json:"ttl"`
	Proxied bool   `json:"proxied"`
}

type ICloudflareConfig added in v0.1.4

type ICloudflareConfig struct {
	Enabled  bool   `yaml:"enabled"`
	APIToken string `yaml:"api_token"`
	Records  []struct {
		ZoneId     string `yaml:"zone_id"`
		RecordId   string `yaml:"record_id"`
		RecordName string `yaml:"record_name"`
		RecordType string `yaml:"record_type"`
		TTL        int    `yaml:"ttl"`
		Proxied    bool   `yaml:"proxied"`
	} `yaml:"records"`
}

type IConfig

type IConfig struct {
	Ip    IIPConfig    `yaml:"ip"`
	Email IEmailConfig `yaml:"email"`
	DDNS  IDDNSConfig  `yaml:"DDNS"`
}
var Config *IConfig = nil

func GetConfig

func GetConfig() *IConfig

type IDDNSConfig added in v0.1.3

type IDDNSConfig struct {
	DNSPod     IDNSPodConfig     `yaml:"DNSPod"`
	Cloudflare ICloudflareConfig `yaml:"Cloudflare"`
}

type IDNSPodConfig added in v0.1.3

type IDNSPodConfig struct {
	Enabled    bool   `yaml:"enabled"`
	LoginToken string `yaml:"login_token"`
	Records    []struct {
		DomainId   string `yaml:"domain_id"`
		RecordId   string `yaml:"record_id"`
		SubDomain  string `yaml:"sub_domain"`
		RecordType string `yaml:"record_type"`
		RecordLine string `yaml:"record_line"`
		TTL        int
	} `yaml:"records"`
}

type IEmailConfig

type IEmailConfig struct {
	SMTPHost   string   `yaml:"smtp_host"`
	SMTPPort   int      `yaml:"smtp_port"`
	SMTPUser   string   `yaml:"smtp_user"`
	SMTPPasswd string   `yaml:"smtp_passwd"`
	From       string   `yaml:"from"`
	To         []string `yaml:"to"`
}

type IIPConfig

type IIPConfig struct {
	QueryUrls []string `yaml:"query_urls"`
	Interval  string   `yaml:"interval"`
}

type ILogger

type ILogger struct {
}

func (*ILogger) Error

func (own *ILogger) Error(err interface{})

func (*ILogger) Info

func (own *ILogger) Info(content interface{})

func (*ILogger) PanicError

func (own *ILogger) PanicError(err error)

func (*ILogger) Println

func (own *ILogger) Println(loggerType string, content interface{})

Jump to

Keyboard shortcuts

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