config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNodeContractAddr = "0xbaEEB7a3AF34a365ACAa1f8464A3374B58ac9889"

DefaultNodeContractAddr ...

View Source
var DefaultTokenContractAddr = "0x9064322CfeE623A447ba5aF0dA6AD3341c073535"

DefaultTokenContractAddr ...

View Source
var WorkDir = ""

WorkDir ...

Functions

func DataDirCache

func DataDirCache() string

DataDirCache ...

func DataDirETH

func DataDirETH() string

DataDirETH ...

func DataDirIPFS

func DataDirIPFS() string

DataDirIPFS ...

func ETHAddr

func ETHAddr() string

ETHAddr ...

func IPFSAPIAddr

func IPFSAPIAddr() string

IPFSAPIAddr ...

func IPFSAPIURL

func IPFSAPIURL() string

IPFSAPIURL ...

func IPFSGatewayURL

func IPFSGatewayURL() string

IPFSGatewayURL ...

func Initialize

func Initialize()

Initialize ...

func KeyDir

func KeyDir() string

KeyDir ...

func KeyStoreDirETH

func KeyStoreDirETH() string

KeyStoreDirETH ...

func LoadConfig

func LoadConfig() error

LoadConfig ...

func RPCAddr

func RPCAddr() string

RPCAddr ...

func SaveConfig

func SaveConfig(config *Config) error

SaveConfig ...

func SaveGenesis

func SaveGenesis(cfg *Config) (err error)

SaveGenesis write genesis file when the file is not exist

Types

type API

type API struct {
	HTTPHeaders APIHTTPHeaders `json:"HTTPHeaders"`
}

API ...

type APIConfig

type APIConfig struct {
	Port        int               `json:"port" mapstructure:"port"`
	Version     string            `json:"version" mapstructure:"version"`
	UseTLS      bool              `json:"use_tls" mapstructure:"use_tls"`
	TLS         TLSCertificate    `json:"tls" mapstructure:"tls"`
	Certificate []tls.Certificate `json:"certificate" mapstructure:"certificate"`
	Timeout     time.Duration     `json:"timeout" mapstructure:"timeout"`
}

APIConfig ...

type APIHTTPHeaders

type APIHTTPHeaders struct {
}

APIHTTPHeaders ...

type AWSConfig

type AWSConfig struct {
	HostedZoneID       string `json:"hosted_zone_id" mapstructure:"hosted_zone_id"`
	RecordName         string `json:"record_name" mapstructure:"record_name"`
	AwsAccessKeyID     string `json:"aws_access_key_id" mapstructure:"aws_access_key_id"`
	AwsSecretAccessKey string `json:"aws_secret_access_key" mapstructure:"aws_secret_access_key"`
}

AWSConfig ...

type Addresses

type Addresses struct {
	API        string        `json:"API"`
	Announce   []interface{} `json:"Announce"`
	Gateway    string        `json:"Gateway"`
	NoAnnounce []interface{} `json:"NoAnnounce"`
	Swarm      []string      `json:"Swarm"`
}

Addresses ...

type Alloc

type Alloc struct {
	Balance string `json:"balance"`
}

Alloc ...

type Child

type Child struct {
	Path       string `json:"path"`
	SyncWrites bool   `json:"syncWrites"`
	Truncate   bool   `json:"truncate"`
	Type       string `json:"type"`
}

Child ...

type Clique

type Clique struct {
	Period int64 `json:"period"`
	Epoch  int64 `json:"epoch"`
}

Clique ...

type Config

type Config struct {
	Node       NodeConfig     `json:"node" mapstructure:"node"`
	API        APIConfig      `json:"api" mapstructure:"api"`
	UseTLS     bool           `json:"use_tls" mapstructure:"use_tls"`
	TLS        TLSCertificate `json:"tls" mapstructure:"tls"`
	Schema     string         `json:"schema" mapstructure:"schema"`
	Path       string         `json:"path" mapstructure:"path" `
	Account    string         `json:"account" mapstructure:"account"`
	Identity   string         `json:"identity" mapstructure:"identity"`
	PrivateKey string         `json:"private_key" mapstructure:"private_key"`
	ETH        ETHConfig      `json:"eth" mapstructure:"eth"`
	IPFS       IPFSConfig     `json:"ipfs" mapstructure:"ipfs"`
	AWS        AWSConfig      `json:"aws" mapstructure:"aws"`
	Interval   int64          `json:"interval" mapstructure:"interval"`
	NodeType   int            `json:"node_type" mapstructure:"node_type"`
	Limit      int64          `json:"limit" mapstructure:"limit"`
	Debug      bool           `json:"debug" mapstructure:"debug"`
	BootNode   []string       `json:"boot_node" mapstructure:"boot_node"`
}

