internal

package
v0.0.0-...-505be2e Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOnline

func GetOnline(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func GetOnlineDump

func GetOnlineDump(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func LoadConfig

func LoadConfig(path string) error

func RegistRoutes

func RegistRoutes(r *httprouter.Router)

func SetOnline

func SetOnline(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func SetupStater

func SetupStater() error

Types

type AppConfig

type AppConfig struct {
	Timeout int         `yaml:"timeout"`
	Redis   RedisConfig `yaml:"redis"`
}

type Config

type Config struct {
	Name   string               `yaml:"name"`
	Env    string               `yaml:"env"`
	Http   HttpConfig           `yaml:"http"`
	Driver string               `yaml:"driver"`
	Apps   map[string]AppConfig `yaml:"apps"`
}

func GetConfig

func GetConfig() *Config

type HttpConfig

type HttpConfig struct {
	Port int `yaml:"port"`
}

type MemCounter

type MemCounter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type MemStater

type MemStater struct {
	Apps map[string]*MemCounter
}

func (*MemStater) Dump

func (s *MemStater) Dump(app string) []string

func (*MemStater) Get

func (s *MemStater) Get(app string) int

func (*MemStater) Run

func (s *MemStater) Run() error

func (*MemStater) Set

func (s *MemStater) Set(app string, ip string) bool

type RedisConfig

type RedisConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Password string `yaml:"password"`
	Database int    `yaml:"database"`
}

type RedisStater

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

func (*RedisStater) Dump

func (s *RedisStater) Dump(app string) []string

func (*RedisStater) Get

func (s *RedisStater) Get(app string) int

func (*RedisStater) Run

func (s *RedisStater) Run() error

func (*RedisStater) Set

func (s *RedisStater) Set(app string, ip string) bool

type Stater

type Stater interface {
	Set(string, string) bool // set online
	Get(string) int          // get online counts
	Run() error              // start stater
	Dump(string) []string    // dump all ips
}
var (
	OnlineStater Stater
)

Jump to

Keyboard shortcuts

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