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"
    // DREAMHOST for Dreamhost
    DREAMHOST = "Dreamhost"
    // 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, use_proxy bool) *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 ResolveDNS Uses

func ResolveDNS(hostname, resolver, ipType string) string

ResolveDNS will query DNS for a given hostname.

func SendMailNotify Uses

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

SendMailNotify sends mail notify if IP is changed

func SendNotify Uses

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

SendNotify sends notify if IP is changed

func SendSlackNotify Uses

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

SendSlack sends slack if IP is changed

func SendTelegramNotify Uses

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

SendTelegramNotify sends notify if IP is changed

type Domain Uses

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

Domain struct

type MailNotify Uses

type MailNotify 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 Notify Uses

type Notify struct {
    Telegram TelegramNotify `json:"telegram"`
    Mail     MailNotify     `json:"mail"`
    Slack    SlackNotify    `json:"slack"`

Notify struct

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"`
    Resolver    string   `json:"resolver"`
    UseProxy    bool     `json:"use_proxy"`

Settings struct

type SlackNotify Uses

type SlackNotify struct {
    Enabled     bool   `json:"enabled"`
    BotApiToken string `json:"bot_api_token"`
    Channel     string `json:"channel"`
    MsgTemplate string `json:"message_template"`
    UseProxy    bool   `json:"use_proxy"`

Notify struct for slack notification

type TelegramNotify Uses

type TelegramNotify struct {
    Enabled     bool   `json:"enabled"`
    BotApiKey   string `json:"bot_api_key"`
    ChatId      string `json:"chat_id"`
    MsgTemplate string `json:"message_template"`
    UseProxy    bool   `json:"use_proxy"`

Notify struct for telegram notification



Package godns imports 15 packages (graph) and is imported by 8 packages. Updated 2020-07-02. Refresh now. Tools for package owners.