Documentation
¶
Index ¶
- Variables
- func IsApplicationNameCorrect(text string) bool
- func IsValidModuleName(value string) bool
- func ParseUDPBeaconMessage(data []byte) (string, error)
- func RenderUDPBeaconMessage(value string) []byte
- type Address
- type ApplicationCommunicator
- type ApplicationControllerI
- type ApplicationModule
- type ApplicationModuleInstance
- type ApplicationModuleInstanceMap
- type ApplicationModuleMap
- type IncommingRPCHandler
- type ModuleChecksum
- type ModuleName
- type NetworkAddress
Constants ¶
This section is empty.
Variables ¶
View Source
var VALID_MODULE_NAME_RE *regexp.Regexp = regexp.MustCompile(
"^[A-Za-z][0-9A-Za-z_]*$",
)
View Source
var WRAPPING_MAGICK string = "DNETMAGICK"
View Source
var WRAPPING_MAGICK_B []byte = bytes.NewBufferString(WRAPPING_MAGICK).Bytes()
Functions ¶
func IsValidModuleName ¶
func ParseUDPBeaconMessage ¶
func RenderUDPBeaconMessage ¶
Types ¶
type ApplicationCommunicator ¶
type ApplicationCommunicator interface {
GetDBConnection() *gorm.DB // Application's own db connection
GetLogger() gologger.LoggerI
Connect(
to_who *Address,
as_service string,
to_service string,
) (
*net.Conn,
error,
)
ServeConnection(
who *Address,
conn net.Conn,
) error
PossiblyNodeDiscovered(address NetworkAddress) error
GetInnodeRPC(target_app_name string) (*rpc.Client, error)
}
This communicator is the standard way for application (module) to interact with DNet and other applications
type ApplicationControllerI ¶
type ApplicationControllerI interface {
GetBuiltinModules() ApplicationModuleMap
GetImportedModules() ApplicationModuleMap
GetModuleInstances() ApplicationModuleInstanceMap
IsModuleExists(name *ModuleName) bool
IsModuleBuiltin(name *ModuleName) bool
GetModule(name *ModuleName) ApplicationModule
IsInstanceExists(name *ModuleName) bool
IsInstanceBuiltin(name *ModuleName) bool
GetInstance(name *ModuleName) ApplicationModuleInstance
GetInnodeRPC(
who_asks *ModuleName,
target_name *ModuleName,
) (*rpc.Client, error)
}
type ApplicationModule ¶
type ApplicationModule interface {
Name() *ModuleName
Title() string
Description() string
DependsOn() []string // module names which required to be enabled
// If calling instance's Start() Stop() and Status() methods have sence
IsWorker() bool
IsNetwork() bool
// If instance can be called to show it's window
HaveUI() bool
// DNet will not do automatic rekeys to not try to gues better time. Instead,
// UI should provide user with flexible tools for user to decide on he's own
// when he's need to do rekeys
Instantiate(com ApplicationCommunicator) (ApplicationModuleInstance, error)
}
type ApplicationModuleInstance ¶
type ApplicationModuleInstance interface {
// Those may be called only if Module's IsWorker() returns true.
// If Module's IsWorker() returns false, instance have simply
// impliment them as noop.
Start() chan bool
Stop() chan bool
Restart() chan bool
Status() *workerstatus.WorkerStatus
// This is for modules with isNetwork() == true. Controller calling this
// than wants to connect to some particular node in this network.
Connect(
address NetworkAddress,
) (*net.Conn, error)
ServeConn(
local bool,
calling_app_name string,
to_svc string,
who *Address,
conn net.Conn,
) error
// should return module's ui of some sort. If module has no window and it's
// HaveUI() result's to false, then GetUI() should return non-nil error
// stating so. anyway, DNet Implimenting Software should not allow user to
// call GetUI() if HaveUI() results to false
GetUI(interface{}) (interface{}, error)
GetInnodeRPC(calling_app_name string) (*rpc.Client, error)
}
type ApplicationModuleInstanceMap ¶
type ApplicationModuleInstanceMap map[string]ApplicationModuleInstance
type ApplicationModuleMap ¶
type ApplicationModuleMap map[string]ApplicationModule
type IncommingRPCHandler ¶
type IncommingRPCHandler struct{}
type ModuleChecksum ¶
type ModuleChecksum struct {
// contains filtered or unexported fields
}
func ModuleChecksumNewFromString ¶
func ModuleChecksumNewFromString(checksum string) (*ModuleChecksum, error)
func (*ModuleChecksum) Meth ¶
func (self *ModuleChecksum) Meth() string
func (*ModuleChecksum) String ¶
func (self *ModuleChecksum) String() string
func (*ModuleChecksum) Sum ¶
func (self *ModuleChecksum) Sum() string
func (*ModuleChecksum) Valid ¶
func (self *ModuleChecksum) Valid() bool
type ModuleName ¶
type ModuleName struct {
// contains filtered or unexported fields
}
func ModuleNameNew ¶
func ModuleNameNew(value string) (*ModuleName, error)
func ModuleNameNewF ¶
func ModuleNameNewF(value string) *ModuleName
func (*ModuleName) Value ¶
func (self *ModuleName) Value() string
type NetworkAddress ¶
type NetworkAddress string
func NetworkAddressNewFromString ¶
func NetworkAddressNewFromString(value string) NetworkAddress
func (NetworkAddress) String ¶
func (self NetworkAddress) String() string
Click to show internal directories.
Click to hide internal directories.