Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update documentation for /ipfs -> /p2p multiaddr switch #6538

Merged
merged 4 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/commands/bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Print out all blocks currently on the bitswap wantlist for the local peer.`,

pstr, found := req.Options[peerOptionName].(string)
if found {
pid, err := peer.IDB58Decode(pstr)
pid, err := peer.Decode(pstr)
if err != nil {
return err
}
Expand Down Expand Up @@ -195,7 +195,7 @@ prints the ledger associated with a given peer.
return e.TypeErr(bs, nd.Exchange)
}

partner, err := peer.IDB58Decode(req.Arguments[0])
partner, err := peer.Decode(req.Arguments[0])
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions core/commands/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var queryDhtCmd = &cmds.Command{
return ErrNotDHT
}

id, err := peer.IDB58Decode(req.Arguments[0])
id, err := peer.Decode(req.Arguments[0])
if err != nil {
return cmds.ClientError("invalid peer ID")
}
Expand Down Expand Up @@ -370,7 +370,7 @@ var findPeerDhtCmd = &cmds.Command{
return ErrNotOnline
}

pid, err := peer.IDB58Decode(req.Arguments[0])
pid, err := peer.Decode(req.Arguments[0])
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ EXAMPLE:
var id peer.ID
if len(req.Arguments) > 0 {
var err error
id, err = peer.IDB58Decode(req.Arguments[0])
id, err = peer.Decode(req.Arguments[0])
if err != nil {
return fmt.Errorf("invalid peer id")
}
Expand Down
4 changes: 2 additions & 2 deletions core/commands/name/ipnsps.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var ipnspsSubsCmd = &cmds.Command{
log.Errorf("ipns key not a valid peer ID: %s", err)
continue
}
paths = append(paths, "/ipns/"+peer.IDB58Encode(pid))
paths = append(paths, "/ipns/"+peer.Encode(pid))
}

return cmds.EmitOnce(res, &stringList{paths})
Expand All @@ -120,7 +120,7 @@ var ipnspsCancelCmd = &cmds.Command{

name := req.Arguments[0]
name = strings.TrimPrefix(name, "/ipns/")
pid, err := peer.IDB58Decode(name)
pid, err := peer.Decode(name)
if err != nil {
return cmds.Errorf(cmds.ErrClient, err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions core/commands/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Forward connections made to <listen-address> to <target-address>.
connections and/or handlers. It must be prefixed with '` + P2PProtoPrefix + `'.

Example:
ipfs p2p forward ` + P2PProtoPrefix + `myproto /ip4/127.0.0.1/tcp/4567 /ipfs/QmPeer
- Forward connections to 127.0.0.1:4567 to '` + P2PProtoPrefix + `myproto' service on /ipfs/QmPeer
ipfs p2p forward ` + P2PProtoPrefix + `myproto /ip4/127.0.0.1/tcp/4567 /p2p/QmPeer
- Forward connections to 127.0.0.1:4567 to '` + P2PProtoPrefix + `myproto' service on /p2p/QmPeer

`,
},
Expand Down
2 changes: 1 addition & 1 deletion core/commands/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ func ParsePeerParam(text string) (ma.Multiaddr, peer.ID, error) {
return transport, id, nil
}
// Raw peer ID
p, err := peer.IDB58Decode(text)
p, err := peer.Decode(text)
return nil, p, err
}
2 changes: 1 addition & 1 deletion core/commands/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Example:

