svc

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeoIPDBURL    = "https://raw.githubusercontent.com/adysec/IP_database/main/geolite/GeoLite2-City.mmdb"
	GeoIPASNDBURL = "https://raw.githubusercontent.com/adysec/IP_database/main/geolite/GeoLite2-ASN.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 *Application) *device.DeviceManager

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 Application added in v1.19.0

type Application struct {
	Redis        *redis.Client
	Runtime      *appstate.State
	Queue        *asynqx.Client
	Inspector    *asynq.Inspector
	ExchangeRate *exchangeRate.Cache
	GeoIP        *IPLocation
	Store        repository.Store

	// Domain modules (see docs/adr-001-modular-monolith.md). Application 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
	AuthLimiter   *limit.PeriodLimit
	DeviceManager *device.DeviceManager
}

func NewApplication added in v1.19.0

func NewApplication(c config.Config) *Application

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
	ASNPath string
	ASNDB   *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

func (*IPLocation) Enrich added in v1.20.0

func (ipLoc *IPLocation) Enrich(metadata requestmeta.Metadata) requestmeta.Metadata

Enrich performs at most one City and one ASN lookup for a public client IP. MMDB lookup errors are treated as misses so request handling remains independent from optional risk metadata.

Jump to

Keyboard shortcuts

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