go-libp2p-daemon
go-libp2p-daemon copied to clipboard
go client bug: There are no all transport protocols in the process space
For example with CIRCUIT transport , the convertStreamInfo return error("no protocol with code 290"). Now I fix it by import circuit packge in client process sapce. how about if daemon process return the string of addr and protocol to client?
ping @vyzo
@bigs maintains the client.
hmm can you give me steps to reproduce this or propose a patch? definitely down to fix this, just not fully sure i understand
The protocol needs to be added to the multiaddr's protocol list by calling AddProtocol. for the circuit protocol, it was added during the init phase:
var Protocol = ma.Protocol{
Code: P_CIRCUIT,
Size: 0,
Name: "p2p-circuit",
VCode: ma.CodeToVarint(P_CIRCUIT),
}
func init() {
ma.AddProtocol(Protocol)
}
But in go client, there is no need to import the circuit package, so the circuit protocol would not to be added to the protocol list.
so when client call convertStreamInfo to parse multiaddr, there was no circuit protocol in the list:
func convertStreamInfo(info *pb.StreamInfo) (*StreamInfo, error) {
...
addr, err := ma.NewMultiaddrBytes(info.Addr)
...
}