godns: github.com/TimothyYe/godns Index | Files | Directories

package godns

import "github.com/TimothyYe/godns"


Package Files

settings.go template.go utils.go


const (
    // PanicMax is the max allowed panic times
    PanicMax = 5
    // DNSPOD for dnspod.cn
    DNSPOD = "DNSPod"
    // HE for he.net
    HE  = "HE"
    // CLOUDFLARE for cloudflare.com
    CLOUDFLARE = "Cloudflare"
    // ALIDNS for AliDNS
    ALIDNS = "AliDNS"
    // GOOGLE for Google Domains
    GOOGLE = "Google"
    // DUCK for Duck DNS
    DUCK = "DuckDNS"
    // IPV4 for IPV4 mode
    IPV4 = "IPV4"
    // IPV6 for IPV6 mode
    IPV6 = "IPV6"


var (
     = "" /* 779 byte string literal not displayed */


func CheckSettings Uses

func CheckSettings(config *Settings) error

CheckSettings check the format of settings

func GetCurrentIP Uses

func GetCurrentIP(configuration *Settings) (string, error)

GetCurrentIP gets an IP from either internet or specific interface, depending on configuration

func GetHttpClient Uses

func GetHttpClient(configuration *Settings) *http.Client

GetHttpClient creates the HTTP client and return it

func GetIPFromInterface Uses

func GetIPFromInterface(configuration *Settings) (string, error)

GetIPFromInterface gets IP address from the specific interface

func GetIPOnline Uses

func GetIPOnline(configuration *Settings) (string, error)

GetIPOnline gets public IP from internet

func LoadSettings Uses

func LoadSettings(configPath string, settings *Settings) error

LoadSettings -- Load settings from config file

func SendNotify Uses

func SendNotify(configuration *Settings, domain, currentIP string) error

SendNotify sends mail notify if IP is changed

type Domain Uses

type Domain struct {
    DomainName string   `json:"domain_name"`
    SubDomains []string `json:"sub_domains"`

Domain struct

type Notify Uses

type Notify struct {
    Enabled      bool   `json:"enabled"`
    SMTPServer   string `json:"smtp_server"`
    SMTPUsername string `json:"smtp_username"`
    SMTPPassword string `json:"smtp_password"`
    SMTPPort     int    `json:"smtp_port"`
    SendTo       string `json:"send_to"`

Notify struct for SMTP notification

type Settings Uses

type Settings struct {
    Provider    string   `json:"provider"`
    Email       string   `json:"email"`
    Password    string   `json:"password"`
    LoginToken  string   `json:"login_token"`
    Domains     []Domain `json:"domains"`
    IPUrl       string   `json:"ip_url"`
    IPV6Url     string   `json:"ipv6_url"`
    Interval    int      `json:"interval"`
    UserAgent   string   `json:"user_agent,omitempty"`
    LogPath     string   `json:"log_path"`
    Socks5Proxy string   `json:"socks5_proxy"`
    Notify      Notify   `json:"notify"`
    IPInterface string   `json:"ip_interface"`
    IPType      string   `json:"ip_type"`

Settings struct



Package godns imports 12 packages (graph) and is imported by 7 packages. Updated 2020-02-17. Refresh now. Tools for package owners.