Closed hktalent closed 5 years ago
mkdir /tmp/libp2p-examples
export GOPATH=/tmp/libp2p/examples
make deps
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o http-proxy proxy.go
#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o http-proxy proxy.go
# github.com/libp2p/go-reuseport
/tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_wasm.go:10:53: listen redeclared in this block
previous declaration at /tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_unix.go:211:45
/tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_wasm.go:14:56: listenPacket redeclared in this block
previous declaration at /tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_unix.go:291:61
/tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_wasm.go:18:53: listenStream redeclared in this block
previous declaration at /tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_unix.go:260:59
/tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_wasm.go:22:87: dial redeclared in this block
previous declaration at /tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_unix.go:62:87
/tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/impl_wasm.go:26:18: available redeclared in this block
previous declaration at /tmp/libp2p/examples/src/github.com/libp2p/go-reuseport/available_unix.go:23:18
#go get -t -v ./...
github.com/libp2p/go-libp2p-examples/chat
github.com/libp2p/go-libp2p-examples/echo
github.com/libp2p/go-libp2p-examples/http-proxy
github.com/libp2p/go-libp2p-examples/chat-with-rendezvous
# github.com/libp2p/go-libp2p-examples/chat
chat/chat.go:134:21: cannot use sourceMultiAddr (type "github.com/multiformats/go-multiaddr".Multiaddr) as type "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr in argument to libp2p.ListenAddrs:
"github.com/multiformats/go-multiaddr".Multiaddr does not implement "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr (wrong type for Decapsulate method)
have Decapsulate("github.com/multiformats/go-multiaddr".Multiaddr) "github.com/multiformats/go-multiaddr".Multiaddr
want Decapsulate("gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr) "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
chat/chat.go:135:18: cannot use prvKey (type "github.com/libp2p/go-libp2p-crypto".PrivKey) as type "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey in argument to libp2p.Identity:
"github.com/libp2p/go-libp2p-crypto".PrivKey does not implement "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey (wrong type for Equals method)
have Equals("github.com/libp2p/go-libp2p-crypto".Key) bool
want Equals("gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".Key) bool
chat/chat.go:146:25: cannot use handleStream (type func("github.com/libp2p/go-libp2p-net".Stream)) as type "gx/ipfs/QmNgLg1NTw37iWbYPKcyK85YJ9Whs1MkPtJwhfqbNYAyKg/go-libp2p-net".StreamHandler in argument to host.SetStreamHandler
chat/chat.go:188:33: cannot use info.ID (type "github.com/libp2p/go-libp2p-peer".ID) as type "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer".ID in argument to host.Peerstore().AddAddrs
chat/chat.go:188:42: cannot use info.Addrs (type []"github.com/multiformats/go-multiaddr".Multiaddr) as type []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr in argument to host.Peerstore().AddAddrs
chat/chat.go:192:54: cannot use info.ID (type "github.com/libp2p/go-libp2p-peer".ID) as type "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer".ID in argument to host.NewStream
# github.com/libp2p/go-libp2p-examples/echo
echo/main.go:48:18: cannot use priv (type "github.com/libp2p/go-libp2p-crypto".PrivKey) as type "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey in argument to libp2p.Identity:
"github.com/libp2p/go-libp2p-crypto".PrivKey does not implement "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey (wrong type for Equals method)
have Equals("github.com/libp2p/go-libp2p-crypto".Key) bool
want Equals("gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".Key) bool
echo/main.go:67:30: cannot use hostAddr (type "github.com/multiformats/go-multiaddr".Multiaddr) as type "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr in argument to addr.Encapsulate:
"github.com/multiformats/go-multiaddr".Multiaddr does not implement "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr (wrong type for Decapsulate method)
have Decapsulate("github.com/multiformats/go-multiaddr".Multiaddr) "github.com/multiformats/go-multiaddr".Multiaddr
want Decapsulate("gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr) "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
echo/main.go:75:2: cannot use basicHost (type "gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host) as type "github.com/libp2p/go-libp2p-host".Host in return argument:
"gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for Addrs method)
have Addrs() []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
want Addrs() []"github.com/multiformats/go-multiaddr".Multiaddr
github.com/libp2p/go-libp2p-examples/libp2p-host
github.com/libp2p/go-libp2p-examples/multipro
# github.com/libp2p/go-libp2p-examples/chat-with-rendezvous
chat-with-rendezvous/chat.go:102:43: cannot use ([]"github.com/multiformats/go-multiaddr".Multiaddr)(config.ListenAddresses) (type []"github.com/multiformats/go-multiaddr".Multiaddr) as type []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr in argument to libp2p.ListenAddrs
chat-with-rendezvous/chat.go:112:35: cannot use "github.com/libp2p/go-libp2p-protocol".ID(config.ProtocolID) (type "github.com/libp2p/go-libp2p-protocol".ID) as type "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol".ID in argument to host.SetStreamHandler
chat-with-rendezvous/chat.go:112:35: cannot use handleStream (type func("github.com/libp2p/go-libp2p-net".Stream)) as type "gx/ipfs/QmNgLg1NTw37iWbYPKcyK85YJ9Whs1MkPtJwhfqbNYAyKg/go-libp2p-net".StreamHandler in argument to host.SetStreamHandler
chat-with-rendezvous/chat.go:118:35: cannot use host (type "gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host) as type "github.com/libp2p/go-libp2p-host".Host in argument to dht.New:
"gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for Addrs method)
have Addrs() []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
want Addrs() []"github.com/multiformats/go-multiaddr".Multiaddr
chat-with-rendezvous/chat.go:138:32: cannot use *peerinfo (type "github.com/libp2p/go-libp2p-peerstore".PeerInfo) as type "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore".PeerInfo in argument to host.Connect
chat-with-rendezvous/chat.go:163:14: invalid operation: peer.ID == host.ID() (mismatched types "github.com/libp2p/go-libp2p-peer".ID and "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer".ID)
chat-with-rendezvous/chat.go:169:42: cannot use peer.ID (type "github.com/libp2p/go-libp2p-peer".ID) as type "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer".ID in argument to host.NewStream
chat-with-rendezvous/chat.go:169:58: cannot use "github.com/libp2p/go-libp2p-protocol".ID(config.ProtocolID) (type "github.com/libp2p/go-libp2p-protocol".ID) as type "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol".ID in argument to host.NewStream
github.com/libp2p/go-libp2p-examples/protocol-multiplexing-with-multicodecs
# github.com/libp2p/go-libp2p-examples/libp2p-host
libp2p-host/host.go:36:18: cannot use priv (type "github.com/libp2p/go-libp2p-crypto".PrivKey) as type "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey in argument to libp2p.Identity:
"github.com/libp2p/go-libp2p-crypto".PrivKey does not implement "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey (wrong type for Equals method)
have Equals("github.com/libp2p/go-libp2p-crypto".Key) bool
want Equals("gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".Key) bool
# github.com/libp2p/go-libp2p-examples/http-proxy
http-proxy/proxy.go:37:2: cannot use host (type "gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host) as type "github.com/libp2p/go-libp2p-host".Host in return argument:
"gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for Addrs method)
have Addrs() []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
want Addrs() []"github.com/multiformats/go-multiaddr".Multiaddr
# github.com/libp2p/go-libp2p-examples/multipro
multipro/main.go:23:21: cannot use listen (type "github.com/multiformats/go-multiaddr".Multiaddr) as type "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr in argument to libp2p.ListenAddrs:
"github.com/multiformats/go-multiaddr".Multiaddr does not implement "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr (wrong type for Decapsulate method)
have Decapsulate("github.com/multiformats/go-multiaddr".Multiaddr) "github.com/multiformats/go-multiaddr".Multiaddr
want Decapsulate("gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr) "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
multipro/main.go:24:18: cannot use priv (type "github.com/libp2p/go-libp2p-crypto".PrivKey) as type "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey in argument to libp2p.Identity:
"github.com/libp2p/go-libp2p-crypto".PrivKey does not implement "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".PrivKey (wrong type for Equals method)
have Equals("github.com/libp2p/go-libp2p-crypto".Key) bool
want Equals("gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto".Key) bool
multipro/main.go:27:16: cannot use host (type "gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host) as type "github.com/libp2p/go-libp2p-host".Host in argument to NewNode:
"gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for Addrs method)
have Addrs() []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
want Addrs() []"github.com/multiformats/go-multiaddr".Multiaddr
github.com/libp2p/go-libp2p-examples/relay
# github.com/libp2p/go-libp2p-examples/protocol-multiplexing-with-multicodecs
protocol-multiplexing-with-multicodecs/main.go:83:2: cannot use h (type "gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host) as type "github.com/libp2p/go-libp2p-host".Host in return argument:
"gx/ipfs/QmaoXrM4Z41PD48JY36YqQGKQpLGjyLA2cKcLsES7YddAq/go-libp2p-host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for Addrs method)
have Addrs() []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr
want Addrs() []"github.com/multiformats/go-multiaddr".Multiaddr
# github.com/libp2p/go-libp2p-examples/relay
relay/main.go:24:64: cannot use "github.com/libp2p/go-libp2p-circuit".OptHop (type "github.com/libp2p/go-libp2p-circuit".RelayOpt) as type "gx/ipfs/QmWuMW6UKZMJo9bFFDwnjg8tW3AtKisMHHrXEutQdmJ19N/go-libp2p-circuit".RelayOpt in argument to libp2p.EnableRelay
relay/main.go:35:5: cannot use h2.ID() (type "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer".ID) as type "github.com/libp2p/go-libp2p-peer".ID in field value
relay/main.go:36:8: cannot use h2.Addrs() (type []"gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr".Multiaddr) as type []"github.com/multiformats/go-multiaddr".Multiaddr in field value
relay/main.go:40:41: cannot use h2info (type "github.com/libp2p/go-libp2p-peerstore".PeerInfo) as type "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore".PeerInfo in argument to h1.Connect
relay/main.go:43:41: cannot use h2info (type "github.com/libp2p/go-libp2p-peerstore".PeerInfo) as type "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore".PeerInfo in argument to h3.Connect
relay/main.go:48:31: cannot use func literal (type func("github.com/libp2p/go-libp2p-net".Stream)) as type "gx/ipfs/QmNgLg1NTw37iWbYPKcyK85YJ9Whs1MkPtJwhfqbNYAyKg/go-libp2p-net".StreamHandler in argument to h3.SetStreamHandler
relay/main.go:71:14: impossible type assertion:
*swarm.Swarm does not implement "gx/ipfs/QmNgLg1NTw37iWbYPKcyK85YJ9Whs1MkPtJwhfqbNYAyKg/go-libp2p-net".Network (wrong type for ClosePeer method)
have ClosePeer("github.com/libp2p/go-libp2p-peer".ID) error
want ClosePeer("gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer".ID) error
relay/main.go:74:5: cannot use h3.ID() (type "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer".ID) as type "github.com/libp2p/go-libp2p-peer".ID in field value
relay/main.go:77:41: cannot use h3relayInfo (type "github.com/libp2p/go-libp2p-peerstore".PeerInfo) as type "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore".PeerInfo in argument to h1.Connect
See #40, it may help.
@anacrolix
#go build -o xxx proxy.go
# github.com/libp2p/go-reuseport
/root/go/src/github.com/libp2p/go-reuseport/impl_wasm.go:10:53: listen redeclared in this block
previous declaration at /root/go/src/github.com/libp2p/go-reuseport/impl_unix.go:211:45
/root/go/src/github.com/libp2p/go-reuseport/impl_wasm.go:14:56: listenPacket redeclared in this block
previous declaration at /root/go/src/github.com/libp2p/go-reuseport/impl_unix.go:291:61
/root/go/src/github.com/libp2p/go-reuseport/impl_wasm.go:18:53: listenStream redeclared in this block
previous declaration at /root/go/src/github.com/libp2p/go-reuseport/impl_unix.go:260:59
/root/go/src/github.com/libp2p/go-reuseport/impl_wasm.go:22:87: dial redeclared in this block
previous declaration at /root/go/src/github.com/libp2p/go-reuseport/impl_unix.go:62:87
/root/go/src/github.com/libp2p/go-reuseport/impl_wasm.go:26:18: available redeclared in this block
previous declaration at /root/go/src/github.com/libp2p/go-reuseport/available_unix.go:23:18
You still require go 1.11.
@anacrolix
#apt update;apt upgrade -yy
#go version
go version go1.11.4 linux/amd64
ok