svc

package
v1.15.18 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: GPL-3.0 Imports: 48 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) *asynqx.Client

NewAsynqClient returns the tracing asynq client: EnqueueContext stamps the caller's trace context onto the task for the worker-side middleware to resume. Pass task options to EnqueueContext, not NewTask — wrapping rebuilds the task.

func NewAsynqInspector added in v1.14.8

func NewAsynqInspector(c config.Config) *asynq.Inspector

func NewDeviceManager

func NewDeviceManager(srv *ServiceContext) *device.DeviceManager

func NewLogger

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

func NewStore added in v1.15.2

func NewStore(db *gorm.DB, rds *redis.Client) *repository.GormStore

NewStore assembles the shared store from the module-owned repo builders (falling back to the repository package's legacy builders for implementations that have not migrated yet). One connection pool, module- owned persistence (ADR-001 step-6 preparation).

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        *asynqx.Client
	Inspector    *asynq.Inspector
	ExchangeRate *exchangeRate.Cache
	GeoIP        *IPLocation
	Store        repository.Store

	// Domain modules (see docs/adr-001-modular-monolith.md). ServiceContext is
	// their composition root; handlers call the module facades.
	Support      support.Service
	Billing      billing.Service
	Platform     platform.Service
	Subscription subscription.Service
	Identity     identity.Service
	Network      network.Service
	Notification notification.Service
	EventBus     *eventbus.Bus

	//NodeCache   *cache.NodeCacheClient
	Restart func() error
	// ReinitSubsystem re-runs a subsystem's initialization after its
	// configuration changed; assigned by the transport server alongside
	// Restart (the initialize package cannot be imported here).
	ReinitSubsystem       func(subsystem string)
	TelegramBot           *tgbot.Bot
	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