store

package
v0.0.0-...-4380537 Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteLocalRoute

func DeleteLocalRoute(db *sql.DB, lr *LocalRoute) error

func GetConnection

func GetConnection() (*sql.DB, error)

GetConnection used to get main DB connection.

func GetFileDB

func GetFileDB() string

func GetFileDBConn

func GetFileDBConn() (*sql.DB, error)

func InitBackend

func InitBackend(db *sql.DB) error

func InitDB

func InitDB(db *sql.DB, dName string) error

InitDB - initialize the DB connection string

func InitFrontend

func InitFrontend(db *sql.DB) error

func InitLocalRoute

func InitLocalRoute(db *sql.DB) error

func InitTargetLists

func InitTargetLists(db *sql.DB, dName string) error

func InitTargets

func InitTargets(db *sql.DB) error

func LoadConfigFromDisk

func LoadConfigFromDisk(db *sql.DB) error

func MoveConfigToDisk

func MoveConfigToDisk(db *sql.DB) error

func WriteBackend

func WriteBackend(db *sql.DB, be *Backend) error

func WriteFrontend

func WriteFrontend(db *sql.DB, fe *Frontend) error

func WriteLocalRoute

func WriteLocalRoute(db *sql.DB, lr *LocalRoute) error

func WriteTargetLists

func WriteTargetLists(db *sql.DB, t *TargetLists) error

func WriteTargets

func WriteTargets(db *sql.DB, t *Targets) error

Types

type Backend

type Backend struct {
	GroupId       int
	Host          string // IP:Port format
	CheckURL      *string
	CheckInterval int
	Weight        int
	Status        ProxyStatus
	MaxRequests   int
}

func ReadAllBackends

func ReadAllBackends(db *sql.DB) ([]Backend, error)

ReadAllBackends used to read all the backends from given DB

func ReadBackends

func ReadBackends(db *sql.DB, gID int) ([]Backend, error)

ReadBackends used to read all the backends from given frontend id

type Frontend

type Frontend struct {
	Id         int
	ListenAddr net.IP
	Port       int
	Balance    RouteType
	Type       ProxyType
}

func ReadFrontends

func ReadFrontends(db *sql.DB) ([]Frontend, error)

ReadFrontends used to read all the front ends from given DB

type LRStatus

type LRStatus string
const (
	LRStOnline  LRStatus = "ONLINE"
	LRStShunned LRStatus = "SHUNNED"
)

type LocalRoute

type LocalRoute struct {
	Interface     string
	IP            net.IP
	Gateway       net.IP
	CheckURL      *string
	CheckInterval int
	Weight        int
	Status        LRStatus
}

func ReadLocalRoutes

func ReadLocalRoutes(db *sql.DB) ([]LocalRoute, error)

type ProxyStatus

type ProxyStatus string
const (
	PrStOnline  ProxyStatus = "ONLINE"
	PrStShunned ProxyStatus = "SHUNNED"
	PrStOffline ProxyStatus = "OFFLINE"
)

type ProxyType

type ProxyType string
const (
	PrTypeForward ProxyType = "FORWARD"
	PrTypeReverse ProxyType = "REVERSE"
)

type RouteType

type RouteType string
const (
	WEIGHT RouteType = "WEIGHT"
	BEST   RouteType = "BEST"
)

type TargetBalanceType

type TargetBalanceType string
const (
	TBT_BEST TargetBalanceType = "BEST"
	TBT_RR   TargetBalanceType = "RR"
)

type TargetLists

type TargetLists struct {
	Hostname string
	IP       net.IP
	Score    int
}

type Targets

type Targets struct {
	Hostname      string
	CheckURL      *string
	CheckInterval int
	Balance       TargetBalanceType
}

Jump to

Keyboard shortcuts

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