gd

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 20 Imported by: 0

README

gd

Usage

Get DNS Zones and Records

Usage: gd [option] {once|hourly}

Options:
  -o string
        Fetch DNS once or hourly (default "nothing")

Documentation

Index

Constants

View Source
const (
	TableAwsZone   = `awsZone`
	TableAwsRecord = `awsRecord`
)
View Source
const (
	TableCloudflareZone   = `cloudflareZone`
	TableCloudflareRecord = `cloudflareRecord`
)
View Source
const (
	TableWestZone   = `westZone`
	TableWestRecord = `westRecord`
)

Variables

This section is empty.

Functions

func AwsRequest

func AwsRequest(keyId, key string) (client *route53.Route53)

func CloudflareRequest

func CloudflareRequest(api, key, mail, method, zoneId string) *http.Request

func CompareString

func CompareString(a, b []string) []string

Use a as Baseline

func DoRequest

func DoRequest(req *http.Request) (content []byte, err error)

func RemoveString

func RemoveString(s []string, i int) []string

func TelegramSendMessage

func TelegramSendMessage(token, chatId, msg string) string

func WestDoRequest

func WestDoRequest(req *http.Request) (content []byte, err error)

For debug West use

func WestRequest

func WestRequest(api, account, key, method, zoneId string) *http.Request

Types

type AwsRecord

type AwsRecord struct {
	ResourceRecordSets   []AwsRecordView `json:"ResourceRecordSets"`
	IsTruncated          bool            `json:"IsTruncated"`
	MaxItems             string          `json:"MaxItems"`
	NextRecordIdentifier string          `json:"NextRecordIdentifier"`
	NextRecordName       string          `json:"NextRecordName"`
	NextRecordType       string          `json:"NextRecordType"`
}

type AwsRecordView

type AwsRecordView struct {
	Name                    string              `json:"Name"`
	TTL                     int                 `json:"TTL"`
	Type                    string              `json:"Type"`
	Weight                  int                 `json:"Weight"`
	ResourceRecords         []map[string]string `json:"ResourceRecords"`
	GeoLocation             map[string]string   `json:"GeoLocation"`
	AliasTarget             string              `json:"AliasTarget"`
	Failover                string              `json:"Failover"`
	HealthCheckId           string              `json:"HealthCheckId"`
	MultiValueAnswer        string              `json:"MultiValueAnswer"`
	Region                  string              `json:"Region"`
	SetIdentifier           string              `json:"SetIdentifier"`
	TrafficPolicyInstanceId string              `json:"TrafficPolicyInstanceId"`
}

func (*AwsRecordView) CreateTableQuery

func (a *AwsRecordView) CreateTableQuery() string

func (*AwsRecordView) GetRecords

func (a *AwsRecordView) GetRecords(keyId, key, zoneId string) []AwsRecordView

func (*AwsRecordView) InsertDataQuery

func (a *AwsRecordView) InsertDataQuery() (string, []interface{})

type AwsZone

type AwsZone struct {
	IsTruncated bool          `json:"IsTruncated"`
	MaxItems    string        `json:"MaxItems"`
	NextMarker  string        `json:"NextMarker"`
	HostedZones []AwsZoneView `json:"HostedZones"`
}

type AwsZoneView

type AwsZoneView struct {
	CallerReference        string                 `json:"CallerReference"`
	Id                     string                 `json:"Id"`
	Name                   string                 `json:"Name"`
	ResourceRecordSetCount int                    `json:"ResourceRecordSetCount"`
	Config                 map[string]interface{} `json:"Config"`
}

func (*AwsZoneView) CreateTableQuery

func (a *AwsZoneView) CreateTableQuery() string

func (*AwsZoneView) GetZones

func (a *AwsZoneView) GetZones(keyId, key string) ([]string, []AwsZoneView)

func (*AwsZoneView) InsertDataQuery

func (a *AwsZoneView) InsertDataQuery() (string, []interface{})

type CloudflareRecord

type CloudflareRecord struct {
	Result     []CloudflareRecordView `json:"result"`
	Errors     []string               `json:"errors"`
	Messages   []string               `json:"messages"`
	ResultInfo map[string]int         `json:"result_info"`
	Success    bool                   `json:"success"`
}

type CloudflareRecordView

type CloudflareRecordView struct {
	Id           string                 `json:"id"`
	ZoneName     string                 `json:"zone_name"`
	Name         string                 `json:"name"`
	Type         string                 `json:"type"`
	Content      string                 `json:"content"`
	TTL          int                    `json:"ttl"`
	Proxiable    bool                   `json:"proxiable"`
	Proxied      bool                   `json:"proxied"`
	Locked       bool                   `json:"locked"`
	Meta         map[string]interface{} `json:"meta"`
	ModifiedTime string                 `json:"modified_on"`
	CreatedTime  string                 `json:"created_on"`
	ZoneId       string                 `json:"zone_id"`
}

func (*CloudflareRecordView) CreateTableQuery