Config ...

func Default

func Default() *Config

Default ...

func Global

func Global() Config

Global ...

func (Config) IPFSAPIAddr

func (c Config) IPFSAPIAddr() string

IPFSAPIAddr ...

func (*Config) Init

func (c *Config) Init() error

Init ...

type ConnMgr

type ConnMgr struct {
	GracePeriod string `json:"GracePeriod"`
	HighWater   int64  `json:"HighWater"`
	LowWater    int64  `json:"LowWater"`
	Type        string `json:"Type"`
}

ConnMgr ...

type Datastore

type Datastore struct {
	BloomFilterSize    int64  `json:"BloomFilterSize"`
	GCPeriod           string `json:"GCPeriod"`
	HashOnRead         bool   `json:"HashOnRead"`
	Spec               Spec   `json:"Spec"`
	StorageGCWatermark int64  `json:"StorageGCWatermark"`
	StorageMax         string `json:"StorageMax"`
}

Datastore ...

type Discovery

type Discovery struct {
	Mdns Mdns `json:"MDNS"`
}

Discovery ...

type ETHConfig

type ETHConfig struct {
	Enable      bool   `json:"enable" mapstructure:"enable"`
	LogOutput   bool   `json:"log_output" mapstructure:"log_output"` //output log to screen
	Name        string `json:"name" mapstructure:"name"`             //bin name
	Port        int    `json:"port" mapstructure:"port"`
	NodeAddr    string `json:"node_addr" mapstructure:"node_addr"`       //node contract address
	TokenAddr   string `json:"token_addr" mapstructure:"token_addr"`     //token contract address
	MessageAddr string `json:"message_addr" mapstructure:"message_addr"` //dmessage contract address
	DTagAddr    string `json:"dtag_addr" mapstructure:"dtag_addr"`       //dtag contract address
}

ETHConfig ...

type ETHKeyFile

type ETHKeyFile struct {
	Name string `json:"name" mapstructure:"name"`
	Pass string `json:"pass" mapstructure:"pass"`
}

ETHKeyFile ...

type Experimental

type Experimental struct {
	FilestoreEnabled     bool `json:"FilestoreEnabled"`
	Libp2PStreamMounting bool `json:"Libp2pStreamMounting"`
	P2PHTTPProxy         bool `json:"P2pHttpProxy"`
	PreferTLS            bool `json:"PreferTLS"`
	Quic                 bool `json:"QUIC"`
	ShardingEnabled      bool `json:"ShardingEnabled"`
	UrlstoreEnabled      bool `json:"UrlstoreEnabled"`
}

Experimental ...

type Gateway

type Gateway struct {
	APICommands  []interface{}      `json:"APICommands"`
	HTTPHeaders  GatewayHTTPHeaders `json:"HTTPHeaders"`
	NoFetch      bool               `json:"NoFetch"`
	PathPrefixes []interface{}      `json:"PathPrefixes"`
	RootRedirect string             `json:"RootRedirect"`
	Writable     bool               `json:"Writable"`
}

Gateway ...

type GatewayHTTPHeaders

type GatewayHTTPHeaders struct {
	AccessControlAllowHeaders []string `json:"Access-Control-Allow-Headers"`
	AccessControlAllowMethods []string `json:"Access-Control-Allow-Methods"`
	AccessControlAllowOrigin  []string `json:"Access-Control-Allow-Origin"`
}

GatewayHTTPHeaders ...

type Genesis

type Genesis struct {
	Config     GenesisConfig    `json:"config"`
	Nonce      string           `json:"nonce"`
	Timestamp  string           `json:"timestamp"`
	ExtraData  string           `json:"extraData"`
	GasLimit   string           `json:"gasLimit"`
	Difficulty string           `json:"difficulty"`
	MixHash    string           `json:"mixHash"`
	Coinbase   string           `json:"coinbase"`
	Alloc      map[string]Alloc `json:"alloc"`
	Number     string           `json:"number"`
	GasUsed    string           `json:"gasUsed"`
	ParentHash string           `json:"parentHash"`
}

Genesis ...

func LoadGenesis

func LoadGenesis(cfg *Config) (*Genesis, error)

LoadGenesis ...

type GenesisConfig

type GenesisConfig struct {
	ChainID             int64  `json:"chainId"`
	HomesteadBlock      int64  `json:"homesteadBlock"`
	Eip150Block         int64  `json:"eip150Block"`
	Eip150Hash          string `json:"eip150Hash"`
	Eip155Block         int64  `json:"eip155Block"`
	Eip158Block         int64  `json:"eip158Block"`
	ByzantiumBlock      int64  `json:"byzantiumBlock"`
	ConstantinopleBlock int64  `json:"constantinopleBlock"`
	Clique              Clique `json:"clique"`
}

