forked from cometbft/cometbft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
34 lines (28 loc) · 881 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package p2p
import (
"github.com/cosmos/gogoproto/proto"
tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1"
"github.com/cometbft/cometbft/p2p/transport/tcp/conn"
"github.com/cometbft/cometbft/types"
)
type (
ConnectionStatus = conn.ConnectionStatus
)
// Envelope contains a message with sender routing info.
type Envelope struct {
Src Peer // sender (empty if outbound)
Message proto.Message // message payload
ChannelID byte
}
var (
_ types.Wrapper = &tmp2p.PexRequest{}
_ types.Wrapper = &tmp2p.PexAddrs{}
)
// StreamDescriptor describes a data stream. This could be a substream within a
// multiplexed TCP connection, QUIC stream, etc.
type StreamDescriptor interface {
// StreamID returns the ID of the stream.
StreamID() byte
// MessageType returns the type of the message sent/received on this stream.
MessageType() proto.Message
}