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
e20e4e73
Commit
e20e4e73
authored
Sep 29, 2016
by
Lars Gierth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update multiformats imports
parent
c202f79e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
README.md
README.md
+1
-1
codec.go
codec.go
+3
-3
doc.go
doc.go
+1
-1
interface.go
interface.go
+1
-1
No files found.
README.md
View file @
e20e4e73
...
@@ -34,7 +34,7 @@ go get multiformats/multiaddr
...
@@ -34,7 +34,7 @@ go get multiformats/multiaddr
#### Simple
#### Simple
```
go
```
go
import
ma
"github.com/
jbenet
/go-multiaddr"
import
ma
"github.com/
multiformats
/go-multiaddr"
// construct from a string (err signals parse failure)
// construct from a string (err signals parse failure)
m1
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/127.0.0.1/udp/1234"
)
m1
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/127.0.0.1/udp/1234"
)
...
...
codec.go
View file @
e20e4e73
...
@@ -4,13 +4,13 @@ import (
...
@@ -4,13 +4,13 @@ import (
"bytes"
"bytes"
"encoding/base32"
"encoding/base32"
"encoding/binary"
"encoding/binary"
"errors"
"fmt"
"fmt"
"net"
"net"
"strconv"
"strconv"
"strings"
"strings"
"errors"
mh
"github.com/
jbenet
/go-multihash"
mh
"github.com/
multiformats
/go-multihash"
)
)
func
stringToBytes
(
s
string
)
([]
byte
,
error
)
{
func
stringToBytes
(
s
string
)
([]
byte
,
error
)
{
...
@@ -298,7 +298,7 @@ func addressBytesToString(p Protocol, b []byte) (string, error) {
...
@@ -298,7 +298,7 @@ func addressBytesToString(p Protocol, b []byte) (string, error) {
case
P_ONION
:
case
P_ONION
:
addr
:=
strings
.
ToLower
(
base32
.
StdEncoding
.
EncodeToString
(
b
[
0
:
10
]))
addr
:=
strings
.
ToLower
(
base32
.
StdEncoding
.
EncodeToString
(
b
[
0
:
10
]))
port
:=
binary
.
BigEndian
.
Uint16
(
b
[
10
:
12
])
port
:=
binary
.
BigEndian
.
Uint16
(
b
[
10
:
12
])
return
addr
+
":"
+
strconv
.
Itoa
(
int
(
port
)),
nil
return
addr
+
":"
+
strconv
.
Itoa
(
int
(
port
)),
nil
case
P_UNIX
:
case
P_UNIX
:
// the address is a varint len prefixed string
// the address is a varint len prefixed string
...
...
doc.go
View file @
e20e4e73
...
@@ -10,7 +10,7 @@ Basic Use:
...
@@ -10,7 +10,7 @@ Basic Use:
import (
import (
"bytes"
"bytes"
"strings"
"strings"
ma "github.com/
jbenet
/go-multiaddr"
ma "github.com/
multiformats
/go-multiaddr"
)
)
// construct from a string (err signals parse failure)
// construct from a string (err signals parse failure)
...
...
interface.go
View file @
e20e4e73
...
@@ -7,7 +7,7 @@ Learn more here: https://github.com/jbenet/multiaddr
...
@@ -7,7 +7,7 @@ Learn more here: https://github.com/jbenet/multiaddr
Multiaddrs have both a binary and string representation.
Multiaddrs have both a binary and string representation.
import ma "github.com/
jbenet
/go-multiaddr"
import ma "github.com/
multiformats
/go-multiaddr"
addr, err := ma.NewMultiaddr("/ip4/1.2.3.4/tcp/80")
addr, err := ma.NewMultiaddr("/ip4/1.2.3.4/tcp/80")
// err non-nil when parsing failed.
// err non-nil when parsing failed.
...
...
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