Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-namesys
Commits
1f2af4e5
Commit
1f2af4e5
authored
Apr 21, 2021
by
Marcin Rataj
Committed by
vyzo
Apr 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support non-ICANN DNSLink names
https://github.com/ipfs/go-ipfs/issues/8060
parent
16c89a57
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
dns.go
dns.go
+2
-2
go.mod
go.mod
+1
-1
go.sum
go.sum
+0
-2
namesys.go
namesys.go
+8
-4
No files found.
dns.go
View file @
1f2af4e5
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
path
"github.com/ipfs/go-path"
path
"github.com/ipfs/go-path"
opts
"github.com/ipfs/interface-go-ipfs-core/options/namesys"
opts
"github.com/ipfs/interface-go-ipfs-core/options/namesys"
isd
"github.com/
jbenet/go-is-domain
"
dns
"github.com/
miekg/dns
"
)
)
// LookupTXTFunc is a generic type for a function that lookups TXT record values.
// LookupTXTFunc is a generic type for a function that lookups TXT record values.
...
@@ -52,7 +52,7 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, name string, options
...
@@ -52,7 +52,7 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, name string, options
segments
:=
strings
.
SplitN
(
name
,
"/"
,
2
)
segments
:=
strings
.
SplitN
(
name
,
"/"
,
2
)
domain
:=
segments
[
0
]
domain
:=
segments
[
0
]
if
!
isd
.
IsDomain
(
domain
)
{
if
_
,
ok
:=
dns
.
IsDomain
Name
(
domain
)
;
!
ok
{
out
<-
onceResult
{
err
:
fmt
.
Errorf
(
"not a valid domain name: %s"
,
domain
)}
out
<-
onceResult
{
err
:
fmt
.
Errorf
(
"not a valid domain name: %s"
,
domain
)}
close
(
out
)
close
(
out
)
return
out
return
out
...
...
go.mod
View file @
1f2af4e5
...
@@ -13,7 +13,6 @@ require (
...
@@ -13,7 +13,6 @@ require (
github.com/ipfs/go-log
v1.0.4
github.com/ipfs/go-log
v1.0.4
github.com/ipfs/go-path
v0.0.9
github.com/ipfs/go-path
v0.0.9
github.com/ipfs/interface-go-ipfs-core
v0.4.0
github.com/ipfs/interface-go-ipfs-core
v0.4.0
github.com/jbenet/go-is-domain
v1.0.5
github.com/jbenet/goprocess
v0.1.4
github.com/jbenet/goprocess
v0.1.4
github.com/libp2p/go-libp2p
v0.13.0
github.com/libp2p/go-libp2p
v0.13.0
github.com/libp2p/go-libp2p-core
v0.8.0
github.com/libp2p/go-libp2p-core
v0.8.0
...
@@ -21,6 +20,7 @@ require (
...
@@ -21,6 +20,7 @@ require (
github.com/libp2p/go-libp2p-peerstore
v0.2.6
github.com/libp2p/go-libp2p-peerstore
v0.2.6
github.com/libp2p/go-libp2p-record
v0.1.3
github.com/libp2p/go-libp2p-record
v0.1.3
github.com/libp2p/go-libp2p-testing
v0.4.0
github.com/libp2p/go-libp2p-testing
v0.4.0
github.com/miekg/dns
v1.1.41
github.com/multiformats/go-multiaddr
v0.3.1
github.com/multiformats/go-multiaddr
v0.3.1
github.com/multiformats/go-multiaddr-dns
v0.3.1
github.com/multiformats/go-multiaddr-dns
v0.3.1
github.com/multiformats/go-multihash
v0.0.14
github.com/multiformats/go-multihash
v0.0.14
...
...
go.sum
View file @
1f2af4e5
...
@@ -214,8 +214,6 @@ github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+
...
@@ -214,8 +214,6 @@ github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+
github.com/jbenet/go-cienv
v0.0.0-20150120210510-1bb1476777ec/go.mod h1:
rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs=
github.com/jbenet/go-cienv
v0.0.0-20150120210510-1bb1476777ec/go.mod h1:
rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs=
github.com/jbenet/go-cienv
v0.1.0 h1:
Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc=
github.com/jbenet/go-cienv
v0.1.0 h1:
Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc=
github.com/jbenet/go-cienv
v0.1.0/go.mod h1:
TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
github.com/jbenet/go-cienv
v0.1.0/go.mod h1:
TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
github.com/jbenet/go-is-domain
v1.0.5 h1:
r92uiHbMEJo9Fkey5pMBtZAzjPQWic0ieo7Jw1jEuQQ=
github.com/jbenet/go-is-domain
v1.0.5/go.mod h1:
xbRLRb0S7FgzDBTJlguhDVwLYM/5yNtvktxj2Ttfy7Q=
github.com/jbenet/go-temp-err-catcher
v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:
8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs=
github.com/jbenet/go-temp-err-catcher
v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:
8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs=
github.com/jbenet/go-temp-err-catcher
v0.1.0 h1:
zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk=
github.com/jbenet/go-temp-err-catcher
v0.1.0 h1:
zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk=
github.com/jbenet/go-temp-err-catcher
v0.1.0/go.mod h1:
0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk=
github.com/jbenet/go-temp-err-catcher
v0.1.0/go.mod h1:
0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk=
...
...
namesys.go
View file @
1f2af4e5
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
// DHT).
// DHT).
//
//
// Additionally, the /ipns/ namespace can also be used with domain names that
// Additionally, the /ipns/ namespace can also be used with domain names that
// use DNSLink (/ipns/
my.domain.example, see https://dnslink.io) and proquint
// use DNSLink (/ipns/
<dnslink_name>, https://docs.ipfs.io/concepts/dnslink/)
// strings.
//
and proquint
strings.
//
//
// The package provides implementations for all three resolvers.
// The package provides implementations for all three resolvers.
package
namesys
package
namesys
...
@@ -26,10 +26,10 @@ import (
...
@@ -26,10 +26,10 @@ import (
dssync
"github.com/ipfs/go-datastore/sync"
dssync
"github.com/ipfs/go-datastore/sync"
path
"github.com/ipfs/go-path"
path
"github.com/ipfs/go-path"
opts
"github.com/ipfs/interface-go-ipfs-core/options/namesys"
opts
"github.com/ipfs/interface-go-ipfs-core/options/namesys"
isd
"github.com/jbenet/go-is-domain"
ci
"github.com/libp2p/go-libp2p-core/crypto"
ci
"github.com/libp2p/go-libp2p-core/crypto"
peer
"github.com/libp2p/go-libp2p-core/peer"
peer
"github.com/libp2p/go-libp2p-core/peer"
routing
"github.com/libp2p/go-libp2p-core/routing"
routing
"github.com/libp2p/go-libp2p-core/routing"
dns
"github.com/miekg/dns"
madns
"github.com/multiformats/go-multiaddr-dns"
madns
"github.com/multiformats/go-multiaddr-dns"
)
)
...
@@ -225,9 +225,13 @@ func (ns *mpns) resolveOnceAsync(ctx context.Context, name string, options opts.
...
@@ -225,9 +225,13 @@ func (ns *mpns) resolveOnceAsync(ctx context.Context, name string, options opts.
if
err
==
nil
{
if
err
==
nil
{
res
=
ns
.
ipnsResolver
res
=
ns
.
ipnsResolver
}
else
if
isd
.
IsDomain
(
key
)
{
}
else
if
_
,
ok
:=
dns
.
IsDomain
Name
(
key
)
;
ok
{
res
=
ns
.
dnsResolver
res
=
ns
.
dnsResolver
}
else
{
}
else
{
// TODO: remove proquint?
// dns.IsDomainName(key) will return true for proquint strings,
// so this block is a dead code.
// (alternative is to move this before DNS check)
res
=
ns
.
proquintResolver
res
=
ns
.
proquintResolver
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment