v2

package
v6.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package v2 is a generated GoMock package.

Index

Constants

View Source
const (
	Protocol_Stream_FullMethodName = "/v2.Protocol/Stream"
)

Variables

View Source
var File_transport_v2_protocol_proto protoreflect.FileDescriptor
View Source
var Protocol_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v2.Protocol",
	HandlerType: (*ProtocolServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Stream",
			Handler:       _Protocol_Stream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "transport/v2/protocol.proto",
}

Protocol_ServiceDesc is the grpc.ServiceDesc for Protocol service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func New

func New(
	config Config,
	nodeDID did.DID,
	state dag.State,
	didResolver resolver.DIDResolver,
	keyStore crypto.KeyStore,
	diagnosticsProvider func() transport.Diagnostics,
	dagStore stoabs.KVStore,
) transport.Protocol

New creates an instance of the v2 protocol.

func RegisterProtocolServer

func RegisterProtocolServer(s grpc.ServiceRegistrar, srv ProtocolServer)

Types

type Config

type Config struct {
	// Datadir from core.Config
	Datadir string
	// PayloadRetryDelay initial delay before retrying payload retrieval. Will grow exponentially
	PayloadRetryDelay time.Duration
	// GossipInterval specifies how often (in milliseconds) the node should broadcast its gossip message,
	// so other nodes can compare and synchronize.
	GossipInterval int `koanf:"gossipinterval"`
	// DiagnosticsInterval specifies how often (in milliseconds) the node should broadcast its diagnostics message.
	DiagnosticsInterval int `koanf:"diagnosticsinterval"`
}

Config specifies config for protocol v2

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default config for protocol v2

type Diagnostics

type Diagnostics struct {

	// uptime contains the uptime (time since the node started) in seconds.
	Uptime uint32 `protobuf:"varint,1,opt,name=uptime,proto3" json:"uptime,omitempty"`
	// peerID contains the ID of the node.
	PeerID string `protobuf:"bytes,2,opt,name=peerID,proto3" json:"peerID,omitempty"`
	// peers contains the peer IDs of the node's peers.
	Peers []string `protobuf:"bytes,3,rep,name=peers,proto3" json:"peers,omitempty"`
	// numberOfTransactions contains the total number of transactions on the node's DAG.
	NumberOfTransactions uint32 `protobuf:"varint,4,opt,name=numberOfTransactions,proto3" json:"numberOfTransactions,omitempty"`
	// softwareVersion contains an indication of the software version of the node. It's recommended to use a (Git) commit ID that uniquely resolves to a code revision, alternatively a semantic version could be used (e.g. 1.2.5).
	SoftwareVersion string `protobuf:"bytes,10,opt,name=softwareVersion,proto3" json:"softwareVersion,omitempty"`
	// softwareID contains an identification of the particular Nuts implementation of the node.
	// For open source implementations it's recommended to specify URL to the public, open source repository.
	// Proprietary implementations could specify the product or vendor's name.
	SoftwareID string `protobuf:"bytes,11,opt,name=softwareID,proto3" json:"softwareID,omitempty"`
	// contains filtered or unexported fields
}

Diagnostics is a message to inform peers of the local node's state. All fields are optional.

func (*Diagnostics) Descriptor deprecated

func (*Diagnostics) Descriptor() ([]byte, []int)

Deprecated: Use Diagnostics.ProtoReflect.Descriptor instead.

func (*Diagnostics) GetNumberOfTransactions

func (x *Diagnostics) GetNumberOfTransactions() uint32

func (*Diagnostics) GetPeerID

func (x *Diagnostics) GetPeerID() string

func (*Diagnostics) GetPeers

func (x *Diagnostics) GetPeers() []string

func (*Diagnostics) GetSoftwareID

func (x *Diagnostics) GetSoftwareID() string

func (*Diagnostics) GetSoftwareVersion

func (x *Diagnostics) GetSoftwareVersion() string

func (*Diagnostics) GetUptime

func (x *Diagnostics) GetUptime() uint32

func (*Diagnostics) ProtoMessage

func (*Diagnostics) ProtoMessage()

func (*Diagnostics) ProtoReflect

func (x *Diagnostics) ProtoReflect() protoreflect.Message

func (*Diagnostics) Reset

func (x *Diagnostics) Reset()

func (*Diagnostics) String

func (x *Diagnostics) String() string

type Envelope

