Documentation ¶
Overview ¶
Index ¶
- func AddCaptor(captor *Captor) bool
- func AddFaker(faker *Faker) bool
- func AddImpression(id string, sessionId string, websiteId string, userId string, trace *Trace) bool
- func AddImpressions(impressions []*Impression) bool
- func AddImpressionsSafe(impressions []*Impression) bool
- func AddPage(page *Page) bool
- func AddSession(id string, websiteId string, userAgent string, clientIp string, userId string) bool
- func AddSessions(sessions []*Session) bool
- func AddSessionsSafe(sessions []*Session) bool
- func AddWebsite(website *Website) bool
- func AppendTraceToImpression(id string, websiteId string, trace *Trace)
- func DeleteCaptor(captor *Captor) bool
- func DeleteFaker(faker *Faker) bool
- func DeleteImpression(id string) bool
- func DeleteImpressions(websiteId string) bool
- func DeletePage(id string) bool
- func DeleteSession(id string, websiteId string) bool
- func DeleteSessions(websiteId string) bool
- func DeleteWebsite(id string) bool
- func InitMapMutexes()
- func InitOrmManager()
- func UpdateCaptor(id string, captor *Captor) bool
- func UpdateFaker(id string, faker *Faker) bool
- func UpdatePage(id string, page *Page) bool
- func UpdateWebsite(id string, website *Website) bool
- type Captor
- type Event
- type Faker
- type Impression
- type MapMutex
- type OrmManager
- type Page
- type Session
- type SessionJson
- type Trace
- type TrackConfig
- type Website
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddImpression ¶
func AddImpressions ¶
func AddImpressions(impressions []*Impression) bool
func AddImpressionsSafe ¶
func AddImpressionsSafe(impressions []*Impression) bool
func AddSession ¶
func AddSessions ¶
func AddSessionsSafe ¶
func AddWebsite ¶
func AppendTraceToImpression ¶
func DeleteCaptor ¶
func DeleteFaker ¶
func DeleteImpression ¶
func DeleteImpressions ¶
func DeletePage ¶
func DeleteSession ¶
func DeleteSessions ¶
func DeleteWebsite ¶
func InitMapMutexes ¶
func InitMapMutexes()
func InitOrmManager ¶
func InitOrmManager()
func UpdateCaptor ¶
func UpdateFaker ¶
func UpdatePage ¶
func UpdateWebsite ¶
Types ¶
type Captor ¶
type Captor struct { Name string `xorm:"varchar(100) notnull pk" json:"name"` CreatedTime string `xorm:"varchar(100)" json:"createdTime"` Title string `xorm:"varchar(100)" json:"title"` Script string `xorm:"mediumtext" json:"script"` }
func GetCaptors ¶
func GetCaptors() []*Captor
type Event ¶
type Event struct { Id int `json:"id"` Timestamp float64 `json:"timestamp"` Type string `json:"type"` Button string `json:"button"` X int `json:"x"` Y int `json:"y"` DeltaX int `json:"deltaX"` DeltaY int `json:"deltaY"` Width int `json:"width"` Height int `json:"height"` Speed int `json:"speed"` Acceleration int `json:"acceleration"` }
type Faker ¶
type Impression ¶
type Impression struct { Id string `xorm:"varchar(100) notnull pk" json:"id"` SessionId string `xorm:"varchar(100)" json:"sessionId"` WebsiteId string `xorm:"varchar(100) notnull pk" json:"websiteId"` CreatedTime string `xorm:"varchar(100)" json:"createdTime"` UrlPath string `xorm:"varchar(500)" json:"urlPath"` Width int `json:"width"` Height int `json:"height"` PageLoadTime string `xorm:"varchar(100)" json:"pageLoadTime"` UserAgent string `xorm:"varchar(500)" json:"userAgent"` ClientIp string `xorm:"varchar(100)" json:"clientIp"` UserId string `xorm:"varchar(100)" json:"userId"` Label int `json:"label"` Guess int `json:"guess"` Reason string `json:"reason"` RuleId int `json:"ruleId"` RuleStart int `json:"ruleStart"` RuleEnd int `json:"ruleEnd"` Events []*Event `xorm:"mediumtext" json:"events"` }
func GetImpression ¶
func GetImpression(id string, websiteId string) *Impression
func GetImpressions ¶
func GetImpressions(websiteId string, sessionId string, sortField string, sortOrder string) []*Impression
func GetImpressionsAll ¶
func GetImpressionsAll(websiteId string, sortField string, sortOrder string) []*Impression
type MapMutex ¶
type MapMutex struct {
// contains filtered or unexported fields
}
Mutex is the mutex with synchronized map it's for reducing unnecessary locks among different keys
type OrmManager ¶
type OrmManager struct {
// contains filtered or unexported fields
}
OrmManager represents the MySQL ormManager for policy storage.
func NewOrmManager ¶
func NewOrmManager(driverName string, dataSourceName string) *OrmManager
NewOrmManager is the constructor for OrmManager.
type Page ¶
type Page struct { Id string `xorm:"varchar(100) notnull pk" json:"id"` WebsiteId string `xorm:"varchar(100)" json:"websiteId"` UrlPath string `xorm:"varchar(500)" json:"urlPath"` CreatedTime string `xorm:"varchar(100)" json:"createdTime"` Width int `json:"width"` Height int `json:"height"` ScreenshotUrl string `xorm:"varchar(500)" json:"screenshotUrl"` }
type Session ¶
type Session struct { Id string `xorm:"varchar(100) notnull pk" json:"id"` WebsiteId string `xorm:"varchar(100) notnull pk" json:"websiteId"` CreatedTime string `xorm:"varchar(100)" json:"createdTime"` UserAgent string `xorm:"varchar(500)" json:"userAgent"` ClientIp string `xorm:"varchar(100)" json:"clientIp"` UserId string `xorm:"varchar(100)" json:"userId"` ImpressionCount int `json:"impressionCount"` Impressions []*Impression `json:"-"` Traces []*Trace `json:"traces"` TraceMap map[int]*Trace `json:"-"` TN int `json:"tn"` FP int `json:"fp"` FN int `json:"fn"` TP int `json:"tp"` UN int `json:"un"` }
func GetSession ¶
func GetSessions ¶
func NewSession ¶
func (*Session) SyncStatistics ¶
func (ss *Session) SyncStatistics()
func (*Session) ToJson ¶
func (ss *Session) ToJson(ruleCount int) *SessionJson
type SessionJson ¶
type Trace ¶
type Trace struct { Id int `json:"batchId"` PacketId int `json:"packetId"` Url string `json:"url"` Path string `json:"path"` Width int `json:"width"` Height int `json:"height"` PageLoadTime string `json:"pageLoadTime"` Referrer string `json:"referrer"` Label int `json:"label"` Guess int `json:"guess"` Reason string `json:"reason"` RuleId int `json:"ruleId"` RuleStart int `json:"ruleStart"` RuleEnd int `json:"ruleEnd"` Events []*Event `json:"events"` }
func (*Trace) LoadFromJson ¶
func (*Trace) SortEvents ¶
func (t *Trace) SortEvents()
type TrackConfig ¶
type TrackConfig struct { EndpointType string `json:"endpointType"` UploadEndpoint string `json:"uploadEndpoint"` ResendInterval int `json:"resendInterval"` UploadMode string `json:"uploadMode"` UploadTimes int `json:"uploadTimes"` UploadPeriod int `json:"uploadPeriod"` Frequency int `json:"frequency"` SizeLimit int `json:"sizeLimit"` Scope string `json:"scope"` EnableGet bool `json:"enableGet"` Version string `json:"version"` Encoder string `json:"encoder"` EnableServerConfig bool `json:"enableServerConfig"` DisableSession bool `json:"disableSession"` }
func ParseTrackConfig ¶
func ParseTrackConfig(s string) TrackConfig
type Website ¶
type Website struct { Id string `xorm:"varchar(100) notnull pk" json:"id"` Name string `xorm:"varchar(100)" json:"name"` Url string `xorm:"varchar(100)" json:"url"` TrackConfig string `xorm:"mediumtext" json:"trackConfig"` State string `xorm:"varchar(100)" json:"state"` SessionCount int `json:"sessionCount"` }
func GetWebsite ¶
func GetWebsites ¶
func GetWebsites() []*Website
Click to show internal directories.
Click to hide internal directories.