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
Commits
115f321e
Commit
115f321e
authored
Oct 18, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test to make sure we only consider addresses that *start* with IP addresses
(would have failed with ValueForProtocol)
parent
0425819f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
private_test.go
private_test.go
+13
-0
No files found.
private_test.go
View file @
115f321e
...
...
@@ -32,4 +32,17 @@ func TestIsPublicAddr(t *testing.T) {
if
IsPrivateAddr
(
a
)
{
t
.
Fatal
(
"1.1.1.1 is not a private address!"
)
}
a
,
err
=
ma
.
NewMultiaddr
(
"/tcp/80/ip4/1.1.1.1"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
IsPublicAddr
(
a
)
{
t
.
Fatal
(
"shouldn't consider an address that starts with /tcp/ as *public*"
)
}
if
IsPrivateAddr
(
a
)
{
t
.
Fatal
(
"shouldn't consider an address that starts with /tcp/ as *private*"
)
}
}
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