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
mf
go-multiaddr-fmt
Commits
8e186559
Commit
8e186559
authored
Feb 27, 2019
by
Raúl Kripalani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for HTTP(S), WebRTCDirect; remove bad HTTP pattern.
parent
74e82e2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
patterns.go
patterns.go
+0
-1
patterns_test.go
patterns_test.go
+19
-3
No files found.
patterns.go
View file @
8e186559
...
...
@@ -55,7 +55,6 @@ var HTTP = Or(
And
(
TCP
,
Base
(
ma
.
P_HTTP
)),
And
(
IP
,
Base
(
ma
.
P_HTTP
)),
And
(
DNS
,
Base
(
ma
.
P_HTTP
)),
And
(
DNS
),
)
// Define https over TCP or DNS or https over DNS format multiaddr
...
...
patterns_test.go
View file @
8e186559
...
...
@@ -44,19 +44,35 @@ var TestVectors = map[string]*testVector{
"/ip4/1.2.3.4/tcp/1234/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/ip6/::/tcp/1234/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/ip6/::/udp/1234/utp/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/ip4/0.0.0.0/udp/1234/utp/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
},
"/ip4/0.0.0.0/udp/1234/utp/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
},
Bad
:
[]
string
{
"/ip4/1.2.3.4/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/ip6/::/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/tcp/123/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/ip6/::/udp/1234/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/ip6/::/utp/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
"/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
}},
"/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
,
},
},
"DNS"
:
{
Pattern
:
DNS
,
Good
:
[]
string
{
"/dnsaddr/
ipfs
.io"
,
"/dns4/
ipfs.io"
,
"/dns4/libp2p
.io"
,
"/dns6/
protocol.ai
"
},
Good
:
[]
string
{
"/dnsaddr/
example
.io"
,
"/dns4/
example
.io"
,
"/dns6/
example.io
"
},
Bad
:
[]
string
{
"/ip4/127.0.0.1"
},
},
"WebRTCDirect"
:
{
Pattern
:
WebRTCDirect
,
Good
:
[]
string
{
"/ip4/1.2.3.4/tcp/3456/http/p2p-webrtc-direct"
,
"/ip6/::/tcp/0/http/p2p-webrtc-direct"
},
Bad
:
[]
string
{
"/ip4/0.0.0.0"
,
"/ip6/fc00::"
,
"/udp/12345"
,
"/ip6/fc00::/tcp/5523/udp/9543"
},
},
"HTTP"
:
{
Pattern
:
HTTP
,
Good
:
[]
string
{
"/ip4/1.2.3.4/http"
,
"/dns4/example.io/http"
,
"/dns6/::/tcp/7011/http"
,
"/dnsaddr/example.io/http"
,
"/ip6/fc00::/http"
},
},
"HTTPS"
:
{
Pattern
:
HTTPS
,
Good
:
[]
string
{
"/ip4/1.2.3.4/https"
,
"/dns4/example.io/https"
,
"/dns6/::/tcp/7011/https"
,
"/ip6/fc00::/https"
},
},
}
func
TestProtocolMatching
(
t
*
testing
.
T
)
{
...
...
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