Files
gocryptotrader/communications/base/base.go
Adrian Gallagher 2078ba907f Update URLs for transfer into org repo (#338)
* Update URLs for transfer into org repo

* Update codecov, travis and othe remaining links

* Update appveyor paths
2019-08-09 11:50:39 +10:00

55 lines
1.1 KiB
Go

package base
import (
"time"
)
// global vars contain staged update data that will be sent to the communication
// mediums
var (
ServiceStarted time.Time
)
// Base enforces standard variables across communication packages
type Base struct {
Name string
Enabled bool
Verbose bool
Connected bool
}
// Event is a generalise event type
type Event struct {
Type string
Message string
}
// CommsStatus stores the status of a comms relayer
type CommsStatus struct {
Enabled bool `json:"enabled"`
Connected bool `json:"connected"`
}
// IsEnabled returns if the comms package has been enabled in the configuration
func (b *Base) IsEnabled() bool {
return b.Enabled
}
// IsConnected returns if the package is connected to a server and/or ready to
// send
func (b *Base) IsConnected() bool {
return b.Connected
}
// GetName returns a package name
func (b *Base) GetName() string {
return b.Name
}
// GetStatus returns status data
func (b *Base) GetStatus() string {
return `
GoCryptoTrader Service: Online
Service Started: ` + ServiceStarted.String()
}