OSDN Git Service

config networkID
[bytom/vapor.git] / toolbar / precog / config / config.go
index 2defec0..753bac3 100644 (file)
@@ -5,8 +5,8 @@ import (
        "os"
 
        log "github.com/sirupsen/logrus"
+       "github.com/vapor/crypto/ed25519/chainkd"
 
-       vaporJson "github.com/vapor/encoding/json"
        "github.com/vapor/toolbar/common"
 )
 
@@ -32,3 +32,30 @@ func NewConfigWithPath(path string) *Config {
 
        return cfg
 }
+
+type Config struct {
+       NetworkID        uint64             `json:"network_id"`
+       MySQLConfig      common.MySQLConfig `json:"mysql"`
+       CheckFreqSeconds uint64             `json:"check_frequency_seconds"`
+       Policy           Policy             `json:"policy"`
+       Nodes            []Node             `json:"bootstrap_nodes"`
+       API              API                `json:"api"`
+}
+
+type Policy struct {
+       Confirmations      uint64 `json:"confirmations"`
+       RequiredLantencyMS uint64 `json:"required_lantency_ms"`
+}
+
+type Node struct {
+       Alias     string       `json:"alias"`
+       PublicKey chainkd.XPub `json:"public_key"`
+       Host      string       `json:"host"`
+       Port      uint16       `json:"port"`
+}
+
+type API struct {
+       ListeningPort bool   `json:"listening_port"`
+       AccessToken   string `json:"access_token"`
+       IsReleaseMode bool   `json:"is_release_mode"`
+}