diff --git a/README.md b/README.md index d3ab3ed..51575aa 100644 --- a/README.md +++ b/README.md @@ -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") +// + +sctpMA, err := ma.NewMultiaddr("/sctp/5678") + +m.Encapsulate(sctpMA) // -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 // ```