type Envelope struct {

	// Types that are valid to be assigned to Message:
	//
	//	*Envelope_Gossip
	//	*Envelope_DiagnosticsBroadcast
	//	*Envelope_State
	//	*Envelope_TransactionListQuery
	//	*Envelope_TransactionRangeQuery
	//	*Envelope_TransactionPayloadQuery
	//	*Envelope_TransactionSet
	//	*Envelope_TransactionList
	//	*Envelope_TransactionPayload
	Message isEnvelope_Message `protobuf_oneof:"Message"`
	// contains filtered or unexported fields
}

func (*Envelope) Descriptor deprecated

func (*Envelope) Descriptor() ([]byte, []int)

Deprecated: Use Envelope.ProtoReflect.Descriptor instead.

func (*Envelope) GetDiagnosticsBroadcast

func (x *Envelope) GetDiagnosticsBroadcast() *Diagnostics

func (*Envelope) GetGossip

func (x *Envelope) GetGossip() *Gossip

func (*Envelope) GetMessage

func (x *Envelope) GetMessage() isEnvelope_Message

func (*Envelope) GetState

func (x *Envelope) GetState() *State

func (*Envelope) GetTransactionList

func (x *Envelope) GetTransactionList() *TransactionList

func (*Envelope) GetTransactionListQuery

func (x *Envelope) GetTransactionListQuery() *TransactionListQuery

func (*Envelope) GetTransactionPayload

func (x *Envelope) GetTransactionPayload() *TransactionPayload

func (*Envelope) GetTransactionPayloadQuery

func (x *Envelope) GetTransactionPayloadQuery() *TransactionPayloadQuery

func (*Envelope) GetTransactionRangeQuery

func (x *Envelope) GetTransactionRangeQuery() *TransactionRangeQuery

func (*Envelope) GetTransactionSet

func (x *Envelope) GetTransactionSet() *TransactionSet

func (*Envelope) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) ProtoReflect

func (x *Envelope) ProtoReflect() protoreflect.Message

func (*Envelope) Reset

func (x *Envelope) Reset()

func (*Envelope) String

func (x *Envelope) String() string

type Envelope_DiagnosticsBroadcast

type Envelope_DiagnosticsBroadcast struct {
	DiagnosticsBroadcast *Diagnostics `protobuf:"bytes,102,opt,name=diagnosticsBroadcast,proto3,oneof"`
}

type Envelope_Gossip

type Envelope_Gossip struct {
	// broadcast
	Gossip *Gossip `protobuf:"bytes,101,opt,name=gossip,proto3,oneof"`
}

type Envelope_State

type Envelope_State struct {
	// request, starts a conversation with a new ID
	State *State `protobuf:"bytes,201,opt,name=state,proto3,oneof"`
}

type Envelope_TransactionList

type Envelope_TransactionList struct {
	TransactionList *TransactionList `protobuf:"bytes,302,opt,name=transactionList,proto3,oneof"`
}

type Envelope_TransactionListQuery

type Envelope_TransactionListQuery struct {
	TransactionListQuery *TransactionListQuery `protobuf:"bytes,202,opt,name=transactionListQuery,proto3,oneof"`
}

type Envelope_TransactionPayload

type Envelope_TransactionPayload struct {
	TransactionPayload *TransactionPayload `protobuf:"bytes,304,opt,name=transactionPayload,proto3,oneof"`
}

type Envelope_TransactionPayloadQuery

type Envelope_TransactionPayloadQuery struct {
	TransactionPayloadQuery *TransactionPayloadQuery `protobuf:"bytes,204,opt,name=transactionPayloadQuery,proto3,oneof"`
}

type Envelope_TransactionRangeQuery

type Envelope_TransactionRangeQuery struct {
	TransactionRangeQuery *TransactionRangeQuery `protobuf:"bytes,203,opt,name=transactionRangeQuery,proto3,oneof"`
}

type Envelope_TransactionSet

type Envelope_TransactionSet struct {
	// response, contains conversationID from request
	TransactionSet *TransactionSet `protobuf:"bytes,301,opt,name=transactionSet,proto3,oneof"`
}

type Gossip

type Gossip struct {

	// XOR contains the XOR'ed value of all transaction references on the sender's DAG.
	XOR []byte `protobuf:"bytes,1,opt,name=XOR,proto3" json:"XOR,omitempty"`
	// LC contains the highest transaction Lamport Clock value of the sender.
	LC uint32 `protobuf:"varint,2,opt,name=LC,proto3" json:"LC,omitempty"`
	// transactions is a list of transactions recently added to the DAG
	Transactions [][]byte `protobuf:"bytes,3,rep,name=transactions,proto3" json:"transactions,omitempty"`
	// contains filtered or unexported fields
}

