svc

package
v1.2.21 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const GeoIPDBURL = "https://raw.githubusercontent.com/adysec/IP_database/main/geolite/GeoLite2-City.mmdb"

Variables

This section is empty.

Functions

func DownloadGeoIPDatabase added in v1.2.0

func DownloadGeoIPDatabase(url, path string) error

func NewAsynqClient

func NewAsynqClient(c config.Config) *asynq.Client

func NewDeviceManager

func NewDeviceManager(srv *ServiceContext) *device.DeviceManager

func NewLogger

func NewLogger(c config.Config) *logger.Logger

Types

type DeviceMessage

type DeviceMessage struct {
	Method DeviceMessageMethod `json:"method"`
}

func (*DeviceMessage) Json

func (dm *DeviceMessage) Json() string

type DeviceMessageMethod

type DeviceMessageMethod string
const (
	// DeviceKickedMax 设备数量超出限制
	DeviceKickedMax DeviceMessageMethod = "kicked_device"
	// DeviceKickedAdmin 管理员踢下线
	DeviceKickedAdmin DeviceMessageMethod = "kicked_admin"
	// SubscribeUpdate 订阅有更新
	SubscribeUpdate DeviceMessageMethod = "subscribe_update"
)

type IPLocation added in v1.2.0

type IPLocation struct {
	Path string
	DB   *geoip2.Reader
}

func NewIPLocation added in v1.2.0

func NewIPLocation(path string) (*IPLocation, error)

func (*IPLocation) Close added in v1.2.0

func (ipLoc *IPLocation) Close() error

type ServiceContext

type ServiceContext struct {
	Redis        *redis.Client
	Config       config.Config
	Queue        *asynq.Client
	ExchangeRate float64
	GeoIP        *IPLocation
	Store        repository.Store

	//NodeCache   *cache.NodeCacheClient
	Restart               func() error
	TelegramBot           *tgbotapi.BotAPI
	NodeMultiplierManager *nodeMultiplier.Manager
	AuthLimiter           *limit.PeriodLimit
	DeviceManager         *device.DeviceManager
}

func NewServiceContext

func NewServiceContext(c config.Config) *ServiceContext

func (ServiceContext) Validate

func (svc ServiceContext) Validate(dataStruct interface{}) error

Jump to

Keyboard shortcuts

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