@@ -274,55 +274,6 @@ func waitForDNSZone(ctx context.Context, domainAPI *domain.API, dnsZone string,
274274 }, scw .WithContext (ctx ))
275275}
276276
277- func newDNSResolver () * net.Resolver {
278- return & net.Resolver {
279- PreferGo : true ,
280- Dial : func (ctx context.Context , network , address string ) (net.Conn , error ) {
281- d := net.Dialer {
282- Timeout : time .Millisecond * time .Duration (500 ),
283- }
284- conn , err := d .DialContext (ctx , network , "ns0.dom.scw.cloud:53" )
285- if err != nil {
286- conn , err = d .DialContext (ctx , network , "ns1.dom.scw.cloud:53" )
287- }
288- return conn , err
289- },
290- }
291- }
292-
293- var (
294- dnsResolverTickDelay = time .Millisecond * 500
295- disableDNSResolver bool
296- )
297-
298- func cnameResolver (ctx context.Context , timeout time.Duration , hostname , expectedCNAME string ) bool {
299- if disableDNSResolver {
300- return true
301- }
302- ticker := time .Tick (dnsResolverTickDelay )
303- ctx , cancel := context .WithTimeout (ctx , timeout )
304- defer cancel ()
305-
306- r := newDNSResolver ()
307-
308- for range ticker {
309- cname , err := r .LookupCNAME (ctx , hostname )
310- if err != nil {
311- select {
312- case <- ctx .Done ():
313- return false
314- default :
315- continue
316- }
317- }
318- if cname == expectedCNAME {
319- return true
320- }
321- }
322-
323- return false
324- }
325-
326277func findDefaultReverse (address string ) string {
327278 parts := strings .Split (address , "." )
328279 for i , j := 0 , len (parts )- 1 ; i < j ; i , j = i + 1 , j - 1 {
0 commit comments