Documentation ¶
Index ¶
- Constants
- Variables
- func BindContract(contractInstance interface{}, bindFunc func() (interface{}, error)) error
- func DisconnectNode(node *node.Node, enodeId string, isAuthority bool) error
- func GetNodeDetails(url string, isAuthority, useDns bool) (string, string, uint16, uint16, error)
- func SubscribeStopEvent() (chan StopEvent, event.Subscription)
- func UpdateDisallowedNodes(dataDir, url string, operation NodeOperation) error
- func UpdateFile(fileName, enodeId string, operation NodeOperation, createFile bool) error
- func UpdatePermissionedNodes(node *node.Node, dataDir, enodeId string, operation NodeOperation, ...) error
- type Backend
- type ContractBackend
- type ControlService
- type InitService
- type InterfaceBackend
- type NodeOperation
- type NodeService
- type PermissionConfig
- type StopEvent
- type TxArgs
Constants ¶
View Source
const ( PERMISSION_V0 = "v0" PERMISSION_V1 = "v1" )
supports 2 models of permissions v1 and v0. v0 is aligned with the latest eea specs
View Source
const ( PERMISSIONED_CONFIG = "permissioned-nodes.json" BLACKLIST_CONFIG = "disallowed-nodes.json" PERMISSION_MODEL_CONFIG = "permission-config.json" DEFAULT_NODECACHE_SIZE = 1000 NODE_NAME_LENGTH = 32 )
Variables ¶
View Source
var ( ErrInvalidInput = errors.New("Invalid input") ErrInvalidNode = errors.New("Invalid enode id") ErrBlacklistedNode = errors.New("Blacklisted node. Operation not allowed") ErrNodeDoesNotExists = errors.New("Node does not exist") ErrOrgDoesNotExists = errors.New("Org does not exist") ErrHostNameNotSupported = errors.New("Hostname not supported in the network") ErrNoPermissionForTxn = errors.New("account does not have permission for the transaction") )
View Source
var StopFeed event.Feed
broadcasting stopEvent when service is being stopped
Functions ¶
func BindContract ¶
func DisconnectNode ¶
Disconnect the Node from the network
func GetNodeDetails ¶
returns the enode details
func SubscribeStopEvent ¶
func SubscribeStopEvent() (chan StopEvent, event.Subscription)
function to subscribe to the stop event
func UpdateDisallowedNodes ¶
func UpdateDisallowedNodes(dataDir, url string, operation NodeOperation) error
this function populates the black listed Node information into the disallowed-nodes.json file
func UpdateFile ¶
func UpdateFile(fileName, enodeId string, operation NodeOperation, createFile bool) error
adds or deletes and entry from a given file
func UpdatePermissionedNodes ¶
func UpdatePermissionedNodes(node *node.Node, dataDir, enodeId string, operation NodeOperation, isAuthority bool) error
updates Node information in the permissioned-nodes.json file based on Node management activities in smart contract
Types ¶
type Backend ¶
type Backend interface { // node service for node management service GetNodeService(transactOpts *bind.TransactOpts, nodeBackend ContractBackend) (NodeService, error) // control service for account management service GetControlService(controlBackend ContractBackend) (ControlService, error) // Monitors Node management events and updates cache accordingly ManageNodePermissions() error // monitors for network boot up complete event MonitorNetworkBootUp() error }
type ContractBackend ¶
type ContractBackend struct { EthClnt bind.ContractBackend Key *ecdsa.PrivateKey PermConfig *PermissionConfig IsAuthority bool UseDns bool }
type ControlService ¶
type ControlService interface { ConnectionAllowed(_enodeId, _ip string, _port, _raftPort uint16) (bool, error) TransactionAllowed(_sender common.Address, _target common.Address, _value *big.Int, _gasPrice *big.Int, _gasLimit *big.Int, _payload []byte, _transactionType core.TransactionType) error }
Control services
type InitService ¶
type InitService interface { BindContracts() error Init(_breadth *big.Int, _depth *big.Int) (*types.Transaction, error) UpdateNetworkBootStatus() (*types.Transaction, error) SetPolicy(_nwAdminOrg string, _nwAdminRole string, _oAdminRole string) (*types.Transaction, error) GetNetworkBootStatus() (bool, error) AddAdminNode(url string) (*types.Transaction, error) GetNodeDetailsFromIndex(_nodeIndex *big.Int) (string, string, *big.Int, error) GetNumberOfNodes() (*big.Int, error) GetNodeDetails(enodeId string) (string, string, *big.Int, error) }
type InterfaceBackend ¶
type InterfaceBackend struct {
// contains filtered or unexported fields
}
backend struct for interfaces
func NewInterfaceBackend ¶
func NewInterfaceBackend(node *node.Node, isAuthority bool, dataDir string) *InterfaceBackend
func (InterfaceBackend) DataDir ¶
func (i InterfaceBackend) DataDir() string
func (InterfaceBackend) IsAuthority ¶
func (i InterfaceBackend) IsAuthority() bool
func (InterfaceBackend) Node ¶
func (i InterfaceBackend) Node() *node.Node
func (*InterfaceBackend) SetIsAuthority ¶
func (i *InterfaceBackend) SetIsAuthority(isAuthority bool)
type NodeService ¶
type NodeService interface { AddNode(_args TxArgs) (*types.Transaction, error) UpdateNodeStatus(_args TxArgs) (*types.Transaction, error) StartBlacklistedNodeRecovery(_args TxArgs) (*types.Transaction, error) ApproveBlacklistedNodeRecovery(_args TxArgs) (*types.Transaction, error) }
Node services
type PermissionConfig ¶
type PermissionConfig struct { PermissionsModel string `json:"permissionModel"` UpgrdAddress common.Address `json:"upgrdableAddress"` NodeAddress common.Address `json:"nodeMgrAddress"` }
permission config for bootstrapping
func ParsePermissionConfig ¶
func ParsePermissionConfig(dir string) (PermissionConfig, error)
function reads the permissions config file passed and populates the config structure accordingly
func (*PermissionConfig) IsEmpty ¶
func (pc *PermissionConfig) IsEmpty() bool
Click to show internal directories.
Click to hide internal directories.