domain

package
v0.0.0-...-01d145f Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Types

type ClientContext

type ClientContext struct {
	IP string `json:"ip"`
}

type Dispatcher

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

type EndPoint

type EndPoint struct {
	IP          string  `json:"ip"`
	Port        string  `json:"port"`
	ActiveScore float64 `json:"-"`
	StaticScore float64 `json:"-"`
	Stats       *Stat   `json:"-"`
	// contains filtered or unexported fields
}

func Dispatch

func Dispatch(ctx *IpConfigContext) []*EndPoint

func NewEndPoint

func NewEndPoint(ip, port string) *EndPoint

func (*EndPoint) CalculateScore

func (ed *EndPoint) CalculateScore(ctx *IpConfigContext)

func (*EndPoint) UpdateStat

func (ed *EndPoint) UpdateStat(s *Stat)

type IpConfigContext

type IpConfigContext struct {
	Ctx       *context.Context
	AppCtx    *app.RequestContext
	ClientCtx *ClientContext
}

func BuildIpConfigContext

func BuildIpConfigContext(c *context.Context, ctx *app.RequestContext) *IpConfigContext

type Stat

type Stat struct {
	ConnectNum   float64
	MessageBytes float64
}

func (*Stat) Add

func (s *Stat) Add(st *Stat)

func (*Stat) Avg

func (s *Stat) Avg(num float64)

func (*Stat) CalculateActiveScore

func (s *Stat) CalculateActiveScore() float64

func (*Stat) CalculateStaticScore

func (s *Stat) CalculateStaticScore() float64

func (*Stat) Clone

func (s *Stat) Clone() *Stat

func (*Stat) Sub

func (s *Stat) Sub(st *Stat)

Jump to

Keyboard shortcuts

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