Documentation
¶
Index ¶
- Constants
- func DownloadGeoIPDatabase(url, path string) error
- func NewAsynqClient(c config.Config) *asynq.Client
- func NewDeviceManager(srv *ServiceContext) *device.DeviceManager
- func NewLogger(c config.Config) *logger.Logger
- type DeviceMessage
- type DeviceMessageMethod
- type IPLocation
- type ServiceContext
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 NewDeviceManager ¶
func NewDeviceManager(srv *ServiceContext) *device.DeviceManager
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
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
Click to show internal directories.
Click to hide internal directories.