@@ -31,34 +31,34 @@ func NewDNSResolver(lookup LookupTXTFunc) *DNSResolver {
3131 return & DNSResolver {lookupTXT : lookup }
3232}
3333
34- func (r * DNSResolver ) Resolve (ctx context.Context , p path.Path , options ... ResolveOption ) (ResolveResult , error ) {
34+ func (r * DNSResolver ) Resolve (ctx context.Context , p path.Path , options ... ResolveOption ) (Result , error ) {
3535 ctx , span := startSpan (ctx , "DNSResolver.Resolve" , trace .WithAttributes (attribute .Stringer ("Path" , p )))
3636 defer span .End ()
3737
3838 return resolve (ctx , r , p , ProcessResolveOptions (options ))
3939}
4040
41- func (r * DNSResolver ) ResolveAsync (ctx context.Context , p path.Path , options ... ResolveOption ) <- chan ResolveAsyncResult {
41+ func (r * DNSResolver ) ResolveAsync (ctx context.Context , p path.Path , options ... ResolveOption ) <- chan AsyncResult {
4242 ctx , span := startSpan (ctx , "DNSResolver.ResolveAsync" , trace .WithAttributes (attribute .Stringer ("Path" , p )))
4343 defer span .End ()
4444
4545 return resolveAsync (ctx , r , p , ProcessResolveOptions (options ))
4646}
4747
48- func (r * DNSResolver ) resolveOnceAsync (ctx context.Context , p path.Path , options ResolveOptions ) <- chan ResolveAsyncResult {
48+ func (r * DNSResolver ) resolveOnceAsync (ctx context.Context , p path.Path , options ResolveOptions ) <- chan AsyncResult {
4949 ctx , span := startSpan (ctx , "DNSResolver.ResolveOnceAsync" , trace .WithAttributes (attribute .Stringer ("Path" , p )))
5050 defer span .End ()
5151
52- out := make (chan ResolveAsyncResult , 1 )
52+ out := make (chan AsyncResult , 1 )
5353 if p .Namespace () != path .IPNSNamespace {
54- out <- ResolveAsyncResult {Err : fmt .Errorf ("unsupported namespace: %q" , p .Namespace ())}
54+ out <- AsyncResult {Err : fmt .Errorf ("unsupported namespace: %q" , p .Namespace ())}
5555 close (out )
5656 return out
5757 }
5858
5959 fqdn := p .Segments ()[1 ]
6060 if _ , ok := dns .IsDomainName (fqdn ); ! ok {
61- out <- ResolveAsyncResult {Err : fmt .Errorf ("not a valid domain name: %q" , fqdn )}
61+ out <- AsyncResult {Err : fmt .Errorf ("not a valid domain name: %q" , fqdn )}
6262 close (out )
6363 return out
6464 }
@@ -69,10 +69,10 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, p path.Path, options
6969 fqdn += "."
7070 }
7171
72- rootChan := make (chan ResolveAsyncResult , 1 )
72+ rootChan := make (chan AsyncResult , 1 )
7373 go workDomain (ctx , r , fqdn , rootChan )
7474
75- subChan := make (chan ResolveAsyncResult , 1 )
75+ subChan := make (chan AsyncResult , 1 )
7676 go workDomain (ctx , r , "_dnslink." + fqdn , subChan )
7777
7878 go func () {
@@ -90,7 +90,7 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, p path.Path, options
9090 }
9191 if subRes .Err == nil {
9292 p , err := joinPaths (subRes .Path , p )
93- emitOnceResult (ctx , out , ResolveAsyncResult {Path : p , LastMod : time .Now (), Err : err })
93+ emitOnceResult (ctx , out , AsyncResult {Path : p , LastMod : time .Now (), Err : err })
9494 // Return without waiting for rootRes, since this result
9595 // (for "_dnslink."+fqdn) takes precedence
9696 return
@@ -103,7 +103,7 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, p path.Path, options
103103 }
104104 if rootRes .Err == nil {
105105 p , err := joinPaths (rootRes .Path , p )
106- emitOnceResult (ctx , out , ResolveAsyncResult {Path : p , LastMod : time .Now (), Err : err })
106+ emitOnceResult (ctx , out , AsyncResult {Path : p , LastMod : time .Now (), Err : err })
107107 // Do not return here. Wait for subRes so that it is
108108 // output last if good, thereby giving subRes precedence.
109109 } else {
@@ -120,7 +120,7 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, p path.Path, options
120120 if rootResErr == ErrResolveFailed && subResErr == ErrResolveFailed {
121121 // Wrap error so that it can be tested if it is a ErrResolveFailed
122122 err := fmt .Errorf ("%w: _dnslink subdomain at %q is missing a TXT record (https://docs.ipfs.tech/concepts/dnslink/)" , ErrResolveFailed , gopath .Base (fqdn ))
123- emitOnceResult (ctx , out , ResolveAsyncResult {Err : err })
123+ emitOnceResult (ctx , out , AsyncResult {Err : err })
124124 }
125125 return
126126 }
@@ -130,7 +130,7 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, p path.Path, options
130130 return out
131131}
132132
133- func workDomain (ctx context.Context , r * DNSResolver , name string , res chan ResolveAsyncResult ) {
133+ func workDomain (ctx context.Context , r * DNSResolver , name string , res chan AsyncResult ) {
134134 ctx , span := startSpan (ctx , "DNSResolver.WorkDomain" , trace .WithAttributes (attribute .String ("Name" , name )))
135135 defer span .End ()
136136
@@ -146,20 +146,20 @@ func workDomain(ctx context.Context, r *DNSResolver, name string, res chan Resol
146146 }
147147 }
148148 // Could not look up any text records for name
149- res <- ResolveAsyncResult {Err : err }
149+ res <- AsyncResult {Err : err }
150150 return
151151 }
152152
153153 for _ , t := range txt {
154154 p , err := parseEntry (t )
155155 if err == nil {
156- res <- ResolveAsyncResult {Path : p }
156+ res <- AsyncResult {Path : p }
157157 return
158158 }
159159 }
160160
161161 // There were no TXT records with a dnslink
162- res <- ResolveAsyncResult {Err : ErrResolveFailed }
162+ res <- AsyncResult {Err : ErrResolveFailed }
163163}
164164
165165func parseEntry (txt string ) (path.Path , error ) {
0 commit comments