GenesisConfig ...

type HashConfig

type HashConfig struct {
	Path string `json:"path" mapstructure:"path"`
}

HashConfig ...

type IPFSConfig

type IPFSConfig struct {
	Enable    bool   `json:"enable" mapstructure:"enable"`
	LogOutput bool   `json:"log_output" mapstructure:"log_output"` //output log to screen
	Name      string `json:"name" mapstructure:"name"`
	API       int    `json:"api" mapstructure:"api"`
	Gateway   int    `json:"gateway" mapstructure:"gateway"`
	Timeout   int    `json:"timeout" mapstructure:"timeout"`
}

IPFSConfig ...

type IPFSServerConfig

type IPFSServerConfig struct {
	API          API          `json:"API"`
	Addresses    Addresses    `json:"Addresses"`
	Bootstrap    []string     `json:"Bootstrap"`
	Datastore    Datastore    `json:"Datastore"`
	Discovery    Discovery    `json:"Discovery"`
	Experimental Experimental `json:"Experimental"`
	Gateway      Gateway      `json:"Gateway"`
	Identity     Identity     `json:"Identity"`
	Ipns         Ipns         `json:"Ipns"`
	Mounts       Mounts       `json:"Mounts"`
	Pubsub       Pubsub       `json:"Pubsub"`
	Reprovider   Reprovider   `json:"Reprovider"`
	Routing      Routing      `json:"Routing"`
	Swarm        Swarm        `json:"Swarm"`
}

IPFSServerConfig ...

func LoadIPFSServerConfig

func LoadIPFSServerConfig(cfg *Config) (*IPFSServerConfig, error)

LoadIPFSServerConfig ...

type Identity

type Identity struct {
	PeerID  string `json:"PeerID"`
	PrivKey string `json:"PrivKey"`
}

Identity ...

type Ipns

type Ipns struct {
	RecordLifetime   string `json:"RecordLifetime"`
	RepublishPeriod  string `json:"RepublishPeriod"`
	ResolveCacheSize int64  `json:"ResolveCacheSize"`
}

Ipns ...

type Mdns

type Mdns struct {
	Enabled  bool  `json:"Enabled"`
	Interval int64 `json:"Interval"`
}

Mdns ...

type Mounts

type Mounts struct {
	FuseAllowOther bool   `json:"FuseAllowOther"`
	Ipfs           string `json:"IPFS"`
	Ipns           string `json:"IPNS"`
}

Mounts ...

type NodeConfig

type NodeConfig struct {
	Port          int           `json:"port" mapstructure:"port"`
	BindPort      int           `json:"bind_port" mapstructure:"bind_port"`
	BackupSeconds time.Duration `json:"backup_seconds" mapstructure:"backup_seconds"`
	ConnectMax    int           `json:"connect_max"  mapstructure:"connect_max"`
	PoolMax       int           `json:"pool_max"  mapstructure:"pool_max"`
}

NodeConfig ...

type Pubsub

type Pubsub struct {
	DisableSigning              bool   `json:"DisableSigning"`
	Router                      string `json:"Router"`
	StrictSignatureVerification bool   `json:"StrictSignatureVerification"`
}

Pubsub ...

type Reprovider

type Reprovider struct {
	Interval string `json:"Interval"`
	Strategy string `json:"Strategy"`
}

Reprovider ...

type Routing

type Routing struct {
	Type string `json:"Type"`
}

Routing ...

type Spec

type Spec struct {
	Child  Child  `json:"child"`
	Prefix string `json:"prefix"`
	Type   string `json:"type"`
}

Spec ...

type Swarm

type Swarm struct {
	AddrFilters             interface{} `json:"AddrFilters"`
	ConnMgr                 ConnMgr     `json:"ConnMgr"`
	DisableBandwidthMetrics bool        `json:"DisableBandwidthMetrics"`
	DisableNatPortMap       bool        `json:"DisableNatPortMap"`
	DisableRelay            bool        `json:"DisableRelay"`
	EnableAutoNATService    bool        `json:"EnableAutoNATService"`
	EnableAutoRelay         bool        `json:"EnableAutoRelay"`
	EnableRelayHop          bool        `json:"EnableRelayHop"`
}

Swarm ...

type TLSCertificate

type TLSCertificate struct {
	KeyFile     string `json:"key_file" mapstructure:"key_file"`
	KeyPassFile string `json:"key_pass_file" mapstructure:"key_pass_file"`
}

TLSCertificate ...

Jump to

Keyboard shortcuts

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