server

package
v0.0.0-...-506d704 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2017 License: Apache-2.0, Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "server",
	Short: "Run an Eth project server for receiving Ethereum block numbers.",
	Run: func(cmd *cobra.Command, args []string) {
		RunServer()
	},
	PreRunE: func(cmd *cobra.Command, args []string) error {
		if useRedis {
			if redisHost == "" {
				return fmt.Errorf("--use-redis called without --redis-host")
			}
			if redisPort <= 0 {
				return fmt.Errorf("--use-redis called without --redis-port")
			}
			if redisDb < 0 {
				return fmt.Errorf("--use-redis called without --redis-db")
			}
		}

		if useMySQL {
			if mySQLHost == "" {
				return fmt.Errorf("--use-mysql called without --mysql-host")
			}
			if mySQLUser == "" {
				return fmt.Errorf("--use-mysql called without --mysql-user")
			}
			if mySQLPass == "" {
				return fmt.Errorf("--use-mysql called without --mysql-pass")
			}
			if mySQLDb == "" {
				return fmt.Errorf("--use-mysql called without --mysql-db")
			}
		}

		return nil
	},
}

Cmd represents the server command

View Source
var RedisClientCountKey = "eth:ip_addresses"
View Source
var RedisHashTimestampKey = "eth:hashes"
View Source
var Timeout time.Duration = 1

Functions

func ClientProcessor

func ClientProcessor(conn net.Conn)

func MySQLProcessor

func MySQLProcessor()

func RedisProcessor

func RedisProcessor()

func RunServer

func RunServer()

Types

type EthereumData

type EthereumData struct {
	ID      uint   `gorm:"primary_key"`
	Hash    string `gorm:"size:64"`
	Payload string `sql:"type:text"`
}

func (EthereumData) TableName

func (EthereumData) TableName() string

type StatsData

type StatsData struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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