Documentation ¶
Index ¶
- Constants
- Variables
- func IsUnknownMsgTypeErr(err error) bool
- func NewUnauthorizedProtocolError(p Protocol) error
- type ChannelAuthConfig
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (m *Message) GetChannelID() string
- func (m *Message) GetPayload() []byte
- func (m *Message) GetTargetIDs() [][]byte
- func (m *Message) Marshal() (dAtA []byte, err error)
- func (m *Message) MarshalTo(dAtA []byte) (int, error)
- func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) Size() (n int)
- func (m *Message) String() string
- func (m *Message) Unmarshal(dAtA []byte) error
- func (m *Message) XXX_DiscardUnknown()
- func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Message) XXX_Merge(src proto.Message)
- func (m *Message) XXX_Size() int
- func (m *Message) XXX_Unmarshal(b []byte) error
- type MsgAuthConfig
- type PingRequest
- func (*PingRequest) Descriptor() ([]byte, []int)
- func (m *PingRequest) Marshal() (dAtA []byte, err error)
- func (m *PingRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *PingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PingRequest) ProtoMessage()
- func (m *PingRequest) Reset()
- func (m *PingRequest) Size() (n int)
- func (m *PingRequest) String() string
- func (m *PingRequest) Unmarshal(dAtA []byte) error
- func (m *PingRequest) XXX_DiscardUnknown()
- func (m *PingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PingRequest) XXX_Merge(src proto.Message)
- func (m *PingRequest) XXX_Size() int
- func (m *PingRequest) XXX_Unmarshal(b []byte) error
- type PingResponse
- func (*PingResponse) Descriptor() ([]byte, []int)
- func (m *PingResponse) GetBlockHeight() uint64
- func (m *PingResponse) GetHotstuffView() uint64
- func (m *PingResponse) GetVersion() string
- func (m *PingResponse) Marshal() (dAtA []byte, err error)
- func (m *PingResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *PingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PingResponse) ProtoMessage()
- func (m *PingResponse) Reset()
- func (m *PingResponse) Size() (n int)
- func (m *PingResponse) String() string
- func (m *PingResponse) Unmarshal(dAtA []byte) error
- func (m *PingResponse) XXX_DiscardUnknown()
- func (m *PingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PingResponse) XXX_Merge(src proto.Message)
- func (m *PingResponse) XXX_Size() int
- func (m *PingResponse) XXX_Unmarshal(b []byte) error
- type Protocol
- type Protocols
- type UnknownMsgTypeErr
Constants ¶
const ( BlockProposal = "BlockProposal" BlockVote = "BlockVote" SyncRequest = "SyncRequest" SyncResponse = "SyncResponse" RangeRequest = "RangeRequest" BatchRequest = "BatchRequest" BlockResponse = "BlockResponse" ClusterBlockProposal = "ClusterBlockProposal" ClusterBlockVote = "ClusterBlockVote" ClusterBlockResponse = "ClusterBlockResponse" CollectionGuarantee = "CollectionGuarantee" TransactionBody = "TransactionBody" ExecutionReceipt = "ExecutionReceipt" ResultApproval = "ResultApproval" ChunkDataRequest = "ChunkDataRequest" ChunkDataResponse = "ChunkDataResponse" ApprovalRequest = "ApprovalRequest" ApprovalResponse = "ApprovalResponse" EntityRequest = "EntityRequest" EntityResponse = "EntityResponse" TestMessage = "TestMessage" DKGMessage = "DKGMessage" )
string constants for all message types sent on the network
const ( ProtocolPublish = Protocol("publish") ProtocolUnicast = Protocol("unicast") )
Variables ¶
var ()
Functions ¶
func IsUnknownMsgTypeErr ¶
IsUnknownMsgTypeErr returns whether an error is UnknownMsgTypeErr
func NewUnauthorizedProtocolError ¶
NewUnauthorizedProtocolError returns ErrUnauthorizedUnicastOnChannel or ErrUnauthorizedPublishOnChannel depending on the protocol provided.
Types ¶
type ChannelAuthConfig ¶
type ChannelAuthConfig struct { // AuthorizedRoles list of roles authorized to send this message on the channel. AuthorizedRoles flow.RoleList // AllowedProtocols list of protocols the message is allowed to be sent on. Currently AllowedProtocols is expected to have // exactly one element in the list. This is due to the fact that currently there are no messages that are used with both protocols aside from TestMessage. AllowedProtocols Protocols }
type Message ¶
type Message struct { ChannelID string `protobuf:"bytes,1,opt,name=ChannelID,proto3" json:"ChannelID,omitempty"` TargetIDs [][]byte `protobuf:"bytes,2,rep,name=TargetIDs,proto3" json:"TargetIDs,omitempty"` Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Message models a single message that is supposed to get exchanged by the gossip network
func (*Message) Descriptor ¶
func (*Message) GetChannelID ¶
func (*Message) GetPayload ¶
func (*Message) GetTargetIDs ¶
func (*Message) MarshalToSizedBuffer ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) XXX_DiscardUnknown ¶
func (m *Message) XXX_DiscardUnknown()
func (*Message) XXX_Marshal ¶
func (*Message) XXX_Unmarshal ¶
type MsgAuthConfig ¶
type MsgAuthConfig struct { // Name is the string representation of the message type. Name string // Type is a func that returns a new instance of message type. Type func() interface{} // Config is the mapping of network channel to list of authorized flow roles. Config map[channels.Channel]ChannelAuthConfig }
MsgAuthConfig contains authorization information for a specific flow message. The authorization is represented as a map from network channel -> list of all roles allowed to send the message on the channel.
func GetAllMessageAuthConfigs ¶
func GetAllMessageAuthConfigs() []MsgAuthConfig
GetAllMessageAuthConfigs returns all the configured message auth configurations.
func GetMessageAuthConfig ¶
func GetMessageAuthConfig(v interface{}) (MsgAuthConfig, error)
GetMessageAuthConfig checks the underlying type and returns the correct message auth Config. Expected error returns during normal operations:
- ErrUnknownMsgType : if underlying type of v does not match any of the known message types
func (MsgAuthConfig) EnsureAuthorized ¶
func (m MsgAuthConfig) EnsureAuthorized(role flow.Role, channel channels.Channel, protocol Protocol) error
EnsureAuthorized checks if the specified role is authorized to send the message on the provided channel and asserts that the message is authorized to be sent on the channel. Expected error returns during normal operations:
- ErrUnauthorizedMessageOnChannel: the channel is not included in the message's list of authorized channels
- ErrUnauthorizedRole: the role is not included in the message's list of authorized roles for the provided channel
- ErrUnauthorizedUnicastOnChannel: the message is not authorized to be sent via unicast protocol.
- ErrUnauthorizedPublishOnChannel: the message is not authorized to be sent via publish protocol.
type PingRequest ¶
type PingRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PingRequest) Descriptor ¶
func (*PingRequest) Descriptor() ([]byte, []int)
func (*PingRequest) Marshal ¶
func (m *PingRequest) Marshal() (dAtA []byte, err error)
func (*PingRequest) MarshalToSizedBuffer ¶
func (m *PingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PingRequest) ProtoMessage ¶
func (*PingRequest) ProtoMessage()
func (*PingRequest) Reset ¶
func (m *PingRequest) Reset()
func (*PingRequest) Size ¶
func (m *PingRequest) Size() (n int)
func (*PingRequest) String ¶
func (m *PingRequest) String() string
func (*PingRequest) Unmarshal ¶
func (m *PingRequest) Unmarshal(dAtA []byte) error
func (*PingRequest) XXX_DiscardUnknown ¶
func (m *PingRequest) XXX_DiscardUnknown()
func (*PingRequest) XXX_Marshal ¶
func (m *PingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PingRequest) XXX_Merge ¶
func (m *PingRequest) XXX_Merge(src proto.Message)
func (*PingRequest) XXX_Size ¶
func (m *PingRequest) XXX_Size() int
func (*PingRequest) XXX_Unmarshal ¶
func (m *PingRequest) XXX_Unmarshal(b []byte) error
type PingResponse ¶
type PingResponse struct { Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` BlockHeight uint64 `protobuf:"varint,2,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"` HotstuffView uint64 `protobuf:"varint,3,opt,name=hotstuffView,proto3" json:"hotstuffView,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PingResponse) Descriptor ¶
func (*PingResponse) Descriptor() ([]byte, []int)
func (*PingResponse) GetBlockHeight ¶
func (m *PingResponse) GetBlockHeight() uint64
func (*PingResponse) GetHotstuffView ¶
func (m *PingResponse) GetHotstuffView() uint64
func (*PingResponse) GetVersion ¶
func (m *PingResponse) GetVersion() string
func (*PingResponse) Marshal ¶
func (m *PingResponse) Marshal() (dAtA []byte, err error)
func (*PingResponse) MarshalToSizedBuffer ¶
func (m *PingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PingResponse) ProtoMessage ¶
func (*PingResponse) ProtoMessage()
func (*PingResponse) Reset ¶
func (m *PingResponse) Reset()
func (*PingResponse) Size ¶
func (m *PingResponse) Size() (n int)
func (*PingResponse) String ¶
func (m *PingResponse) String() string
func (*PingResponse) Unmarshal ¶
func (m *PingResponse) Unmarshal(dAtA []byte) error
func (*PingResponse) XXX_DiscardUnknown ¶
func (m *PingResponse) XXX_DiscardUnknown()
func (*PingResponse) XXX_Marshal ¶
func (m *PingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PingResponse) XXX_Merge ¶
func (m *PingResponse) XXX_Merge(src proto.Message)
func (*PingResponse) XXX_Size ¶
func (m *PingResponse) XXX_Size() int
func (*PingResponse) XXX_Unmarshal ¶
func (m *PingResponse) XXX_Unmarshal(b []byte) error
type UnknownMsgTypeErr ¶
type UnknownMsgTypeErr struct {
MsgType interface{}
}
UnknownMsgTypeErr indicates that no message auth configured for the message type v
func NewUnknownMsgTypeErr ¶
func NewUnknownMsgTypeErr(msgType interface{}) UnknownMsgTypeErr
NewUnknownMsgTypeErr returns a new ErrUnknownMsgType
func (UnknownMsgTypeErr) Error ¶
func (e UnknownMsgTypeErr) Error() string