Documentation ¶
Overview ¶
Package transport is a generated GoMock package.
Package transport is a generated GoMock package.
Index ¶
- Constants
- func ParseAddress(input string) (string, error)
- type ConnectionManager
- type ConnectionOption
- type ConnectorStats
- type Diagnostics
- type FixedNodeDIDResolver
- type MockConnectionManager
- func (m *MockConnectionManager) Connect(peerAddress string, option ...ConnectionOption)
- func (m *MockConnectionManager) Diagnostics() []core.DiagnosticResult
- func (m *MockConnectionManager) EXPECT() *MockConnectionManagerMockRecorder
- func (m *MockConnectionManager) Peers() []Peer
- func (m *MockConnectionManager) RegisterObserver(callback StreamStateObserverFunc)
- func (m *MockConnectionManager) Start() error
- func (m *MockConnectionManager) Stop()
- type MockConnectionManagerMockRecorder
- func (mr *MockConnectionManagerMockRecorder) Connect(peerAddress interface{}, option ...interface{}) *gomock.Call
- func (mr *MockConnectionManagerMockRecorder) Diagnostics() *gomock.Call
- func (mr *MockConnectionManagerMockRecorder) Peers() *gomock.Call
- func (mr *MockConnectionManagerMockRecorder) RegisterObserver(callback interface{}) *gomock.Call
- func (mr *MockConnectionManagerMockRecorder) Start() *gomock.Call
- func (mr *MockConnectionManagerMockRecorder) Stop() *gomock.Call
- type MockProtocol
- func (m *MockProtocol) Configure(peerID PeerID) error
- func (m *MockProtocol) Diagnostics() []core.DiagnosticResult
- func (m *MockProtocol) EXPECT() *MockProtocolMockRecorder
- func (m *MockProtocol) PeerDiagnostics() map[PeerID]Diagnostics
- func (m *MockProtocol) Start() error
- func (m *MockProtocol) Stop()
- func (m *MockProtocol) Version() int
- type MockProtocolMockRecorder
- func (mr *MockProtocolMockRecorder) Configure(peerID interface{}) *gomock.Call
- func (mr *MockProtocolMockRecorder) Diagnostics() *gomock.Call
- func (mr *MockProtocolMockRecorder) PeerDiagnostics() *gomock.Call
- func (mr *MockProtocolMockRecorder) Start() *gomock.Call
- func (mr *MockProtocolMockRecorder) Stop() *gomock.Call
- func (mr *MockProtocolMockRecorder) Version() *gomock.Call
- type NodeDIDResolver
- type Peer
- type PeerID
- type Protocol
- type StreamState
- type StreamStateObserverFunc
Constants ¶
const NutsCommServiceType = "NutsComm"
NutsCommServiceType holds the DID document service type that specifies the Nuts network service address of the Nuts node.
Variables ¶
This section is empty.
Functions ¶
func ParseAddress ¶
ParseAddress parses the given input string to a gRPC target address. The input must include the protocol scheme (e.g. grpc://).
Types ¶
type ConnectionManager ¶
type ConnectionManager interface { core.Diagnosable // Connect attempts to make an outbound connection to the given peer if it's not already connected. // acceptNonAuthenticated indicates if the connection must be kept even if the other end can't be authenticated. // The connection can then still be used for non-authenticated purposes. Connect(peerAddress string, option ...ConnectionOption) // Peers returns a slice containing the peers that are currently connected. Peers() []Peer // RegisterObserver allows to register a callback function for stream state changes RegisterObserver(callback StreamStateObserverFunc) // Start instructs the ConnectionManager to start accepting connections and prepare to make outbound connections. Start() error // Stop shuts down the connections made by the ConnectionManager. Stop() }
ConnectionManager manages the connections to peers, making outbound connections if required. It also determines the network layout.
type ConnectionOption ¶
type ConnectionOption func(peer *Peer)
ConnectionOption is the option function for adding options when establishing a connection through the connection manager. The options are set on the Peer
func WithUnauthenticated ¶
func WithUnauthenticated() ConnectionOption
WithUnauthenticated is the option for allowing the connection to be unauthenticated. The node.DID authentication on a connection will always succeed. Actions that require the node.DID will fail.
type ConnectorStats ¶
type ConnectorStats struct { // Address holds the target address the connector is connecting to. Address string // Attempts holds the number of times the node tried to connect to the peer. Attempts uint32 }
ConnectorStats holds statistics of an outbound connector.
type Diagnostics ¶
type Diagnostics struct { // Uptime the uptime (time since the node started) in seconds. Uptime time.Duration `json:"uptime"` // Peers contains the peer IDs of the node's peers. Peers []PeerID `json:"peers"` // NumberOfTransactions contains the total number of transactions on the node's DAG. NumberOfTransactions uint32 `json:"transactionNum"` // 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 `json:"softwareVersion"` // SoftwareID contains an indication of the vendor of the software 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's or vendor's name. SoftwareID string `json:"softwareID"` }
Diagnostics contains information that is shared to this node's peers on request.
type FixedNodeDIDResolver ¶
FixedNodeDIDResolver is a NodeDIDResolver that returns a preset DID.
type MockConnectionManager ¶
type MockConnectionManager struct {
// contains filtered or unexported fields
}
MockConnectionManager is a mock of ConnectionManager interface.
func NewMockConnectionManager ¶
func NewMockConnectionManager(ctrl *gomock.Controller) *MockConnectionManager
NewMockConnectionManager creates a new mock instance.
func (*MockConnectionManager) Connect ¶
func (m *MockConnectionManager) Connect(peerAddress string, option ...ConnectionOption)
Connect mocks base method.
func (*MockConnectionManager) Diagnostics ¶
func (m *MockConnectionManager) Diagnostics() []core.DiagnosticResult
Diagnostics mocks base method.
func (*MockConnectionManager) EXPECT ¶
func (m *MockConnectionManager) EXPECT() *MockConnectionManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConnectionManager) Peers ¶
func (m *MockConnectionManager) Peers() []Peer
Peers mocks base method.
func (*MockConnectionManager) RegisterObserver ¶
func (m *MockConnectionManager) RegisterObserver(callback StreamStateObserverFunc)
RegisterObserver mocks base method.
func (*MockConnectionManager) Start ¶
func (m *MockConnectionManager) Start() error
Start mocks base method.
type MockConnectionManagerMockRecorder ¶
type MockConnectionManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockConnectionManagerMockRecorder is the mock recorder for MockConnectionManager.
func (*MockConnectionManagerMockRecorder) Connect ¶
func (mr *MockConnectionManagerMockRecorder) Connect(peerAddress interface{}, option ...interface{}) *gomock.Call
Connect indicates an expected call of Connect.
func (*MockConnectionManagerMockRecorder) Diagnostics ¶
func (mr *MockConnectionManagerMockRecorder) Diagnostics() *gomock.Call
Diagnostics indicates an expected call of Diagnostics.
func (*MockConnectionManagerMockRecorder) Peers ¶
func (mr *MockConnectionManagerMockRecorder) Peers() *gomock.Call
Peers indicates an expected call of Peers.
func (*MockConnectionManagerMockRecorder) RegisterObserver ¶
func (mr *MockConnectionManagerMockRecorder) RegisterObserver(callback interface{}) *gomock.Call
RegisterObserver indicates an expected call of RegisterObserver.
func (*MockConnectionManagerMockRecorder) Start ¶
func (mr *MockConnectionManagerMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockConnectionManagerMockRecorder) Stop ¶
func (mr *MockConnectionManagerMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
type MockProtocol ¶
type MockProtocol struct {
// contains filtered or unexported fields
}
MockProtocol is a mock of Protocol interface.
func NewMockProtocol ¶
func NewMockProtocol(ctrl *gomock.Controller) *MockProtocol
NewMockProtocol creates a new mock instance.
func (*MockProtocol) Configure ¶
func (m *MockProtocol) Configure(peerID PeerID) error
Configure mocks base method.
func (*MockProtocol) Diagnostics ¶
func (m *MockProtocol) Diagnostics() []core.DiagnosticResult
Diagnostics mocks base method.
func (*MockProtocol) EXPECT ¶
func (m *MockProtocol) EXPECT() *MockProtocolMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockProtocol) PeerDiagnostics ¶
func (m *MockProtocol) PeerDiagnostics() map[PeerID]Diagnostics
PeerDiagnostics mocks base method.
type MockProtocolMockRecorder ¶
type MockProtocolMockRecorder struct {
// contains filtered or unexported fields
}
MockProtocolMockRecorder is the mock recorder for MockProtocol.
func (*MockProtocolMockRecorder) Configure ¶
func (mr *MockProtocolMockRecorder) Configure(peerID interface{}) *gomock.Call
Configure indicates an expected call of Configure.
func (*MockProtocolMockRecorder) Diagnostics ¶
func (mr *MockProtocolMockRecorder) Diagnostics() *gomock.Call
Diagnostics indicates an expected call of Diagnostics.
func (*MockProtocolMockRecorder) PeerDiagnostics ¶
func (mr *MockProtocolMockRecorder) PeerDiagnostics() *gomock.Call
PeerDiagnostics indicates an expected call of PeerDiagnostics.
func (*MockProtocolMockRecorder) Start ¶
func (mr *MockProtocolMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockProtocolMockRecorder) Stop ¶
func (mr *MockProtocolMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
func (*MockProtocolMockRecorder) Version ¶
func (mr *MockProtocolMockRecorder) Version() *gomock.Call
Version indicates an expected call of Version.
type NodeDIDResolver ¶
type NodeDIDResolver interface { // Resolve tries to resolve the node DID. If it's absent, an empty DID is returned. In any other non-successful case an error is returned. Resolve() (did.DID, error) }
NodeDIDResolver defines an interface for types that resolve the local node's DID, which is used to identify the node on the network.
func NewAutoNodeDIDResolver ¶
func NewAutoNodeDIDResolver(keyResolver crypto.KeyResolver, docFinder types.DocFinder) NodeDIDResolver
NewAutoNodeDIDResolver creates a new node DID resolver that tried to look it up by matching DID documents with a NutsComm endpoint set and the private key of the local node.
type Peer ¶
type Peer struct { // ID holds the unique identificator of the peer ID PeerID // Address holds the remote address of the node we're actually connected to Address string // NodeDID holds the DID that the peer uses to identify its node on the network. // It is only set when properly authenticated. NodeDID did.DID // AcceptUnauthenticated indicates if a connection may be made with this Peer even if the NodeDID is not set. AcceptUnauthenticated bool }
Peer holds the properties of a remote node we're connected to
type Protocol ¶
type Protocol interface { // Configure configures the Protocol implementation, must be called before Start(). Configure(peerID PeerID) error // Start starts the Protocol implementation. Start() error // Stop stops the Protocol implementation. Stop() // Diagnostics collects and returns diagnostical information on the protocol. Diagnostics() []core.DiagnosticResult // PeerDiagnostics collects and returns diagnostical information on the peers the protocol is communicating with. PeerDiagnostics() map[PeerID]Diagnostics // Version returns the version of the protocol Version() int }
Protocol is a self-contained process that can exchange network data (e.g. DAG transactions or private credentials) with other parties on the network.
type StreamState ¶
type StreamState string
StreamState is a type for defining connection states
const ( // StateConnected is passed to the connection observers when a stream state changed to connected StateConnected StreamState = "connected" // StateDisconnected is passed to the connection observers when a stream state changed to disconnected StateDisconnected StreamState = "disconnected" )
type StreamStateObserverFunc ¶
type StreamStateObserverFunc func(peer Peer, state StreamState, protocol Protocol)
StreamStateObserverFunc is a function that can be registered on the connection manager. If a stream state changes this callback will be called. It's called per protocol.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package grpc is a generated GoMock package.
|
Package grpc is a generated GoMock package. |
logic
Package logic is a generated GoMock package.
|
Package logic is a generated GoMock package. |
protobuf
Package protobuf is a generated GoMock package.
|
Package protobuf is a generated GoMock package. |
Package v2 is a generated GoMock package.
|
Package v2 is a generated GoMock package. |
gossip
Package gossip is a generated GoMock package.
|
Package gossip is a generated GoMock package. |