@@ -44,6 +44,8 @@ const (
4444 DefaultTimeout = 5 * time .Second
4545 // ServiceName is the default identify service name
4646 ServiceName = "libp2p.identify"
47+ // Maximum multistream-select this implementation supports
48+ MaxMultiselectVersion = 2
4749
4850 legacyIDSize = 2 * 1024
4951 signedIDSize = 8 * 1024
@@ -151,6 +153,8 @@ type idService struct {
151153 UserAgent string
152154 ProtocolVersion string
153155
156+ MaxMultiselectVersion uint32
157+
154158 metricsTracer MetricsTracer
155159
156160 setupCompleted chan struct {} // is closed when Start has finished setting up
@@ -204,6 +208,7 @@ func NewIDService(h host.Host, opts ...Option) (*idService, error) {
204208 Host : h ,
205209 UserAgent : userAgent ,
206210 ProtocolVersion : cfg .protocolVersion ,
211+ MaxMultiselectVersion : MaxMultiselectVersion ,
207212 ctx : ctx ,
208213 ctxCancel : cancel ,
209214 conns : make (map [network.Conn ]entry ),
@@ -679,6 +684,7 @@ func (ids *idService) createBaseIdentifyResponse(conn network.Conn, snapshot *id
679684 // set protocol versions
680685 mes .ProtocolVersion = & ids .ProtocolVersion
681686 mes .AgentVersion = & ids .UserAgent
687+ mes .MaxMultiselectVersion = & ids .MaxMultiselectVersion
682688
683689 return mes
684690}
@@ -823,9 +829,11 @@ func (ids *idService) consumeMessage(mes *pb.Identify, c network.Conn, isPush bo
823829 // get protocol versions
824830 pv := mes .GetProtocolVersion ()
825831 av := mes .GetAgentVersion ()
832+ mv := mes .GetMaxMultiselectVersion ()
826833
827834 ids .Host .Peerstore ().Put (p , "ProtocolVersion" , pv )
828835 ids .Host .Peerstore ().Put (p , "AgentVersion" , av )
836+ ids .Host .Peerstore ().Put (p , "MaxMultiselectVersion" , mv )
829837
830838 // get the key from the other side. we may not have it (no-auth transport)
831839 ids .consumeReceivedPubKey (c , mes .PublicKey )
0 commit comments