Browse Source

identify: remove old code targeting Go 1.17 (#1964)

identify-remove-delta
Marten Seemann 2 years ago
committed by GitHub
parent
commit
1943c649cd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      p2p/protocol/identify/id.go
  2. 22
      p2p/protocol/identify/id_go117.go
  3. 2
      p2p/protocol/identify/user_agent.go

11
p2p/protocol/identify/id.go

@ -42,13 +42,14 @@ const maxPushConcurrency = 32
// StreamReadTimeout is the read timeout on all incoming Identify family streams.
var StreamReadTimeout = 60 * time.Second
var (
legacyIDSize = 2 * 1024 // 2k Bytes
signedIDSize = 8 * 1024 // 8K
maxMessages = 10
defaultUserAgent = "github.com/libp2p/go-libp2p"
const (
legacyIDSize = 2 * 1024 // 2k Bytes
signedIDSize = 8 * 1024 // 8K
maxMessages = 10
)
var defaultUserAgent = "github.com/libp2p/go-libp2p"
type addPeerHandlerReq struct {
rp peer.ID
resp chan *peerHandler

22
p2p/protocol/identify/id_go117.go

@ -1,22 +0,0 @@
//go:build !go1.18
package identify
import (
"fmt"
"runtime/debug"
)
func init() {
bi, ok := debug.ReadBuildInfo()
// ok will only be true if this is built as a dependency of another module
if !ok {
return
}
version := bi.Main.Version
if version == "(devel)" {
defaultUserAgent = bi.Main.Path
} else {
defaultUserAgent = fmt.Sprintf("%s@%s", bi.Main.Path, bi.Main.Version)
}
}

2
p2p/protocol/identify/id_go118.go → p2p/protocol/identify/user_agent.go

@ -1,5 +1,3 @@
//go:build go1.18
package identify
import (
Loading…
Cancel
Save