var pid peer.ID
if pfound {
checkpid, err := peer.IDB58Decode(pstr)
checkpid, err := peer.Decode(pstr)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ var swarmConnectCmd = &cmds.Command{

The address format is an IPFS multiaddr:

ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
ipfs swarm connect /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
`,
},
Arguments: []cmds.Argument{
Expand Down Expand Up @@ -399,7 +399,7 @@ var swarmDisconnectCmd = &cmds.Command{
'ipfs swarm disconnect' closes a connection to a peer address. The address
format is an IPFS multiaddr:

ipfs swarm disconnect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
ipfs swarm disconnect /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ

The disconnect is not permanent; if ipfs needs to talk to that address later,
it will reconnect.
Expand Down
2 changes: 1 addition & 1 deletion core/node/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func Identity(cfg *config.Config) fx.Option {
return fx.Error(errors.New("no peer ID in config! (was 'ipfs init' run?)"))
}

id, err := peer.IDB58Decode(cid)
id, err := peer.Decode(cid)
if err != nil {
return fx.Error(fmt.Errorf("peer ID invalid: %s", err))
}
Expand Down
18 changes: 9 additions & 9 deletions docs/examples/go-ipfs-as-a-library/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,19 @@ func main() {

bootstrapNodes := []string{
// IPFS Bootstrapper nodes.
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",

// IPFS Cluster Pinning nodes
"/ip4/138.201.67.219/tcp/4001/ipfs/QmUd6zHcbkbcs7SMxwLs48qZVX3vpcM8errYS7xEczwRMA",
"/ip4/138.201.67.220/tcp/4001/ipfs/QmNSYxZAiJHeLdkBg38roksAR9So7Y5eojks1yjEcUtZ7i",
"/ip4/138.201.68.74/tcp/4001/ipfs/QmdnXwLrC8p1ueiq2Qya8joNvk3TVVDAut7PrikmZwubtR",
"/ip4/94.130.135.167/tcp/4001/ipfs/QmUEMvxS2e7iDrereVYc5SWPauXPyNwxcy9BXZrC1QTcHE",
"/ip4/138.201.67.219/tcp/4001/p2p/QmUd6zHcbkbcs7SMxwLs48qZVX3vpcM8errYS7xEczwRMA",
"/ip4/138.201.67.220/tcp/4001/p2p/QmNSYxZAiJHeLdkBg38roksAR9So7Y5eojks1yjEcUtZ7i",
"/ip4/138.201.68.74/tcp/4001/p2p/QmdnXwLrC8p1ueiq2Qya8joNvk3TVVDAut7PrikmZwubtR",
"/ip4/94.130.135.167/tcp/4001/p2p/QmUEMvxS2e7iDrereVYc5SWPauXPyNwxcy9BXZrC1QTcHE",

// You can add more nodes here, for example, another IPFS node you might have running locally, mine was:
// "/ip4/127.0.0.1/tcp/4010/ipfs/QmZp2fhDLxjYue2RiUvLwT9MWdnbDxam32qYFnGmxZDh5L",
// "/ip4/127.0.0.1/tcp/4010/p2p/QmZp2fhDLxjYue2RiUvLwT9MWdnbDxam32qYFnGmxZDh5L",
}

go connectToPeers(ctx, ipfs, bootstrapNodes)
Expand Down
12 changes: 6 additions & 6 deletions docs/experimental-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ ipfs bootstrap add <multiaddr>

For example:
```
ipfs bootstrap add /ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64
ipfs bootstrap add /ip4/104.236.76.40/tcp/4001/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64
```

Bootstrap nodes are no different from all other nodes in the network apart from
Expand Down Expand Up @@ -302,7 +302,7 @@ connections on `127.0.0.1:SOME_PORT` to the server node listening
on `/x/kickass/1.0`.

```sh
> ipfs p2p forward /x/kickass/1.0 /ip4/127.0.0.1/tcp/$SOME_PORT /ipfs/$SERVER_ID
> ipfs p2p forward /x/kickass/1.0 /ip4/127.0.0.1/tcp/$SOME_PORT /p2p/$SERVER_ID
```

Next, have your application open a connection to `127.0.0.1:$SOME_PORT`. This
Expand Down Expand Up @@ -343,7 +343,7 @@ ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22
***Then, on "client" node:***

```sh
ipfs p2p forward /x/ssh /ip4/127.0.0.1/tcp/2222 /ipfs/$SERVER_ID
ipfs p2p forward /x/ssh /ip4/127.0.0.1/tcp/2222 /p2p/$SERVER_ID
```

You should now be able to connect to your ssh server through a libp2p connection
Expand Down Expand Up @@ -465,13 +465,13 @@ already online node would have to be restarted.
In order to connect peers QmA and QmB through a relay node QmRelay:

- Both peers should connect to the relay:
`ipfs swarm connect /transport/address/ipfs/QmRelay`
`ipfs swarm connect /transport/address/p2p/QmRelay`
- Peer QmA can then connect to peer QmB using the relay:
`ipfs swarm connect /ipfs/QmRelay/p2p-circuit/ipfs/QmB`
`ipfs swarm connect /p2p/QmRelay/p2p-circuit/p2p/QmB`

Peers can also connect with an unspecific relay address, which will
try to dial through known relays:
`ipfs swarm connect /p2p-circuit/ipfs/QmB`
`ipfs swarm connect /p2p-circuit/p2p/QmB`

Peers can see their (unspecific) relay address in the output of
`ipfs swarm addrs listen`
Expand Down
4 changes: 2 additions & 2 deletions docs/file-transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ addresses (like the example below), then your nodes are online.
"ID": "QmTNwsFkLAed15kQEC1ZJWPfoNbBQnMFojfJKQ9sZj1dk8",
"PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZb6znj3LQZKP1+X81exf+vbnqNCMtHjZ5RKTCm7Fytnfe+AI1fhs9YbZdkgFkM1HLxmIOLQj2bMXPIGxUM+EnewN8tWurx4B3+lR/LWNwNYcCFL+jF2ltc6SE6BC8kMLEZd4zidOLPZ8lIRpd0x3qmsjhGefuRwrKeKlR4tQ3C76ziOms47uLdiVVkl5LyJ5+mn4rXOjNKt/oy2O4m1St7X7/yNt8qQgYsPfe/hCOywxCEIHEkqmil+vn7bu4RpAtsUzCcBDoLUIWuU3i6qfytD05hP8Clo+at+l//ctjMxylf3IQ5qyP+yfvazk+WHcsB0tWueEmiU5P2nfUUIR3AgMBAAE=",
"Addresses": [
"/ip4/127.0.0.1/tcp/4001/ipfs/QmTNwsFkLAed15kQEC1ZJWPfoNbBQnMFojfJKQ9sZj1dk8",
"/ip4/192.168.2.131/tcp/4001/ipfs/QmTNwsFkLAed15kQEC1ZJWPfoNbBQnMFojfJKQ9sZj1dk8",
"/ip4/127.0.0.1/tcp/4001/p2p/QmTNwsFkLAed15kQEC1ZJWPfoNbBQnMFojfJKQ9sZj1dk8",
"/ip4/192.168.2.131/tcp/4001/p2p/QmTNwsFkLAed15kQEC1ZJWPfoNbBQnMFojfJKQ9sZj1dk8",
],
"AgentVersion": "go-ipfs/0.4.11-dev/",
"ProtocolVersion": "ipfs/0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion docs/transports.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## /ws and /wss -- websockets

If you want browsers to connect to e.g. `/dns4/example.com/tcp/443/wss/ipfs/QmFoo`
If you want browsers to connect to e.g. `/dns4/example.com/tcp/443/wss/p2p/QmFoo`

- [ ] An SSL cert matching the `/dns4` or `/dns6` name
- [ ] go-ipfs listening on `/ip4/127.0.0.1/tcp/8081/ws`
Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ require (
github.com/ipfs/go-ds-flatfs v0.3.0
github.com/ipfs/go-ds-leveldb v0.4.0
github.com/ipfs/go-ds-measure v0.1.0
github.com/ipfs/go-filestore v0.0.2
github.com/ipfs/go-fs-lock v0.0.1
github.com/ipfs/go-filestore v0.0.3
github.com/ipfs/go-fs-lock v0.0.3
github.com/ipfs/go-ipfs-blockstore v0.1.1
github.com/ipfs/go-ipfs-chunker v0.0.3
github.com/ipfs/go-ipfs-cmds v0.1.1
github.com/ipfs/go-ipfs-config v0.0.12
github.com/ipfs/go-ipfs-config v0.1.0
github.com/ipfs/go-ipfs-ds-help v0.0.1
github.com/ipfs/go-ipfs-exchange-interface v0.0.1
github.com/ipfs/go-ipfs-exchange-offline v0.0.1
Expand All @@ -43,9 +43,9 @@ require (
github.com/ipfs/go-ipld-cbor v0.0.3
github.com/ipfs/go-ipld-format v0.0.2
github.com/ipfs/go-ipld-git v0.0.2
github.com/ipfs/go-ipns v0.0.1
github.com/ipfs/go-ipns v0.0.2
github.com/ipfs/go-log v0.0.1
github.com/ipfs/go-merkledag v0.3.0
github.com/ipfs/go-merkledag v0.3.1
github.com/ipfs/go-metrics-interface v0.0.1
github.com/ipfs/go-metrics-prometheus v0.0.2
github.com/ipfs/go-mfs v0.1.1
Expand All @@ -61,11 +61,11 @@ require (
github.com/libp2p/go-libp2p-autonat-svc v0.1.0
github.com/libp2p/go-libp2p-circuit v0.1.4
github.com/libp2p/go-libp2p-connmgr v0.1.1
github.com/libp2p/go-libp2p-core v0.2.5
github.com/libp2p/go-libp2p-core v0.3.0
github.com/libp2p/go-libp2p-discovery v0.2.0
github.com/libp2p/go-libp2p-http v0.1.4
github.com/libp2p/go-libp2p-kad-dht v0.3.1
github.com/libp2p/go-libp2p-kbucket v0.2.1
github.com/libp2p/go-libp2p-kad-dht v0.4.1
github.com/libp2p/go-libp2p-kbucket v0.2.2
github.com/libp2p/go-libp2p-loggables v0.1.0
github.com/libp2p/go-libp2p-mplex v0.2.1
github.com/libp2p/go-libp2p-peerstore v0.1.4
Expand All @@ -84,8 +84,8 @@ require (
github.com/libp2p/go-socket-activation v0.0.1
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mr-tron/base58 v1.1.2
github.com/multiformats/go-multiaddr v0.1.2
github.com/mr-tron/base58 v1.1.3
github.com/multiformats/go-multiaddr v0.2.0
github.com/multiformats/go-multiaddr-dns v0.2.0
github.com/multiformats/go-multiaddr-net v0.1.1
github.com/multiformats/go-multibase v0.0.1
Expand Down
Loading