app

package
v8.0.8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigSystemTitle         = "SystemTitle"
	ConfigSystemTheme         = "SystemTheme"
	ConfigSystemLoginRemark   = "SystemLoginRemark"
	ConfigSystemLoginSubtitle = "SystemLoginSubtitle"

	ConfigRadiusIgnorePwd             = "RadiusIgnorePwd"
	ConfigRadiusAccountingHistoryDays = "AccountingHistoryDays"
	ConfigRadiusAcctInterimInterval   = "AcctInterimInterval"
	ConfigRadiusEapMethod             = "RadiusEapMethod"

	ConfigTR069AccessAddress           = "TR069AccessAddress"
	ConfigTR069AccessPassword          = "TR069AccessPassword"
	ConfigCpeConnectionRequestPassword = "CpeConnectionRequestPassword"
	ConfigCpeAutoRegister              = "CpeAutoRegister"
)
View Source
const (
	RadiusVendorMikrotik = "14988"
	RadiusVendorIkuai    = "10055"
	RadiusVendorHuawei   = "2011"
	RadiusVendorZte      = "3902"
	RadiusVendorH3c      = "25506"
	RadiusVendorRadback  = "2352"
	RadiusVendorCisco    = "9"
	RadiusVendorStandard = "0"
)
View Source
const (
	BootStrapEvent string = "bootstrap"
	BootEvent      string = "boot"
	PeriodicEvent  string = "periodic"
	ScheduledEvent string = "scheduled"
)
View Source
const (
	TransLateSettings = "settings"
	ZhCN              = "zh_CN"
	EnUS              = "en_US"
)
View Source
const (
	MetricsRadiusOline              = "radus_online"
	MetricsRadiusOffline            = "radus_offline"
	MetricsRadiusRejectNotExists    = "radus_reject_not_exists"
	MetricsRadiusRejectDisable      = "radus_reject_disabled"
	MetricsRadiusRejectExpire       = "radus_reject_expire"
	MetricsRadiusRejectOther        = "radus_reject_other"
	MetricsRadiusRejectLimit        = "radus_reject_limit"
	MetricsRadiusRejectBindError    = "radus_reject_bind_error"
	MetricsRadiusRejectLdapError    = "radus_reject_ldap_error"
	MetricsRadiusRejectPasswdError  = "radus_reject_passwd_error"
	MetricsRadiusRejectUnauthorized = "radus_reject_unauthorized"
	MetricsRadiusAuthDrop           = "radus_auth_drop"
	MetricsRadiusAcctDrop           = "radus_acct_drop"
	MetricsRadiusAccept             = "radus_accept"
	MetricsRadiusAccounting         = "radus_accounting"
)
View Source
const (
	MetricsTr069MessageTotal = "tr069_message_total"
	MetricsTr069Inform       = "tr069_inform"
	MetricsTr069Download     = "tr069_download"
)
View Source
const (
	AutoRegisterPopNodeId int64 = 999999999
)

Variables

Functions

func CreateCwmpScheduledTask

func CreateCwmpScheduledTask(schedPolicy string) (err error)

CreateCwmpScheduledTask 系统 定时任务, 由系统触发

func GConfig

func GConfig() *config.AppConfig

func GDB

func GDB() *gorm.DB

func GetAllRadiusMetrics

func GetAllRadiusMetrics() map[string]int64

func GetAllTr069Metrics

func GetAllTr069Metrics() map[string]int64

func GetH24Metrics

func GetH24Metrics(name string) int64

func GetRadiusMetrics

func GetRadiusMetrics(name string) int64

func GetSystemMetrics

func GetSystemMetrics() map[string]int64

func InitGlobalApplication

func InitGlobalApplication(cfg *config.AppConfig)

func MatchDevice

func MatchDevice(c models.NetCpe, oui, productClass, softwareVersion string) bool

func MatchTaskTags

func MatchTaskTags(cpeTaskTags, configTaskTags string) bool

func Release

func Release()

func Trans

func Trans(module, src string) string

func UpdateCwmpConfigSessionStatus

func UpdateCwmpConfigSessionStatus(tc *cwmp.TransferComplete) (err error)

UpdateCwmpConfigSessionStatus Update script task status

func UpdateCwmpPresetTaskStatus

func UpdateCwmpPresetTaskStatus(msg cwmp.Message) (err error)

UpdateCwmpPresetTaskStatus Update cwmp preset task status

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

func GApp

func GApp() *Application

func NewApplication

