This commit is contained in:
Jay 2018-01-23 09:35:49 +08:00
parent aa828fe5b2
commit 81b3e054f2
1 changed files with 5 additions and 1 deletions

View File

@ -82,11 +82,12 @@ func main() {
go func() {
for {
println("run loop")
for _, it := range domains {
it.updateRecord()
}
time.Sleep(time.Duration.Minutes * 5)
time.Sleep(time.Minute * 5)
}
}()
@ -131,6 +132,7 @@ func getMyIP() string {
func (it *Domains) updateRecord() {
if len(it.Sub) == 0 {
println("no subdomain")
return
}
listInput := &route53.ListResourceRecordSetsInput{
@ -159,6 +161,7 @@ func (it *Domains) updateRecord() {
}
if len(chs) == 0 {
println("ip not change or not type a record")
return
}
@ -170,6 +173,7 @@ func (it *Domains) updateRecord() {
}
_, err = r53.ChangeResourceRecordSets(changeInput)
checkErr(err)
println("update ok")
}
func getZones(names []string) (zones []*route53.HostedZone, err error) {