func (cf *CloudflareRecordView) CreateTableQuery() string

func (*CloudflareRecordView) GetRecords

func (cf *CloudflareRecordView) GetRecords(api, key, mail, zoneId string) []CloudflareRecordView

func (*CloudflareRecordView) InsertData

func (cf *CloudflareRecordView) InsertData() (string, []interface{})

type CloudflareZone

type CloudflareZone struct {
	Result     []CloudflareZoneView `json:"result"`
	Errors     []string             `json:"errors"`
	Messages   []string             `json:"messages"`
	ResultInfo map[string]int       `json:"result_info"`
	Success    bool                 `json:"success"`
}

type CloudflareZoneView

type CloudflareZoneView struct {
	Id                  string                 `json:"id"`
	Name                string                 `json:"name"`
	OriginalRegistrar   string                 `json:"original_registrar"`
	Status              string                 `json:"status"`
	Type                string                 `json:"type"`
	ActivatedTime       string                 `json:"activated_on"`
	ModifiedTime        string                 `json:"modified_on"`
	CreatedTime         string                 `json:"created_on"`
	Paused              bool                   `json:"paused"`
	NameServers         []string               `json:"name_servers"`
	OriginalNameServers []string               `json:"original_name_servers"`
	Account             map[string]string      `json:"account"`
	Owner               map[string]string      `json:"owner"`
	Plan                map[string]interface{} `json:"plan"`
	Meta                map[string]interface{} `json:"meta"`
	DevelopmentMode     int                    `json:"development_mode"`
	OriginalDnshost     string                 `json:"original_dnshost"`
}

func (*CloudflareZoneView) CreateTableQuery

func (cf *CloudflareZoneView) CreateTableQuery() string

func (*CloudflareZoneView) GetZones

func (cf *CloudflareZoneView) GetZones(api, key, mail string) ([]string, []CloudflareZoneView)

func (*CloudflareZoneView) InsertData

func (cf *CloudflareZoneView) InsertData() (string, []interface{})

type Sql

type Sql struct {
	Db  *sql.DB
	Err error
	// contains filtered or unexported fields
}

func (*Sql) Connection

func (my *Sql) Connection() *sql.DB

func (*Sql) CreateTable

func (my *Sql) CreateTable(query string)

func (*Sql) DropTable

func (my *Sql) DropTable(tableName string)

func (*Sql) InsertData

func (my *Sql) InsertData(query string, val []interface{}) (err error)

func (*Sql) QueryData

func (my *Sql) QueryData(query string) (err error)

func (*Sql) QueryWestDomain

func (my *Sql) QueryWestDomain(query string) (result []string, err error)

type WestRecord

type WestRecord struct {
	Result   int    `json:"result"`
	ClientId string `json:"clientid"`
	Data     struct {
		PageNo    int              `json:"pageno"`
		Limit     int              `json:"limit"`
		Total     int              `json:"total"`
		PageCount int              `json:"pagecount"`
		Items     []WestRecordView `json:"items"`
	} `json:"data"`
	TotalPage string `json:"totalpages"`
}

type WestRecordView

type WestRecordView struct {
	Id    int    `json:"id"`
	Item  string `json:"item"`
	Value string `json:"value"`
	Type  string `json:"type"`
	Level int    `json:"level"`
	TTL   int    `json:"ttl"`
	Line  string `json:"line"`
	Pause int    `json:"pause"`
	Zone  string
}

func (*WestRecordView) CreateTableQuery

func (w *WestRecordView) CreateTableQuery() string

func (*WestRecordView) GetRecords

func (w *WestRecordView) GetRecords(api, account, key, zoneId string) []WestRecordView

func (*WestRecordView) InsertData

func (w *WestRecordView) InsertData() (string, []interface{})

type WestZone

type WestZone struct {
	Result   int    `json:"result"`
	ClientId string `json:"clientid"`
	Data     struct {
		Items []WestZoneView `json:"items"`
	} `json:"data"`
	Limit     string `json:"limit"`
	Total     string `json:"total"`
	PageNo    string `json:"pageno"`
	TotalPage string `json:"totalpage"`
}

type WestZoneView

type WestZoneView struct {
	Domain       string `json:"domain"`
	RegistryDate string `json:"regdate"`
	ExpiryDate   string `json:"expdate"`
	Dns1         string `json:"dns1"`
	Dns2         string `json:"dns2"`
	Dns3         string `json:"dns3"`
	Dns4         string `json:"dns4"`
	Dns5         string `json:"dns5"`
	Dns6         string `json:"dns6"`
	Year         string `json:"year"`
	Version      string `json:"version"`
	Hold         string `json:"clienthold"`
}

func (*WestZoneView) CreateTableQuery

func (w *WestZoneView) CreateTableQuery() string

func (*WestZoneView) GetZones

func (w *WestZoneView) GetZones(api, account, key string) ([]string, []WestZoneView)

func (*WestZoneView) InsertData

func (w *WestZoneView) InsertData() (string, []interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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