Documentation ¶
Overview ¶
Package network is a generated GoMock package.
Index ¶
- Constants
- type Config
- type MockTransactions
- func (m *MockTransactions) CreateTransaction(spec Template) (dag.Transaction, error)
- func (m *MockTransactions) EXPECT() *MockTransactionsMockRecorder
- func (m *MockTransactions) GetTransaction(transactionRef hash.SHA256Hash) (dag.Transaction, error)
- func (m *MockTransactions) GetTransactionPayload(transactionRef hash.SHA256Hash) ([]byte, error)
- func (m *MockTransactions) ListTransactions() ([]dag.Transaction, error)
- func (m *MockTransactions) PeerDiagnostics() map[transport.PeerID]transport.Diagnostics
- func (m *MockTransactions) Subscribe(eventType dag.EventType, payloadType string, receiver dag.Receiver)
- func (m *MockTransactions) Walk(visitor dag.Visitor) error
- type MockTransactionsMockRecorder
- func (mr *MockTransactionsMockRecorder) CreateTransaction(spec interface{}) *gomock.Call
- func (mr *MockTransactionsMockRecorder) GetTransaction(transactionRef interface{}) *gomock.Call
- func (mr *MockTransactionsMockRecorder) GetTransactionPayload(transactionRef interface{}) *gomock.Call
- func (mr *MockTransactionsMockRecorder) ListTransactions() *gomock.Call
- func (mr *MockTransactionsMockRecorder) PeerDiagnostics() *gomock.Call
- func (mr *MockTransactionsMockRecorder) Subscribe(eventType, payloadType, receiver interface{}) *gomock.Call
- func (mr *MockTransactionsMockRecorder) Walk(visitor interface{}) *gomock.Call
- type Network
- func (n *Network) Config() interface{}
- func (n *Network) Configure(config core.ServerConfig) error
- func (n *Network) CreateTransaction(template Template) (dag.Transaction, error)
- func (n *Network) Diagnostics() []core.DiagnosticResult
- func (n *Network) GetTransaction(transactionRef hash.SHA256Hash) (dag.Transaction, error)
- func (n *Network) GetTransactionPayload(transactionRef hash.SHA256Hash) ([]byte, error)
- func (n *Network) ListTransactions() ([]dag.Transaction, error)
- func (n *Network) Name() string
- func (n *Network) PeerDiagnostics() map[transport.PeerID]transport.Diagnostics
- func (n *Network) Shutdown() error
- func (n *Network) Start() error
- func (n *Network) Subscribe(eventType dag.EventType, transactionType string, receiver dag.Receiver)
- func (n *Network) Walk(visitor dag.Visitor) error
- type Template
- type Transactions
Constants ¶
const (
// ModuleName specifies the name of this module.
ModuleName = "Network"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Socket address for gRPC to listen on GrpcAddr string `koanf:"network.grpcaddr"` // EnableTLS specifies whether to enable TLS for incoming connections. EnableTLS bool `koanf:"network.enabletls"` // Public address of this nodes other nodes can use to connect to this node. BootstrapNodes []string `koanf:"network.bootstrapnodes"` CertFile string `koanf:"network.certfile"` CertKeyFile string `koanf:"network.certkeyfile"` // EnableDiscovery tells the node to automatically connect to other nodes EnableDiscovery bool `koanf:"network.enablediscovery"` TrustStoreFile string `koanf:"network.truststorefile"` // MaxCRLValidityDays defines the number of days a CRL can be outdated, after that it will hard-fail MaxCRLValidityDays int `koanf:"network.maxcrlvaliditydays"` // DisableNodeAuthentication allows for bypassing node DID authentication on connections. // The SAN from a client certificate is used for this, in development/test certificates might not be availabe. // Can't be set to true in strictmode. DisableNodeAuthentication bool `koanf:"network.disablenodeauthentication"` // NodeDID defines the DID of the organization that operates this node, typically a vendor for EPD software. // It is used to identify it on the network. NodeDID string `koanf:"network.nodedid"` // ProtocolV1 specifies config for protocol v1 ProtocolV1 v1.Config `koanf:"network.v1"` // ProtocolV2 specifies config for protocol v2 ProtocolV2 v2.Config `koanf:"network.v2"` }
Config holds the config for Transactions
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default NetworkEngine configuration.
func TestNetworkConfig ¶
func TestNetworkConfig() Config
TestNetworkConfig creates new network config with a test directory as data path.
type MockTransactions ¶
type MockTransactions struct {
// contains filtered or unexported fields
}
MockTransactions is a mock of Transactions interface.
func NewMockTransactions ¶
func NewMockTransactions(ctrl *gomock.Controller) *MockTransactions
NewMockTransactions creates a new mock instance.
func (*MockTransactions) CreateTransaction ¶
func (m *MockTransactions) CreateTransaction(spec Template) (dag.Transaction, error)
CreateTransaction mocks base method.
func (*MockTransactions) EXPECT ¶
func (m *MockTransactions) EXPECT() *MockTransactionsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTransactions) GetTransaction ¶
func (m *MockTransactions) GetTransaction(transactionRef hash.SHA256Hash) (dag.Transaction, error)
GetTransaction mocks base method.
func (*MockTransactions) GetTransactionPayload ¶
func (m *MockTransactions) GetTransactionPayload(transactionRef hash.SHA256Hash) ([]byte, error)
GetTransactionPayload mocks base method.
func (*MockTransactions) ListTransactions ¶
func (m *MockTransactions) ListTransactions() ([]dag.Transaction, error)
ListTransactions mocks base method.
func (*MockTransactions) PeerDiagnostics ¶
func (m *MockTransactions) PeerDiagnostics() map[transport.PeerID]transport.Diagnostics
PeerDiagnostics mocks base method.
type MockTransactionsMockRecorder ¶
type MockTransactionsMockRecorder struct {
// contains filtered or unexported fields
}
MockTransactionsMockRecorder is the mock recorder for MockTransactions.
func (*MockTransactionsMockRecorder) CreateTransaction ¶
func (mr *MockTransactionsMockRecorder) CreateTransaction(spec interface{}) *gomock.Call
CreateTransaction indicates an expected call of CreateTransaction.
func (*MockTransactionsMockRecorder) GetTransaction ¶
func (mr *MockTransactionsMockRecorder) GetTransaction(transactionRef interface{}) *gomock.Call
GetTransaction indicates an expected call of GetTransaction.
func (*MockTransactionsMockRecorder) GetTransactionPayload ¶
func (mr *MockTransactionsMockRecorder) GetTransactionPayload(transactionRef interface{}) *gomock.Call
GetTransactionPayload indicates an expected call of GetTransactionPayload.
func (*MockTransactionsMockRecorder) ListTransactions ¶
func (mr *MockTransactionsMockRecorder) ListTransactions() *gomock.Call
ListTransactions indicates an expected call of ListTransactions.
func (*MockTransactionsMockRecorder) PeerDiagnostics ¶
func (mr *MockTransactionsMockRecorder) PeerDiagnostics() *gomock.Call
PeerDiagnostics indicates an expected call of PeerDiagnostics.
func (*MockTransactionsMockRecorder) Subscribe ¶
func (mr *MockTransactionsMockRecorder) Subscribe(eventType, payloadType, receiver interface{}) *gomock.Call
Subscribe indicates an expected call of Subscribe.
func (*MockTransactionsMockRecorder) Walk ¶
func (mr *MockTransactionsMockRecorder) Walk(visitor interface{}) *gomock.Call
Walk indicates an expected call of Walk.
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network implements Transactions interface and Engine functions.
func NewNetworkInstance ¶
func NewNetworkInstance( config Config, keyResolver types.KeyResolver, privateKeyResolver crypto.KeyResolver, decrypter crypto.Decrypter, didDocumentResolver types.DocResolver, didDocumentFinder types.DocFinder, ) *Network
NewNetworkInstance creates a new Network engine instance.
func NewTestNetworkInstance ¶
NewTestNetworkInstance creates a new Transactions instance that writes it data to a test directory.
func (*Network) Config ¶
func (n *Network) Config() interface{}
Config returns a pointer to the actual config of the module.
func (*Network) Configure ¶
func (n *Network) Configure(config core.ServerConfig) error
Configure configures the Network subsystem
func (*Network) CreateTransaction ¶
func (n *Network) CreateTransaction(template Template) (dag.Transaction, error)
CreateTransaction creates a new transaction from the given template.
func (*Network) Diagnostics ¶
func (n *Network) Diagnostics() []core.DiagnosticResult
Diagnostics collects and returns diagnostics for the Network engine.
func (*Network) GetTransaction ¶
func (n *Network) GetTransaction(transactionRef hash.SHA256Hash) (dag.Transaction, error)
GetTransaction retrieves the transaction for the given reference. If the transaction is not known, an error is returned.
func (*Network) GetTransactionPayload ¶
func (n *Network) GetTransactionPayload(transactionRef hash.SHA256Hash) ([]byte, error)
GetTransactionPayload retrieves the transaction Payload for the given transaction. If the transaction or Payload is not found nil is returned.
func (*Network) ListTransactions ¶
func (n *Network) ListTransactions() ([]dag.Transaction, error)
ListTransactions returns all transactions known to this Network instance.
func (*Network) PeerDiagnostics ¶
func (n *Network) PeerDiagnostics() map[transport.PeerID]transport.Diagnostics
PeerDiagnostics returns a map containing diagnostic information of the node's peers. The key contains the remote peer's ID.
type Template ¶
type Template struct { Key crypto.Key Payload []byte Type string AttachKey bool Timestamp time.Time AdditionalPrevs []hash.SHA256Hash Participants dag.PAL }
Template is used to build a spec for new transactions.
func TransactionTemplate ¶
TransactionTemplate creates a new Template with the given required properties.
func (Template) WithAdditionalPrevs ¶
func (t Template) WithAdditionalPrevs(additionalPrevs []hash.SHA256Hash) Template
WithAdditionalPrevs specifies additional `prev` hashes, which are added to the set of prevs of the new transaction (current HEADs of the DAG). This is used to update entities that are mutable. By referring to the previous transaction of an entity, conflicts through parallel updates can be detected.
func (Template) WithAttachKey ¶
WithAttachKey specifies that the signing key must be attached to the transaction, because it wasn't published before.
func (Template) WithPrivate ¶
WithPrivate specifies that the transaction is private, and should only be readable by the given Participants.
type Transactions ¶
type Transactions interface { // Subscribe makes a subscription for the specified transaction type. The receiver is called when a transaction // is received for the specified event and payload type. Subscribe(eventType dag.EventType, payloadType string, receiver dag.Receiver) // GetTransactionPayload retrieves the transaction Payload for the given transaction. If the transaction or Payload is not found // nil is returned. GetTransactionPayload(transactionRef hash.SHA256Hash) ([]byte, error) // GetTransaction retrieves the transaction for the given reference. If the transaction is not known, an error is returned. GetTransaction(transactionRef hash.SHA256Hash) (dag.Transaction, error) // CreateTransaction creates a new transaction according to the given spec. CreateTransaction(spec Template) (dag.Transaction, error) // ListTransactions returns all transactions known to this Network instance. ListTransactions() ([]dag.Transaction, error) // Walk walks the DAG starting at the root, calling `visitor` for every transaction. Walk(visitor dag.Visitor) error // PeerDiagnostics returns a map containing diagnostic information of the node's peers. The key contains the remote peer's ID. PeerDiagnostics() map[transport.PeerID]transport.Diagnostics }
Transactions is the interface that defines the API for creating, reading and subscribing to Nuts Network transactions.
Directories ¶
Path | Synopsis |
---|---|
api
|
|
v1
Package v1 provides primitives to interact with the openapi HTTP API.
|
Package v1 provides primitives to interact with the openapi HTTP API. |
Package dag is a generated GoMock package.
|
Package dag is a generated GoMock package. |
Package transport is a generated GoMock package.
|
Package transport is a generated GoMock package. |
grpc
Package grpc is a generated GoMock package.
|
Package grpc is a generated GoMock package. |
v1/logic
Package logic is a generated GoMock package.
|
Package logic is a generated GoMock package. |
v1/protobuf
Package protobuf is a generated GoMock package.
|
Package protobuf is a generated GoMock package. |
v2
Package v2 is a generated GoMock package.
|
Package v2 is a generated GoMock package. |
v2/gossip
Package gossip is a generated GoMock package.
|
Package gossip is a generated GoMock package. |