Gossip is a message broadcast to inform peers of the node's DAG state and recent additions to it (if any). The message has no response, but the peer may decide to follow up with State or TransactionListQuery.

func (*Gossip) Descriptor deprecated

func (*Gossip) Descriptor() ([]byte, []int)

Deprecated: Use Gossip.ProtoReflect.Descriptor instead.

func (*Gossip) GetLC

func (x *Gossip) GetLC() uint32

func (*Gossip) GetTransactions

func (x *Gossip) GetTransactions() [][]byte

func (*Gossip) GetXOR

func (x *Gossip) GetXOR() []byte

func (*Gossip) ProtoMessage

func (*Gossip) ProtoMessage()

func (*Gossip) ProtoReflect

func (x *Gossip) ProtoReflect() protoreflect.Message

func (*Gossip) Reset

func (x *Gossip) Reset()

func (*Gossip) String

func (x *Gossip) String() string

type MockmessageSender

type MockmessageSender struct {
	// contains filtered or unexported fields
}

MockmessageSender is a mock of messageSender interface.

func NewMockmessageSender

func NewMockmessageSender(ctrl *gomock.Controller) *MockmessageSender

NewMockmessageSender creates a new mock instance.

func (*MockmessageSender) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockmessageSenderMockRecorder

type MockmessageSenderMockRecorder struct {
	// contains filtered or unexported fields
}

MockmessageSenderMockRecorder is the mock recorder for MockmessageSender.

type ProtocolClient

type ProtocolClient interface {
	Stream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Envelope, Envelope], error)
}

ProtocolClient is the client API for Protocol service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewProtocolClient

func NewProtocolClient(cc grpc.ClientConnInterface) ProtocolClient

type ProtocolServer

type ProtocolServer interface {
	Stream(grpc.BidiStreamingServer[Envelope, Envelope]) error
}

ProtocolServer is the server API for Protocol service. All implementations should embed UnimplementedProtocolServer for forward compatibility.

type Protocol_StreamClient

type Protocol_StreamClient = grpc.BidiStreamingClient[Envelope, Envelope]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Protocol_StreamServer

type Protocol_StreamServer = grpc.BidiStreamingServer[Envelope, Envelope]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type State

type State struct {

	// conversationID contains the token used to identify the response
	ConversationID []byte `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
	// XOR contains the XOR'ed value of ALL transaction references on the sender's DAG.
	XOR []byte `protobuf:"bytes,2,opt,name=XOR,proto3" json:"XOR,omitempty"`
	// LC contains the Lamport Clock value (inclusive) for which the node requests an IBLT
	LC uint32 `protobuf:"varint,3,opt,name=LC,proto3" json:"LC,omitempty"`
	// contains filtered or unexported fields
}

State is a request for the peer's DAG state up to the given LC value

func (*State) Descriptor deprecated

func (*State) Descriptor() ([]byte, []int)

Deprecated: Use State.ProtoReflect.Descriptor instead.

func (*State) GetConversationID

func (x *State) GetConversationID() []byte

func (*State) GetLC

func (x *State) GetLC() uint32

func (*State) GetXOR

func (x *State) GetXOR() []byte

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) ProtoReflect

func (x *State) ProtoReflect() protoreflect.Message

func (*State) Reset

func (x *State) Reset()

func (*State) String

func (x *State) String() string

type Transaction

type Transaction struct {

	// data contains the data of the transaction, which is a JWS as specified by RFC004.
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// payload contains the payload when it may be attached but wasn't so in the transaction already
	Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3,oneof" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

Transaction represents a transaction on the DAG.

func (*Transaction) Descriptor deprecated

func (*Transaction) Descriptor() ([]byte, []int)

Deprecated: Use Transaction.ProtoReflect.Descriptor instead.

func (*Transaction) GetData

func (x *Transaction) GetData() []byte

func (*Transaction) GetPayload

func (x *Transaction) GetPayload() []byte

func (*Transaction) ProtoMessage

func (*Transaction) ProtoMessage()

func (*Transaction) ProtoReflect

func (x *Transaction) ProtoReflect() protoreflect.Message

func (*Transaction) Reset

func (x *Transaction) Reset()

func (*Transaction) String

func (x *Transaction) String() string

type TransactionList

type TransactionList struct {

	// conversationID contains the token used to identify the response
	ConversationID []byte `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
	// transactions contains the list of requested transactions. Transactions MUST be sorted by LC value
	Transactions []*Transaction `protobuf:"bytes,2,rep,name=transactions,proto3" json:"transactions,omitempty"`
	// totalMessages is the number of messages that are in the TransactionList sequence with this conversationID
	TotalMessages uint32 `protobuf:"varint,3,opt,name=totalMessages,proto3" json:"totalMessages,omitempty"`
	// messageNumber identifies which message this is in the sequence. Uses 1-based indexing
	MessageNumber uint32 `protobuf:"varint,4,opt,name=messageNumber,proto3" json:"messageNumber,omitempty"`
	// contains filtered or unexported fields
}

