Skip to content

Commit

Permalink
identify: don't send default protocol version
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed May 20, 2023
1 parent 5a0411b commit 81a9f65
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
9 changes: 1 addition & 8 deletions p2p/protocol/identify/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ const (
IDPush = "/ipfs/id/push/1.0.0"
)

const DefaultProtocolVersion = "ipfs/0.1.0"

const ServiceName = "libp2p.identify"

const maxPushConcurrency = 32
Expand Down Expand Up @@ -189,16 +187,11 @@ func NewIDService(h host.Host, opts ...Option) (*idService, error) {
userAgent = cfg.userAgent
}

protocolVersion := DefaultProtocolVersion
if cfg.protocolVersion != "" {
protocolVersion = cfg.protocolVersion
}

ctx, cancel := context.WithCancel(context.Background())
s := &idService{
Host: h,
UserAgent: userAgent,
ProtocolVersion: protocolVersion,
ProtocolVersion: cfg.protocolVersion,
ctx: ctx,
ctxCancel: cancel,
conns: make(map[network.Conn]entry),
Expand Down
3 changes: 0 additions & 3 deletions p2p/protocol/identify/id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ func testHasProtocolVersions(t *testing.T, h host.Host, p peer.ID) {
t.Error("no protocol version")
return
}
if v.(string) != identify.DefaultProtocolVersion {
t.Error("protocol mismatch", err)
}
v, err = h.Peerstore().Get(p, "AgentVersion")
if v.(string) != "github.com/libp2p/go-libp2p" { // this is the default user agent
t.Error("agent version mismatch", err)
Expand Down

0 comments on commit 81a9f65

Please sign in to comment.