cmd/devp2p: update TTL max for Cloudflare (#23885)
This was apparently recently changed by Cloudflare, and began returning an error: 'TTL must be between 60 and 86400 seconds, or 1 for Automatic' Date: 2021-11-10 15:25:20-08:00 Signed-off-by: meows <b5c6@protonmail.com>
This commit is contained in:
		
							parent
							
								
									c57df9ca28
								
							
						
					
					
						commit
						5358e491f3
					
				@ -133,7 +133,8 @@ func (c *cloudflareClient) uploadRecords(name string, records map[string]string)
 | 
				
			|||||||
			log.Info(fmt.Sprintf("Creating %s = %q", path, val))
 | 
								log.Info(fmt.Sprintf("Creating %s = %q", path, val))
 | 
				
			||||||
			ttl := rootTTL
 | 
								ttl := rootTTL
 | 
				
			||||||
			if path != name {
 | 
								if path != name {
 | 
				
			||||||
				ttl = treeNodeTTL // Max TTL permitted by Cloudflare
 | 
									ttl = treeNodeTTLCloudflare // Max TTL permitted by Cloudflare
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			record := cloudflare.DNSRecord{Type: "TXT", Name: path, Content: val, TTL: ttl}
 | 
								record := cloudflare.DNSRecord{Type: "TXT", Name: path, Content: val, TTL: ttl}
 | 
				
			||||||
			_, err = c.CreateDNSRecord(context.Background(), c.zoneID, record)
 | 
								_, err = c.CreateDNSRecord(context.Background(), c.zoneID, record)
 | 
				
			||||||
 | 
				
			|||||||
@ -115,8 +115,9 @@ var (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
	rootTTL     = 30 * 60              // 30 min
 | 
						rootTTL               = 30 * 60              // 30 min
 | 
				
			||||||
	treeNodeTTL = 4 * 7 * 24 * 60 * 60 // 4 weeks
 | 
						treeNodeTTL           = 4 * 7 * 24 * 60 * 60 // 4 weeks
 | 
				
			||||||
 | 
						treeNodeTTLCloudflare = 24 * 60 * 60         // 1 day
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// dnsSync performs dnsSyncCommand.
 | 
					// dnsSync performs dnsSyncCommand.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user