Documentation
¶
Index ¶
- Constants
- Variables
- func CheckConfig(isServer bool) (err error)
- func GetAPIPort() int
- func GetDataDir() string
- func GetIdentifier() string
- func GetReplaceIdentifier() string
- func HasAdmin() bool
- func IsAdmin(account string) bool
- func IsDcrmEnabled() bool
- func IsDcrmInitiator(account string) bool
- func IsSwapoutToStringAddress() bool
- func MustRegisterAccount() bool
- func SetConfig(config *ServerConfig)
- func SetDataDir(dir string)
- func VersionWithCommit(gitCommit, gitDate string) string
- type APIServerConfig
- type DcrmConfig
- type DcrmNodeConfig
- type ExtraConfig
- type MongoDBConfig
- type OracleConfig
- type ServerConfig
Constants ¶
const ( VersionMajor = 0 // Major version component of the current release VersionMinor = 3 // Minor version component of the current release VersionPatch = 8 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )
version parts
Variables ¶
var ( // IsSwapServer if true then it's swap server, otherwise it's swap oracle IsSwapServer bool // ServerAPIAddress server api address ServerAPIAddress string )
var Version = func() string { return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) }()
Version holds the textual version string.
var VersionWithMeta = func() string { v := Version if VersionMeta != "" { v += "-" + VersionMeta } return v }()
VersionWithMeta holds the textual version string including the metadata.
Functions ¶
func GetIdentifier ¶
func GetIdentifier() string
GetIdentifier get identifier (to distiguish in dcrm accept)
func GetReplaceIdentifier ¶ added in v0.3.7
func GetReplaceIdentifier() string
GetReplaceIdentifier get identifier (to distiguish in dcrm accept)
func IsDcrmEnabled ¶ added in v0.3.0
func IsDcrmEnabled() bool
IsDcrmEnabled is dcrm enabled (for dcrm sign)
func IsDcrmInitiator ¶ added in v0.3.0
IsDcrmInitiator is initiator of dcrm sign
func IsSwapoutToStringAddress ¶ added in v0.3.9
func IsSwapoutToStringAddress() bool
IsSwapoutToStringAddress swapout to string address (eg. btc)
func VersionWithCommit ¶
VersionWithCommit add git commit and data to version.
Types ¶
type APIServerConfig ¶
APIServerConfig api service config
type DcrmConfig ¶
type DcrmConfig struct {
Disable bool
GroupID *string
NeededOracles *uint32
TotalOracles *uint32
Mode uint32 // 0:managed 1:private (default 0)
Initiators []string
DefaultNode *DcrmNodeConfig
OtherNodes []*DcrmNodeConfig
}
DcrmConfig dcrm related config
func (*DcrmConfig) CheckConfig ¶
func (c *DcrmConfig) CheckConfig(isServer bool) (err error)
CheckConfig check dcrm config
type DcrmNodeConfig ¶ added in v0.3.0
type DcrmNodeConfig struct {
RPCAddress *string
SignGroups []string `toml:",omitempty" json:",omitempty"`
KeystoreFile *string `json:"-"`
PasswordFile *string `json:"-"`
}
DcrmNodeConfig dcrm node config
func (*DcrmNodeConfig) CheckConfig ¶ added in v0.3.0
func (c *DcrmNodeConfig) CheckConfig(isServer bool) (err error)
CheckConfig check dcrm node config
type ExtraConfig ¶ added in v0.3.4
type ExtraConfig struct {
MinReserveFee string
IsSwapoutToStringAddress bool `toml:",omitempty" json:",omitempty"`
}
ExtraConfig extra config
func GetExtraConfig ¶ added in v0.3.4
func GetExtraConfig() *ExtraConfig
GetExtraConfig get extra config
func (*ExtraConfig) CheckConfig ¶ added in v0.3.4
func (c *ExtraConfig) CheckConfig() (err error)
CheckConfig extra config
type MongoDBConfig ¶
type MongoDBConfig struct {
DBURL string
DBName string
UserName string `json:"-"`
Password string `json:"-"`
}
MongoDBConfig mongodb config
type OracleConfig ¶
type OracleConfig struct {
ServerAPIAddress string
}
OracleConfig oracle config
func (*OracleConfig) CheckConfig ¶
func (c *OracleConfig) CheckConfig() (err error)
CheckConfig check oracle config
type ServerConfig ¶
type ServerConfig struct {
Identifier string
MustRegisterAccount bool `toml:",omitempty" json:",omitempty"`
MongoDB *MongoDBConfig `toml:",omitempty" json:",omitempty"`
APIServer *APIServerConfig `toml:",omitempty" json:",omitempty"`
SrcChain *tokens.ChainConfig
SrcGateway *tokens.GatewayConfig
DestChain *tokens.ChainConfig
DestGateway *tokens.GatewayConfig
Dcrm *DcrmConfig `toml:",omitempty" json:",omitempty"`
Oracle *OracleConfig `toml:",omitempty" json:",omitempty"`
BtcExtra *tokens.BtcExtraConfig `toml:",omitempty" json:",omitempty"`
Extra *ExtraConfig `toml:",omitempty" json:",omitempty"`
Admins []string `toml:",omitempty" json:",omitempty"`
}
ServerConfig config items (decode from toml file)
func LoadConfig ¶
func LoadConfig(configFile string, isServer bool) *ServerConfig
LoadConfig load config