mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00

* Add failing proto test * Add a new proto compilation script A proto file's *import path* is relative to one of the `--proto-path`s. Previously, the proto files were compiled separately. Some invocations used different values for the `--proto_path`, which led to inconsistent import paths in proto file descriptors. Typically, this wouldn't be a problem. However, if a downstream project uses `protoregistry.GlobalFiles` to inspect proto dependencies, it will fail to find a dependency's file descriptor when the dependency was compiled with a different `--proto_path`. By using a single script to generate all protobuf files, we can ensure the `--proto_path` is always set to the same sane value (the root of the project, as suggested in the [official documentation]). [official documentation]: https://protobuf.dev/programming-guides/proto2/#importing * Add go_package options so scripts/gen-proto.sh succeeds * Remove undesirable `go:generate protoc` directives * Run `go generate ./...` * Script uses arrays, I think we need bash --------- Co-authored-by: Marco Munizaga <git@marcopolo.io>
39 lines
1.6 KiB
Protocol Buffer
39 lines
1.6 KiB
Protocol Buffer
syntax = "proto2";
|
|
|
|
package identify.pb;
|
|
|
|
option go_package = "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb";
|
|
|
|
message Identify {
|
|
|
|
// protocolVersion determines compatibility between peers
|
|
optional string protocolVersion = 5; // e.g. ipfs/1.0.0
|
|
|
|
// agentVersion is like a UserAgent string in browsers, or client version in bittorrent
|
|
// includes the client name and client.
|
|
optional string agentVersion = 6; // e.g. go-ipfs/0.1.0
|
|
|
|
// publicKey is this node's public key (which also gives its node.ID)
|
|
// - may not need to be sent, as secure channel implies it has been sent.
|
|
// - then again, if we change / disable secure channel, may still want it.
|
|
optional bytes publicKey = 1;
|
|
|
|
// listenAddrs are the multiaddrs the sender node listens for open connections on
|
|
repeated bytes listenAddrs = 2;
|
|
|
|
// oservedAddr is the multiaddr of the remote endpoint that the sender node perceives
|
|
// this is useful information to convey to the other side, as it helps the remote endpoint
|
|
// determine whether its connection to the local peer goes through NAT.
|
|
optional bytes observedAddr = 4;
|
|
|
|
// protocols are the services this node is running
|
|
repeated string protocols = 3;
|
|
|
|
// signedPeerRecord contains a serialized SignedEnvelope containing a PeerRecord,
|
|
// signed by the sending node. It contains the same addresses as the listenAddrs field, but
|
|
// in a form that lets us share authenticated addrs with other peers.
|
|
// see github.com/libp2p/go-libp2p/core/record/pb/envelope.proto and
|
|
// github.com/libp2p/go-libp2p/core/peer/pb/peer_record.proto for message definitions.
|
|
optional bytes signedPeerRecord = 8;
|
|
}
|