func NewApplication(appConfig *config.AppConfig) *Application

func (*Application) BackupDatabase

func (a *Application) BackupDatabase() error

BackupDatabase Backup database

func (*Application) Config

func (a *Application) Config() *config.AppConfig

func (*Application) CreateCwmpPresetTaskById

func (a *Application) CreateCwmpPresetTaskById(pid string, snlist []string) (err error)

CreateCwmpPresetTaskById Manually trigger tasks

func (*Application) CwmpTable

func (a *Application) CwmpTable() *CwmpEventTable

func (*Application) DB

func (a *Application) DB() *gorm.DB

func (*Application) DropAll

func (a *Application) DropAll()

func (*Application) GetCacrtContent

func (a *Application) GetCacrtContent() string

func (*Application) GetRadiusSettingsStringValue

func (a *Application) GetRadiusSettingsStringValue(name string) string

func (*Application) GetSettingsInt64Value

func (a *Application) GetSettingsInt64Value(stype string, name string) int64

func (*Application) GetSettingsStringValue

func (a *Application) GetSettingsStringValue(stype string, name string) string

GetSettingsStringValue Get settings string value

func (*Application) GetSystemSettingsStringValue

func (a *Application) GetSystemSettingsStringValue(name string) string

func (*Application) GetSystemTheme

func (a *Application) GetSystemTheme() string

func (*Application) GetTemplateFuncMap

func (a *Application) GetTemplateFuncMap() map[string]interface{}

func (*Application) GetTr069SettingsStringValue

func (a *Application) GetTr069SettingsStringValue(name string) string

GetTr069SettingsStringValue Get tr069 settings string value

func (*Application) GetTranslateLang

func (a *Application) GetTranslateLang() string

func (*Application) Init

func (a *Application) Init(cfg *config.AppConfig)

func (*Application) InitDb

func (a *Application) InitDb()

func (*Application) InitTest

func (a *Application) InitTest()

func (*Application) InjectCwmpConfigVars

func (a *Application) InjectCwmpConfigVars(sn string, src string, extvars map[string]string) string

func (*Application) ListTranslateTable added in v8.0.5

func (a *Application) ListTranslateTable(lang string) []TransTable

func (*Application) LoadTranslateDict

func (a *Application) LoadTranslateDict(lang string) map[string]map[string]string

func (*Application) MigrateDB

func (a *Application) MigrateDB(track bool) (err error)

func (*Application) QueryTranslateTable

func (a *Application) QueryTranslateTable(lang string, module, keyword string) []TransTable

func (*Application) RemoveTranslateItems

func (a *Application) RemoveTranslateItems(items []TransTable)

func (*Application) RenderTranslateFiles

func (a *Application) RenderTranslateFiles()

func (*Application) SchedClearExpireData

func (a *Application) SchedClearExpireData()

func (*Application) SchedProcessMonitorTask

func (a *Application) SchedProcessMonitorTask()

SchedProcessMonitorTask app process monitor

func (*Application) SchedSystemMonitorTask

func (a *Application) SchedSystemMonitorTask()

SchedSystemMonitorTask system monitor

func (*Application) SchedUpdateBatchCwmpStatus

func (a *Application) SchedUpdateBatchCwmpStatus()

func (*Application) SetSystemTheme

func (a *Application) SetSystemTheme(value string)

func (*Application) SetTranslateLang

func (a *Application) SetTranslateLang(lang string)

func (*Application) TransDB

func (a *Application) TransDB() (*bolt.DB, error)

func (*Application) Translate

func (a *Application) Translate(lang, module, src, defValue string) string

func (*Application) TranslateUpdate

func (a *Application) TranslateUpdate(lang, module, src, value string) string

func (*Application) UpdateCwmpCpeRundata

func (a *Application) UpdateCwmpCpeRundata(sn string, vmap map[string]string)

type CwmpCpe

type CwmpCpe struct {
	Sn  string `json:"sn"`
	OUI string `json:"oui"`

	SoftwareVersion string `json:"software_version"`
	Manufacturer    string `json:"manufacturer"`
	ProductClass    string `json:"product_class"`

	LastInform     *cwmp.Inform `json:"latest_message"`
	LastUpdate     time.Time    `json:"last_update"`
	LastDataNotify time.Time    `json:"last_data_notify"`
	IsRegister     bool         `json:"is_register"`
	// contains filtered or unexported fields
}

func GetCwmpCpe

func GetCwmpCpe(key string) *CwmpCpe

