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
de7d6d81
Unverified
Commit
de7d6d81
authored
Sep 14, 2018
by
Steven Allen
Committed by
GitHub
Sep 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75 from overbool/docs/modify-readme
docs(README): modify readme
parents
d6ad8896
c7b4679a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
README.md
README.md
+12
-2
No files found.
README.md
View file @
de7d6d81
...
...
@@ -73,9 +73,19 @@ m1.Protocols()
#### En/decapsulate
```
go
m
.
Encapsulate
(
ma
.
NewMultiaddr
(
"/sctp/5678"
))
import
ma
"github.com/multiformats/go-multiaddr"
m
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/127.0.0.1/udp/1234"
)
// <Multiaddr /ip4/127.0.0.1/udp/1234>
sctpMA
,
err
:=
ma
.
NewMultiaddr
(
"/sctp/5678"
)
m
.
Encapsulate
(
sctpMA
)
// <Multiaddr /ip4/127.0.0.1/udp/1234/sctp/5678>
m
.
Decapsulate
(
ma
.
NewMultiaddr
(
"/udp"
))
// up to + inc last occurrence of subaddr
udpMA
,
err
:=
ma
.
NewMultiaddr
(
"/udp/1234"
)
m
.
Decapsulate
(
udpMA
)
// up to + inc last occurrence of subaddr
// <Multiaddr /ip4/127.0.0.1>
```
...
...
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