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

Code changes for go-multiaddr v0.15 #10666

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion client/rpc/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

saddrs := make([]string, len(pi.Addrs))
for i, addr := range pi.Addrs {
saddrs[i] = addr.Encapsulate(pidma).String()
saddrs[i] = addr.EncapsulateC(pidma).String()

Check failure on line 24 in client/rpc/swarm.go

View workflow job for this annotation

GitHub Actions / go-check

addr.EncapsulateC undefined (type multiaddr.Multiaddr has no field or method EncapsulateC)

Check failure on line 24 in client/rpc/swarm.go

View workflow job for this annotation

GitHub Actions / go-lint

addr.EncapsulateC undefined (type multiaddr.Multiaddr has no field or method EncapsulateC) (typecheck)
}

return api.core().Request("swarm/connect", saddrs...).Exec(ctx, nil)
Expand Down
4 changes: 2 additions & 2 deletions cmd/ipfs/kubo/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
config "github.com/ipfs/kubo/config"
cserial "github.com/ipfs/kubo/config/serialize"
"github.com/ipfs/kubo/core"
commands "github.com/ipfs/kubo/core/commands"

Check failure on line 30 in cmd/ipfs/kubo/daemon.go

View workflow job for this annotation

GitHub Actions / go-lint

could not import github.com/ipfs/kubo/core/commands (-: # github.com/ipfs/kubo/core/commands
"github.com/ipfs/kubo/core/coreapi"
corehttp "github.com/ipfs/kubo/core/corehttp"
options "github.com/ipfs/kubo/core/coreiface/options"
Expand Down Expand Up @@ -816,9 +816,9 @@
first, rest := ma.SplitFirst(maddr)

switch {
case first.Equal(manet.IP4Unspecified):
case first.Equal(manet.IP4Unspecified[0]):

Check failure on line 819 in cmd/ipfs/kubo/daemon.go

View workflow job for this annotation

GitHub Actions / go-lint

invalid operation: cannot index manet.IP4Unspecified (variable of type multiaddr.Multiaddr) (typecheck)
return manet.IP4Loopback.Encapsulate(rest)
case first.Equal(manet.IP6Unspecified):
case first.Equal(manet.IP6Unspecified[0]):
return manet.IP6Loopback.Encapsulate(rest)
default:
return maddr // not ip
Expand Down
2 changes: 1 addition & 1 deletion core/commands/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
return nil, err
}
tpt, p2ppart := ma.SplitLast(m)
if p2ppart == nil || p2ppart.Protocol().Code != ma.P_P2P {
if p2ppart.Empty() || p2ppart.Protocol().Code != ma.P_P2P {

Check failure on line 304 in core/commands/bootstrap.go

View workflow job for this annotation

GitHub Actions / go-check

p2ppart.Empty undefined (type *multiaddr.Component has no field or method Empty)

Check failure on line 304 in core/commands/bootstrap.go

View workflow job for this annotation

GitHub Actions / interop-prep

p2ppart.Empty undefined (type *multiaddr.Component has no field or method Empty)

Check failure on line 304 in core/commands/bootstrap.go

View workflow job for this annotation

GitHub Actions / go-build

p2ppart.Empty undefined (type *multiaddr.Component has no field or method Empty)

Check failure on line 304 in core/commands/bootstrap.go

View workflow job for this annotation

GitHub Actions / go-lint

p2ppart.Empty undefined (type *multiaddr.Component has no field or method Empty)

Check failure on line 304 in core/commands/bootstrap.go

View workflow job for this annotation

GitHub Actions / go-test

p2ppart.Empty undefined (type *multiaddr.Component has no field or method Empty)
return nil, fmt.Errorf("invalid bootstrap address: %s", p)
}
if tpt == nil {
Expand Down
2 changes: 1 addition & 1 deletion core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@
// filter out addresses that still doesn't end in `ipfs/Qm...`
found := 0
for _, raddr := range raddrs {
if _, last := ma.SplitLast(raddr); last != nil && last.Protocol().Code == ma.P_IPFS {
if _, last := ma.SplitLast(raddr); !last.Empty() && last.Protocol().Code == ma.P_IPFS {

Check failure on line 810 in core/commands/swarm.go

View workflow job for this annotation

GitHub Actions / go-check

last.Empty undefined (type *multiaddr.Component has no field or method Empty)

Check failure on line 810 in core/commands/swarm.go

View workflow job for this annotation

GitHub Actions / interop-prep

last.Empty undefined (type *multiaddr.Component has no field or method Empty)

Check failure on line 810 in core/commands/swarm.go

View workflow job for this annotation

GitHub Actions / go-build

last.Empty undefined (type *multiaddr.Component has no field or method Empty)

Check failure on line 810 in core/commands/swarm.go

View workflow job for this annotation

GitHub Actions / go-lint

last.Empty undefined (type *multiaddr.Component has no field or method Empty)) (typecheck)

Check failure on line 810 in core/commands/swarm.go

View workflow job for this annotation

GitHub Actions / go-test

last.Empty undefined (type *multiaddr.Component has no field or method Empty)
maddrC <- raddr
found++
}
Expand Down
8 changes: 4 additions & 4 deletions test/cli/harness/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
if err != nil {
panic(err)
}
ma = ma.Encapsulate(comp)
ma = ma.EncapsulateC(comp)

Check failure on line 489 in test/cli/harness/node.go

View workflow job for this annotation

GitHub Actions / go-check

ma.EncapsulateC undefined (type multiaddr.Multiaddr has no field or method EncapsulateC)

Check failure on line 489 in test/cli/harness/node.go

View workflow job for this annotation

GitHub Actions / go-lint

ma.EncapsulateC undefined (type multiaddr.Multiaddr has no field or method EncapsulateC)

Check failure on line 489 in test/cli/harness/node.go

View workflow job for this annotation

GitHub Actions / go-lint

ma.EncapsulateC undefined (type multiaddr.Multiaddr has no field or method EncapsulateC)
}
addrs = append(addrs, ma)
}
Expand All @@ -496,15 +496,15 @@
func (n *Node) SwarmAddrsWithoutPeerIDs() []multiaddr.Multiaddr {
var addrs []multiaddr.Multiaddr
for _, ma := range n.SwarmAddrs() {
var components []multiaddr.Multiaddr
var components []multiaddr.Component
multiaddr.ForEach(ma, func(c multiaddr.Component) bool {
if c.Protocol().Code == multiaddr.P_IPFS {
return true
}
components = append(components, &c)
components = append(components, c)
return true
})
ma = multiaddr.Join(components...)
ma = multiaddr.JoinComponents(components...)

Check failure on line 507 in test/cli/harness/node.go

View workflow job for this annotation

GitHub Actions / go-check

undefined: multiaddr.JoinComponents

Check failure on line 507 in test/cli/harness/node.go

View workflow job for this annotation

GitHub Actions / go-lint

undefined: multiaddr.JoinComponents (typecheck)

Check failure on line 507 in test/cli/harness/node.go

View workflow job for this annotation

GitHub Actions / go-lint

undefined: multiaddr.JoinComponents) (typecheck)
addrs = append(addrs, ma)
}
return addrs
Expand Down
Loading