func (*CwmpCpe) ActiveCwmpSchedEventTask

func (c *CwmpCpe) ActiveCwmpSchedEventTask() (err error)

func (*CwmpCpe) CheckRegister

func (c *CwmpCpe) CheckRegister(ip string, msg *cwmp.Inform)

CheckRegister 检查设备注册情况

func (*CwmpCpe) CreateCwmpPresetEventTask

func (c *CwmpCpe) CreateCwmpPresetEventTask(event string, pid string) (err error)

CreateCwmpPresetEventTask Create scheduled event tasks

func (*CwmpCpe) CreateCwmpSchedEventTask

func (c *CwmpCpe) CreateCwmpSchedEventTask(schedKey string) (err error)

CreateCwmpSchedEventTask Cwmp 定时任务, 由 CPE 触发

func (*CwmpCpe) GetCwmpPresetEventData

func (c *CwmpCpe) GetCwmpPresetEventData() (data *models.CwmpEventData, err error)

GetCwmpPresetEventData 获取一个 Cwmp 预设任务执行

func (*CwmpCpe) GetLatestCwmpPresetTask

func (c *CwmpCpe) GetLatestCwmpPresetTask() (*models.CwmpPresetTask, error)

func (*CwmpCpe) MatchDevice

func (c *CwmpCpe) MatchDevice(oui, productClass, softwareVersion string) bool

func (*CwmpCpe) MatchTaskTags

func (c *CwmpCpe) MatchTaskTags(tags string) bool

func (*CwmpCpe) NotifyDataUpdate

func (c *CwmpCpe) NotifyDataUpdate(force bool)

func (*CwmpCpe) OnInformUpdate

func (c *CwmpCpe) OnInformUpdate()

func (*CwmpCpe) OnInformUpdateOnline

func (c *CwmpCpe) OnInformUpdateOnline()

func (*CwmpCpe) OnParamsUpdate

func (c *CwmpCpe) OnParamsUpdate(params map[string]string)

func (*CwmpCpe) ProcessParameterNamesResponse

func (c *CwmpCpe) ProcessParameterNamesResponse(msg *cwmp.GetParameterNamesResponse)

func (*CwmpCpe) RecvCwmpEventData

func (c *CwmpCpe) RecvCwmpEventData(timeoutMsec int, hp bool) (data *models.CwmpEventData, err error)

RecvCwmpEventData 接收一个 Cwmp 事件

func (*CwmpCpe) SendCwmpEventData

func (c *CwmpCpe) SendCwmpEventData(data models.CwmpEventData, timeoutMsec int, hp bool) error

SendCwmpEventData 发送一个 Cwmp 事件,

func (*CwmpCpe) TaskTags

func (c *CwmpCpe) TaskTags() (tags []string)

func (*CwmpCpe) UpdateManagementAuthInfo

func (c *CwmpCpe) UpdateManagementAuthInfo(session string, timeout int, hp bool) error

func (*CwmpCpe) UpdateParameterWritable

func (c *CwmpCpe) UpdateParameterWritable(session string, timeoutsec int, hp bool) error

UpdateParameterWritable 更新参数权限, 每次更新部分属性

func (*CwmpCpe) UpdateStatus

func (c *CwmpCpe) UpdateStatus(msg *cwmp.Inform)

type CwmpEventTable

type CwmpEventTable struct {
	// contains filtered or unexported fields
}

func NewCwmpEventTable

func NewCwmpEventTable() *CwmpEventTable

func (*CwmpEventTable) ClearCwmpCpe

func (c *CwmpEventTable) ClearCwmpCpe(key string)

func (*CwmpEventTable) ClearCwmpCpeCache

func (c *CwmpEventTable) ClearCwmpCpeCache(key string)

func (*CwmpEventTable) GetCwmpCpe

func (c *CwmpEventTable) GetCwmpCpe(key string) *CwmpCpe

func (*CwmpEventTable) ListSn

func (c *CwmpEventTable) ListSn() []string

func (*CwmpEventTable) Size

func (c *CwmpEventTable) Size() int

func (*CwmpEventTable) UpdateCwmpCpe

func (c *CwmpEventTable) UpdateCwmpCpe(key string, msg *cwmp.Inform)

type TransTable

type TransTable struct {
	Lang   string `json:"lang"`
	Module string `json:"module"`
	Source string `json:"source"`
	Result string `json:"result"`
}

Jump to

Keyboard shortcuts

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