TransactionList contains a list of transactions requested in TransactionListQuery or TransactionRangeQuery

func (*TransactionList) Descriptor deprecated

func (*TransactionList) Descriptor() ([]byte, []int)

Deprecated: Use TransactionList.ProtoReflect.Descriptor instead.

func (*TransactionList) GetConversationID

func (x *TransactionList) GetConversationID() []byte

func (*TransactionList) GetMessageNumber

func (x *TransactionList) GetMessageNumber() uint32

func (*TransactionList) GetTotalMessages

func (x *TransactionList) GetTotalMessages() uint32

func (*TransactionList) GetTransactions

func (x *TransactionList) GetTransactions() []*Transaction

func (*TransactionList) ProtoMessage

func (*TransactionList) ProtoMessage()

func (*TransactionList) ProtoReflect

func (x *TransactionList) ProtoReflect() protoreflect.Message

func (*TransactionList) Reset

func (x *TransactionList) Reset()

func (*TransactionList) String

func (x *TransactionList) String() string

type TransactionListQuery

type TransactionListQuery struct {

	// conversationID contains the token used to identify the response
	ConversationID []byte `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
	// refs is the list of requested transactions by reference
	Refs [][]byte `protobuf:"bytes,2,rep,name=refs,proto3" json:"refs,omitempty"`
	// contains filtered or unexported fields
}

TransactionListQuery is a request for transactions by references

func (*TransactionListQuery) Descriptor deprecated

func (*TransactionListQuery) Descriptor() ([]byte, []int)

Deprecated: Use TransactionListQuery.ProtoReflect.Descriptor instead.

func (*TransactionListQuery) GetConversationID

func (x *TransactionListQuery) GetConversationID() []byte

func (*TransactionListQuery) GetRefs

func (x *TransactionListQuery) GetRefs() [][]byte

func (*TransactionListQuery) ProtoMessage

func (*TransactionListQuery) ProtoMessage()

func (*TransactionListQuery) ProtoReflect

func (x *TransactionListQuery) ProtoReflect() protoreflect.Message

func (*TransactionListQuery) Reset

func (x *TransactionListQuery) Reset()

func (*TransactionListQuery) String

func (x *TransactionListQuery) String() string

type TransactionPayload

type TransactionPayload struct {

	// conversationID contains the token used to identify the response
	ConversationID []byte `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
	// transactionRef contains the reference to the transaction which' payload was requested.
	TransactionRef []byte `protobuf:"bytes,2,opt,name=transactionRef,proto3" json:"transactionRef,omitempty"`
	// data contains the actual payload.
	Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

TransactionPayload is the response message for TransactionPayloadQuery

func (*TransactionPayload) Descriptor deprecated

func (*TransactionPayload) Descriptor() ([]byte, []int)

Deprecated: Use TransactionPayload.ProtoReflect.Descriptor instead.

func (*TransactionPayload) GetConversationID

func (x *TransactionPayload) GetConversationID() []byte

func (*TransactionPayload) GetData

func (x *TransactionPayload) GetData() []byte

func (*TransactionPayload) GetTransactionRef

func (x *TransactionPayload) GetTransactionRef() []byte

func (*TransactionPayload) ProtoMessage

func (*TransactionPayload) ProtoMessage()

func (*TransactionPayload) ProtoReflect

func (x *TransactionPayload) ProtoReflect() protoreflect.Message

func (*TransactionPayload) Reset

func (x *TransactionPayload) Reset()

func (*TransactionPayload) String

func (x *TransactionPayload) String() string

type TransactionPayloadQuery

type TransactionPayloadQuery struct {

	// conversationID contains the token used to identify the response
	ConversationID []byte `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
	// transactionRef contains the reference (hash) of the transaction, which payload the node would like to receive, as specified by RFC004.
	TransactionRef []byte `protobuf:"bytes,2,opt,name=transactionRef,proto3" json:"transactionRef,omitempty"`
	// contains filtered or unexported fields
}

TransactionPayloadQuery is a message used to query the payload of a transaction.

func (*TransactionPayloadQuery) Descriptor deprecated

func (*TransactionPayloadQuery) Descriptor() ([]byte, []int)

Deprecated: Use TransactionPayloadQuery.ProtoReflect.Descriptor instead.

func (*TransactionPayloadQuery) GetConversationID

func (x *TransactionPayloadQuery) GetConversationID() []byte

func (*TransactionPayloadQuery) GetTransactionRef

func (x *TransactionPayloadQuery) GetTransactionRef() []byte

func (*TransactionPayloadQuery) ProtoMessage

func (*TransactionPayloadQuery) ProtoMessage()

func (*TransactionPayloadQuery) ProtoReflect

func (x *TransactionPayloadQuery) ProtoReflect() protoreflect.Message

func (*TransactionPayloadQuery) Reset

func (x *TransactionPayloadQuery) Reset()

func (*TransactionPayloadQuery) String

func (x *TransactionPayloadQuery) String() string

type TransactionRangeQuery

type TransactionRangeQuery struct {

	// conversationID contains the token used to identify the response
	ConversationID []byte `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
	// start indicates the start of the requested Lamport Clock range (inclusive)
	Start uint32 `protobuf:"varint,2,opt,name=start,proto3" json:"start,omitempty"`
	// end indicates the end of the requested Lamport Clock range (exclusive)
	End uint32 `protobuf:"varint,3,opt,name=end,proto3" json:"end,omitempty"`
	// contains filtered or unexported fields
}

TransactionRangeQuery is a request for transactions by LC range

func (*TransactionRangeQuery) Descriptor deprecated

func (*TransactionRangeQuery) Descriptor() ([]byte, []int)

Deprecated: Use TransactionRangeQuery.ProtoReflect.Descriptor instead.

func (*TransactionRangeQuery) GetConversationID

func (x *TransactionRangeQuery) GetConversationID() []byte

func (*TransactionRangeQuery) GetEnd

func (x *TransactionRangeQuery) GetEnd() uint32

func (*TransactionRangeQuery) GetStart

func (x *TransactionRangeQuery) GetStart() uint32

func (*TransactionRangeQuery) ProtoMessage

func (*TransactionRangeQuery) ProtoMessage()

func (*TransactionRangeQuery) ProtoReflect

func (x *TransactionRangeQuery) ProtoReflect() protoreflect.Message

func (*TransactionRangeQuery) Reset

func (x *TransactionRangeQuery) Reset()

func (*TransactionRangeQuery) String

func (x *TransactionRangeQuery) String() string

type TransactionSet

type TransactionSet struct {

	// conversationID contains the token used to identify the response
	ConversationID []byte `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
	// LCReq contains the LC value that was sent in the State message
	LCReq uint32 `protobuf:"varint,2,opt,name=LCReq,proto3" json:"LCReq,omitempty"`
	// LC contains the highest transaction Lamport Clock value from the sender of this message.
	LC uint32 `protobuf:"varint,3,opt,name=LC,proto3" json:"LC,omitempty"`
	// IBLT contains the serialized IBLT. The first byte indicates the serialization format of the IBLT.
	IBLT []byte `protobuf:"bytes,4,opt,name=IBLT,proto3" json:"IBLT,omitempty"`
	// contains filtered or unexported fields
}

TransactionSet sends an IBLT in response to a State message

func (*TransactionSet) Descriptor deprecated

func (*TransactionSet) Descriptor() ([]byte, []int)

Deprecated: Use TransactionSet.ProtoReflect.Descriptor instead.

func (*TransactionSet) GetConversationID

func (x *TransactionSet) GetConversationID() []byte

func (*TransactionSet) GetIBLT

func (x *TransactionSet) GetIBLT() []byte

func (*TransactionSet) GetLC

func (x *TransactionSet) GetLC() uint32

func (*TransactionSet) GetLCReq

func (x *TransactionSet) GetLCReq() uint32

func (*TransactionSet) ProtoMessage

func (*TransactionSet) ProtoMessage()

func (*TransactionSet) ProtoReflect

func (x *TransactionSet) ProtoReflect() protoreflect.Message

func (*TransactionSet) Reset

func (x *TransactionSet) Reset()

func (*TransactionSet) String

func (x *TransactionSet) String() string

type UnimplementedProtocolServer

type UnimplementedProtocolServer struct{}

UnimplementedProtocolServer should be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedProtocolServer) Stream

type UnsafeProtocolServer

type UnsafeProtocolServer interface {
	// contains filtered or unexported methods
}

UnsafeProtocolServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ProtocolServer will result in compilation errors.

Directories

Path Synopsis
Package gossip is a generated GoMock package.
Package gossip is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL