Unverified Commit de7d6d81 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #75 from overbool/docs/modify-readme

docs(README): modify readme
parents d6ad8896 c7b4679a
......@@ -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>
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment