github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/networking-stream_id.go (about)

     1  /* For license and copyright information please see the LEGAL file in the code repository */
     2  
     3  package protocol
     4  
     5  // A StreamID in many protocols that suggest use this rules:
     6  // - The least significant bit (0x01) of the stream ID identifies the initiator of the stream.
     7  // Client-initiated streams have even-numbered stream IDs (with the bit set to 0),
     8  // and server-initiated streams have odd-numbered stream IDs (with the bit set to 1).
     9  // - The second least significant bit (0x02) of the stream ID distinguishes between
    10  // bidirectional streams (with the bit set to 0) and unidirectional streams (with the bit set to 1).
    11  type StreamID uint64
    12  
    13  // Stream_ID indicate a minimum networking stream functionality.
    14  type Stream_ID interface {
    15  	StreamID() StreamID
    16  	PeerInitiated() bool
    17  	Bidirectional() bool
    18  }