params

package
v0.0.0-...-14f7c6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package params provides common version info and config items.

Index

Constants

View Source
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

View Source
var (

	// IsSwapServer if true then it's swap server, otherwise it's swap oracle
	IsSwapServer bool

	// ServerAPIAddress server api address
	ServerAPIAddress string
)
View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()

Version holds the textual version string.

View Source
var VersionWithMeta = func() string {
	v := Version
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

VersionWithMeta holds the textual version string including the metadata.

Functions

func CheckConfig

func CheckConfig(isServer bool) (err error)

CheckConfig check config

func EnableCheckBlockFork

func EnableCheckBlockFork() bool

EnableCheckBlockFork enable check block fork

func GetAPIPort

func GetAPIPort() int

GetAPIPort get api service port

func GetDataDir

func GetDataDir() string

GetDataDir get data dir

func GetIdentifier

func GetIdentifier() string

GetIdentifier get identifier (to distiguish in dcrm accept)

func GetReplaceIdentifier

func GetReplaceIdentifier() string

GetReplaceIdentifier get identifier (to distiguish in dcrm accept)

func HasAdmin

func HasAdmin() bool

HasAdmin has admin

func IsAdmin

func IsAdmin(account string) bool

IsAdmin is admin

func IsDcrmEnabled

func IsDcrmEnabled() bool

IsDcrmEnabled is dcrm enabled (for dcrm sign)

func IsDcrmInitiator

func IsDcrmInitiator(account string) bool

IsDcrmInitiator is initiator of dcrm sign

func IsDebugMode

func IsDebugMode() bool

IsDebugMode is debug mode, add more debugging log infos

func IsNullSwapoutNativeMemo

func IsNullSwapoutNativeMemo() bool

IsNullSwapoutNativeMemo set no unlock memo in building swapout tx

func IsSwapoutToStringAddress

func IsSwapoutToStringAddress() bool

IsSwapoutToStringAddress swapout to string address (eg. btc)

func MustRegisterAccount

func MustRegisterAccount() bool

MustRegisterAccount flag

func SetConfig

func SetConfig(config *BridgeConfig)

SetConfig set bridge config

func SetDataDir

func SetDataDir(dir string)

SetDataDir set data dir

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

VersionWithCommit add git commit and data to version.

Types

type APIServerConfig

type APIServerConfig struct {
	Port           int
	AllowedOrigins []string
}

APIServerConfig api service config

type BridgeConfig

type BridgeConfig struct {
	Identifier  string
	SrcChain    *tokens.ChainConfig
	SrcGateway  *tokens.GatewayConfig
	DestChain   *tokens.ChainConfig
	DestGateway *tokens.GatewayConfig
	Server      *ServerConfig          `toml:",omitempty" json:",omitempty"`
	Oracle      *OracleConfig          `toml:",omitempty" json:",omitempty"`
	BtcExtra    *tokens.BtcExtraConfig `toml:",omitempty" json:",omitempty"`
	Extra       *ExtraConfig           `toml:",omitempty" json:",omitempty"`
	Dcrm        *DcrmConfig            `toml:",omitempty" json:",omitempty"`
}

BridgeConfig config items (decode from toml file)

func GetConfig

func GetConfig() *BridgeConfig

GetConfig get bridge config

func LoadConfig

func LoadConfig(configFile string, isServer bool) *BridgeConfig

LoadConfig load config

type DcrmConfig

type DcrmConfig struct {
	Disable       bool
	APIPrefix     string
	RPCTimeout    uint64
	SignTimeout   uint64
	GroupID       *string
	NeededOracles *uint32
	TotalOracles  *uint32
	Mode          uint32 // 0:managed 1:private (default 0)
	Initiators    []string
	DefaultNode   *DcrmNodeConfig
	OtherNodes    []*DcrmNodeConfig `toml:",omitempty" json:",omitempty"`
}

DcrmConfig dcrm related config

func (*DcrmConfig) CheckConfig

func (c *DcrmConfig) CheckConfig(isServer bool) (err error)

CheckConfig check dcrm config

type DcrmNodeConfig

type DcrmNodeConfig struct {
	RPCAddress   *string
	SignGroups   []string `toml:",omitempty" json:",omitempty"`
	KeystoreFile *string  `json:"-"`
	PasswordFile *string  `json:"-"`
}

DcrmNodeConfig dcrm node config

func (*DcrmNodeConfig) CheckConfig

func (c *DcrmNodeConfig) CheckConfig(isServer bool) (err error)

CheckConfig check dcrm node config

type ExtraConfig

type ExtraConfig struct {
	IsDebugMode              bool `toml:",omitempty" json:",omitempty"`
	MustRegisterAccount      bool
	IsSwapoutToStringAddress bool `toml:",omitempty" json:",omitempty"`
	EnableCheckBlockFork     bool
	IsNullSwapoutNativeMemo  bool `toml:",omitempty" json:",omitempty"`
}

ExtraConfig extra config

func GetExtraConfig

func GetExtraConfig() *ExtraConfig

GetExtraConfig get extra config

func (*ExtraConfig) CheckConfig

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
	GetAcceptListInterval uint64
}

OracleConfig oracle config

func GetOracleConfig

func GetOracleConfig() *OracleConfig

GetOracleConfig get oracle config

func (*OracleConfig) CheckConfig

func (c *OracleConfig) CheckConfig(enableScan bool) (err error)

CheckConfig check oracle config

type ServerConfig

type ServerConfig struct {
	MongoDB   *MongoDBConfig   `toml:",omitempty" json:",omitempty"`
	APIServer *APIServerConfig `toml:",omitempty" json:",omitempty"`
	Admins    []string         `toml:",omitempty" json:",omitempty"`
}

ServerConfig swap server config

func GetServerConfig

func GetServerConfig() *ServerConfig

GetServerConfig get server config

func (*ServerConfig) CheckConfig

func (c *ServerConfig) CheckConfig() error

CheckConfig check swap server config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL