Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteDBHandler(version string) error
- func GenToken() []byte
- func GetDBHandler(version string) *gorm.DB
- func Init(dbDir string)
- func IsSourceExists(source, dbVersion string) bool
- func SessionClean() error
- func SetDBHander(version string) error
- func ValidAction(action int) bool
- func ValidColumn(name string) bool
- func ValidStatus(status string) bool
- type ActionType
- type CVE
- type CVEList
- type CVEScore
- type CVEScoreList
- type DebianCVE
- type DebianCVEList
- type FilterScope
- type FilterUrgency
- type Log
- type LogList
- type Package
- type PackageList
- type Session
- type Version
- type VersionList
Constants ¶
const ( // CVE status available values CVEStatusUnprocessed = "unprocessed" // 未处理 CVEStatusProcessing = "processing" // 处理中 CVEStatusPostpone = "postpone" // 延后 CVEStatusHold = "hold" // 搁置 CVEStatusCanceled = "canceled" // 取消 CVEStatusFixed = "fixed" // 完成 )
const ( // Filter tracker filter FilterUrgencyHigh FilterUrgency = "high_urgency" FilterUrgencyMedium = "medium_urgency" FilterUrgencyLow = "low_urgency" FilterUrgencyUnimportant = "unimportant_urgency" FilterUrgencyNotYetAssigned = "unassigned_urgency" FilterUrgencyEndOfLife = "endoflife_urgency" )
const ( // Filter scope list FilterScopeHideRemote FilterScope = "remote" FilterScopeHideLocal = "locale" FilterScopeHideUnclear = "unclear" FilterScopeUndetermined = "undetermined_issues" FilterScopeNoDSA = "nodsa" FilterScopeIgnore = "noignored" FilterScopePostponed = "nopostponed" )
const (
// DefaultExpires 10 hours
DefaultExpires = 10 * 60 * 60
)
Variables ¶
var ( // CommonDB session, version, log db handler CommonDB *gorm.DB )
Functions ¶
func GetDBHandler ¶
GetDBHandler return db handler by version
func IsSourceExists ¶
IsSourceExists query whether source exists
func ValidColumn ¶
ValidColumn validity cve table whether has this column name
Types ¶
type ActionType ¶
type ActionType int
ActionType action types
const ( LogActionInitPackage ActionType = iota + 1 LogActionFecthDebian LogActionPatchCVE LogActionLogin LogActionLogout LogActionNewVersion LogActionPatchVersion LogActionDeleteVersion LogActionFetchScore )
type CVE ¶
type CVE struct {
DebianCVE
Status string `json:"status"`
Patch string `json:"patch"`
Description string `json:"description"`
CVSS string `json:"cvss"`
PreInstalled bool `json:"pre_installed"`
Archived bool `json:"archived"`
Score float64 `json:"score"` // jump to nvd
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"-"`
}
CVE store cve bug for tracking
type CVEScore ¶
type CVEScore struct {
ID string `gorm:"primary_key;index" json:"id"`
ScoreSeverity string `json:"score_severity"`
CVSS string `json:"cvss"`
Score float64 `json:"score"`
}
CVEScore CVSS 3.0 score from NVD
type CVEScoreList ¶
type CVEScoreList []*CVEScore
CVEScoreList cve score list
func (CVEScoreList) Create ¶
func (list CVEScoreList) Create(version string) error
Create insert cve score list
func (CVEScoreList) UpdateCVE ¶
func (list CVEScoreList) UpdateCVE(version string) error
type DebianCVE ¶
type DebianCVE struct {
ID string `gorm:"primary_key" json:"id"` // jump to cve
Package string `json:"package"`
Urgency string `json:"urgency"`
Remote string `json:"remote"`
}
DebianCVE store cve bug from debian tracker
type DebianCVEList ¶
type DebianCVEList []*DebianCVE
DebianCVEList an array for CVE
func (DebianCVEList) Dump ¶
func (list DebianCVEList) Dump()
type FilterScope ¶
type FilterScope string
Filter scope
func (FilterScope) String ¶
func (filter FilterScope) String() string
type FilterUrgency ¶
type FilterUrgency string
Filter urgency level
func (FilterUrgency) String ¶
func (filter FilterUrgency) String() string
type Log ¶
type Log struct {
ID int `gorm:"auto_increment;primary_key" json:"id"`
Operator string `json:"operator"`
Action ActionType `json:"action"`
ActionDesc string `gorm:"-" json:"action_desc"`
Target string `json:"target"`
Description string `json:"description"`
Content string `json:"content"`
}
Log operation records
type LogList ¶
type LogList []*Log
LogList log list
func QueryLogList ¶
QueryLogList query log list, available params: operator, target
type Package ¶
type Package struct {
Package string `gorm:"primary_key" json:"package"` // package + ':' + architecture, unique key
Source string `json:"source"`
Version string `json:"version"`
Architecture string `json"architecture`
SourceVersion string `json:"source_version"` // if empty, equal with version
}
Package store installed packages in ISO Image
func NewPackage ¶
NrePackage query package from db
type PackageList ¶
type PackageList []*Package
PackageList package list
func (PackageList) Create ¶
func (infos PackageList) Create(dbVersion string) error
Create insert package list
type Session ¶
type Session struct {
Token string `gorm:"primary_key" json:"token"`
Username string `json:"username"`
Expires int64 `json:"expires"`
CreatedAt time.Time `json:"created_at"`
}
Session user login cookie
type Version ¶
type Version struct {
Version string `gorm:"primary_key;index" json:"version"`
DebianVersion string `json:"debian_version"`
TrackerURL string `json:"tracker_url"`
ReleaseURL string `json:"release_url"`
DebianSeq int `json:"debian_seq"`
}
Version deepin and debian version
type VersionList ¶
type VersionList []*Version
VersionList version list
func QueryVersionList ¶
func QueryVersionList() (VersionList, error)
QueryVersionList return version list
func (VersionList) Len ¶
func (list VersionList) Len() int
func (VersionList) Less ¶
func (list VersionList) Less(i, j int) bool
func (VersionList) Swap ¶
func (list VersionList) Swap(i, j int)