Documentation ¶
Index ¶
- Constants
- func Database() (*sqlx.DB, error)
- func DatabaseAuth(driver string, connect string)
- func IPProfileIPIDs() ([]uint, error)
- func Logger(customLogger zerolog.Logger)
- func NotificationCount(count *int) error
- func PatternIPCount(count *int) error
- func PatternImport() error
- func PatternURLCount(count *int) error
- type BearerLevel
- type BearerToken
- type BearerTokens
- type Configuration
- func (configuration *Configuration) Create() error
- func (configuration *Configuration) Exists() bool
- func (configuration *Configuration) Map() (jsonMap map[string]interface{})
- func (configuration *Configuration) Marshal(data interface{}) error
- func (configuration *Configuration) MarshalAndCreate(data interface{}) error
- func (configuration *Configuration) Slice() (jsonSlice []string)
- func (configuration *Configuration) Update() error
- type Connection
- type Connections
- type DnsRecord
- type DnsRecords
- type Exception
- type Exceptions
- type IPInformation
- func (info *IPInformation) CreateOrUpdate() error
- func (info *IPInformation) Find() error
- func (info *IPInformation) InternalNetwork() bool
- func (info *IPInformation) LookupMAC() error
- func (info *IPInformation) LookupNetBios() error
- func (info *IPInformation) LookupRDNSAndGeoIP()
- func (info *IPInformation) Valid() bool
- type IPInformations
- type IPProfile
- type IPProfiles
- type Network
- type NetworkInterface
- type NetworkInterfaces
- type Networks
- type Notification
- type Notifications
- type Pattern
- type PatternCategories
- type PatternCategory
- type PatternCategoryList
- type PatternCategoryLists
- type Patterns
- type PortalEvent
- type PortalEvents
- type PortalMigration
- type PortalMigrations
- type Profile
- type Profiles
- type Protocol
- type R2Profile
- type R2Profiles
- type Statistic
- type Statistics
- type User
- type Users
- type WatcherResult
- type WatcherResults
Constants ¶
const ( BearerTokenQueryTmpl = `SELECT * FROM bearer_tokens %s;` BearerTokenNamedInsertTmpl = `` /* 158-byte string literal not displayed */ BearerTokenDeleteTmpl = `DELETE FROM bearer_tokens %s;` )
const ( ConfigurationNamedInsertTmpl = `` /* 141-byte string literal not displayed */ ConfigurationNamedUpdateTmpl = ` UPDATE configuration SET updated_at=now(), value=:value WHERE key=:key OR id=:id;` ConfigurationQueryTmpl = `SELECT * FROM configuration %s;` )
const ( ConnectionResetCounterTmpl = `UPDATE connections SET count=0;` ConnectionNamedInsertTmpl = `` /* 280-byte string literal not displayed */ ConnectionNamedUpdateTmpl = `` /* 239-byte string literal not displayed */ ConnectionCountryQueryTmpl = `` /* 279-byte string literal not displayed */ ConnectionQueryTmpl = `SELECT * FROM connections WHERE %s;` )
const ( DnsRecordNamedInsertTmpl = `` /* 237-byte string literal not displayed */ DnsRecordNamedUpdateTmpl = `` /* 190-byte string literal not displayed */ DnsRecordNamedDeleteTmpl = `DELETE FROM dns_records WHERE %s;` DnsRecordQueryTmpl = `SELECT * FROM dns_records %s;` )
const ( ExceptionQueryTmpl = `SELECT * FROM exceptions %s;` ExceptionNamedInsertTmpl = `` /* 178-byte string literal not displayed */ ExceptionNamedUpdateTmpl = ` UPDATE exceptions SET updated_at=now(), alert=:alert, drop=:drop WHERE %s;` )
const ( IPInformationNamedInsertTmpl = `` /* 336-byte string literal not displayed */ IPInformationNamedUpdateTmpl = `` /* 259-byte string literal not displayed */ IPInformationQueryTmpl = `SELECT * FROM ip_information WHERE %s;` )
const ( IPProfileCleanUpTmpl = `DELETE FROM ip_profiles WHERE created_at < now() - interval '%d days';` IPProfileSelectGroupByIPIDTmpl = ` SELECT ip_information_id FROM ip_profiles WHERE %s GROUP BY ip_information_id;` IPProfileNamedInsertTmpl = `` /* 177-byte string literal not displayed */ IPProfileQueryTmpl = `` /* 926-byte string literal not displayed */ )
const ( NetworkNamedInsertTmpl = `` /* 202-byte string literal not displayed */ NetworkNamedUpdateTmpl = `` /* 159-byte string literal not displayed */ NetworkNamedDeleteTmpl = `DELETE FROM networks WHERE %s;` NetworkQueryTmpl = `SELECT * FROM networks %s;` )
const ( NetworkInterfaceNamedInsertTmpl = `` /* 350-byte string literal not displayed */ NetworkInterfaceNamedUpdateTmpl = `` /* 299-byte string literal not displayed */ NetworkInterfaceNamedDeleteTmpl = `DELETE FROM network_interfaces WHERE %s;` NetworkInterfaceQueryTmpl = `SELECT * FROM network_interfaces %s;` )
const ( NotificationQueryTmpl = `SELECT a.* FROM notifications as a %s;` NotificationQuerySumCountTmpl = `` /* 144-byte string literal not displayed */ NotificationNamedInsertTmpl = `` /* 192-byte string literal not displayed */ NotificationNamedUpdateTmpl = ` UPDATE notifications SET updated_at=now(), reviewed=:reviewed, trigger_count=:trigger_count WHERE %s;` )
const ( PatternQueryTmpl = `SELECT * FROM patterns %s;` PatternNamedUpdateTmpl = ` UPDATE patterns SET updated_at=now() %s;` PatternNamedDeleteTmpl = `DELETE FROM patterns %s;` PatternNamedInsertTmpl = `` /* 143-byte string literal not displayed */ PatternNamedBulkInsertTmpl = `` /* 1177-byte string literal not displayed */ PatternCopyCSVQuery = ` copy patterns from '/usr/share/fengg-pattern/patterns.csv' delimiter ',' csv header;` PatternCountTmpl = `select count(*) from patterns %s;` )
const ( PatternCategoryQueryTmpl = ` SELECT * FROM pattern_categories %s;` PatternCategoryJoinedQueryTmpl = `` /* 205-byte string literal not displayed */ PatternCategoryNamedUpdateTmpl = ` UPDATE pattern_categories SET updated_at=now(), enabled=:enabled, count=:count, parent_id=:parent_id %s;` PatternCategoryNamedInsertTmpl = `` /* 171-byte string literal not displayed */ PatternCategoryCopyCSVQuery = ` copy pattern_categories from '/usr/share/fengg-pattern/pattern-categories.csv' delimiter ',' csv header;` PatternCategoryNamedFixCounterTmpl = `` /* 398-byte string literal not displayed */ )
const ( PatternCategoryListQueryTmpl = ` SELECT * FROM pattern_category_lists %s;` PatternCategoryListNamedInsertTmpl = ` INSERT INTO pattern_category_lists ( pattern_id, category_id ) VALUES ( :pattern_id, :category_id );` PatternCategoryListCopyCSVQuery = ` copy pattern_category_lists from '/usr/share/fengg-pattern/pattern-category-lists.csv' delimiter ',' csv header;` )
const ( PortalEventQueryTmpl = `SELECT * FROM portal_events %s;` PortalEventNamedUpdateTmpl = ` UPDATE portal_events SET updated_at=now(), ack=:ack %s;` PortalEventNamedInsertTmpl = `` /* 248-byte string literal not displayed */ PortalEventDeleteTmpl = `DELETE FROM portal_events %s;` )
const ( PortalMigrationQueryTmpl = `SELECT * FROM portal_migrations %s;` PortalMigrationNamedUpdateTmpl = `UPDATE portal_migrations SET version=:version WHERE %s;` PortalMigrationNamedInsertTmpl = ` INSERT INTO portal_migrations (type, version) VALUES (:type, :version);` )
const ( ProfileNamedInsertTmpl = `` /* 188-byte string literal not displayed */ ProfileNamedUpdateTmpl = `` /* 145-byte string literal not displayed */ ProfileQueryTmpl = `SELECT * FROM profiles %s;` )
const ( R2ProfileCleanUpTmpl = ` DELETE FROM r2_profiles WHERE created_at < now() - interval '%d days';` R2ProfileNamedInsertTmpl = `` /* 331-byte string literal not displayed */ R2ProfileQueryTmpl = `` /* 706-byte string literal not displayed */ )
const ( StatisticQueryTmpl = `SELECT * FROM statistics %s;` StatisticNamedUpdateTmpl = `UPDATE statistics SET count=:count WHERE %s;` StatisticNamedInsertTmpl = `INSERT INTO statistics (key, count) VALUES (:key, :count);` )
const ( UserQueryTmpl = `SELECT * FROM users %s;` UserNamedUpdateTmpl = ` UPDATE users SET updated_at=now(), name=:name, surname=:surname, bio=:bio, email=:email %s WHERE %s;` UserNamedInsertTmpl = `` /* 356-byte string literal not displayed */ )
const ( WatcherResultNamedInsertTmpl = `` /* 193-byte string literal not displayed */ WatcherResultNamedUpdateTmpl = `` /* 148-byte string literal not displayed */ WatcherResultResetRetriesTmpl = `UPDATE watcher_results SET retries=0 WHERE retries > 0;` WatcherResultQueryTmpl = `SELECT * FROM watcher_results %s;` )
Variables ¶
This section is empty.
Functions ¶
func Database ¶
Database returns the sqlx.DB pointer. Remember to close the connection if you are done!
func DatabaseAuth ¶
DatabaseAuth sets the authentication credentials for sqlx.
func IPProfileIPIDs ¶
IPProfileIPIDs returns from the last 30 minutes the active profile IDs
func PatternIPCount ¶
PatternIPCount will fetch the database count of the available IP pattern
Types ¶
type BearerToken ¶
type BearerToken struct { ID uint `db:"id" json:"id" binding:"-"` CreatedAt time.Time `db:"created_at" json:"createdAt" binding:"-"` UserID uint `db:"user_id" json:"userId" binding:"-"` Token string `db:"token" json:"token" binding:"-"` Level BearerLevel `db:"level" json:"level" binding:"-"` Note *string `db:"note" json:"note,omitempty" binding:"-"` }
func NewBearerToken ¶
func NewBearerToken() *BearerToken
func (*BearerToken) Create ¶
func (token *BearerToken) Create() error
func (*BearerToken) DeleteByIDAndUserID ¶
func (token *BearerToken) DeleteByIDAndUserID(id, uid uint) error
func (*BearerToken) FindByToken ¶
func (token *BearerToken) FindByToken(fbToken string) error
type BearerTokens ¶
type BearerTokens []BearerToken
func (*BearerTokens) FindByUserID ¶
func (tokens *BearerTokens) FindByUserID(uid uint) error
type Configuration ¶
type Configuration struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` Key types.ConfigurationKey `db:"key" json:"key"` Value types.JsonString `db:"value" json:"value"` }
func NewConfiguration ¶
func NewConfiguration(key types.ConfigurationKey) *Configuration
func (*Configuration) Create ¶
func (configuration *Configuration) Create() error
func (*Configuration) Exists ¶
func (configuration *Configuration) Exists() bool
Exists directly updates the struct with the findings
func (*Configuration) Map ¶
func (configuration *Configuration) Map() (jsonMap map[string]interface{})
func (*Configuration) Marshal ¶
func (configuration *Configuration) Marshal(data interface{}) error
func (*Configuration) MarshalAndCreate ¶
func (configuration *Configuration) MarshalAndCreate(data interface{}) error
func (*Configuration) Slice ¶
func (configuration *Configuration) Slice() (jsonSlice []string)
func (*Configuration) Update ¶
func (configuration *Configuration) Update() error
type Connection ¶
type Connection struct { ID uint `db:"id" json:"id"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` Count uint `db:"count" json:"count"` SourceID uint `db:"source_id" json:"sourceId"` DestinationID uint `db:"destination_id" json:"destinationId"` TransportProtocolID uint `db:"transport_protocol_id" json:"transportProtocolId"` ApplicationProtocolID uint `db:"application_protocol_id" json:"applicationProtocolId"` Source IPInformation `db:"-" json:"source"` Destination IPInformation `db:"-" json:"destination"` TransportProtocol Protocol `db:"-" json:"transportProtocol"` ApplicationProtocol Protocol `db:"-" json:"applicationProtocol"` }
func NewConnection ¶
func NewConnection() *Connection
func (*Connection) Create ¶
func (a *Connection) Create() error
func (*Connection) Exists ¶
func (a *Connection) Exists() bool
func (*Connection) LookupExtraInformation ¶
func (a *Connection) LookupExtraInformation()
func (*Connection) PreLoad ¶
func (a *Connection) PreLoad() error
PreLoad will fetch all extra information like e.g. IP information and write them to the connection struct
func (*Connection) Update ¶
func (a *Connection) Update() error
func (*Connection) Valid ¶
func (a *Connection) Valid() bool
type Connections ¶
type Connections []Connection
func (*Connections) FindRecentConnections ¶
func (a *Connections) FindRecentConnections() error
func (Connections) PreLoad ¶
func (connections Connections) PreLoad() error
type DnsRecord ¶
type DnsRecord struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` NetworkID uint `db:"network_id" json:"networkId"` Type int16 `db:"type" json:"type"` IPv4 *types.IP `db:"ipv4" json:"ipv4"` IPv6 *types.IP `db:"ipv6" json:"ipv6"` Name string `db:"name" json:"name"` Value string `db:"value" json:"value"` Priority *int `db:"priority" json:"priority"` TTL *int `db:"ttl" json:"ttl"` }
func (*DnsRecord) Exists ¶
Exists directly updates the struct with the findings
type DnsRecords ¶
type DnsRecords []DnsRecord
func (*DnsRecords) FindAll ¶
func (records *DnsRecords) FindAll() error
func (*DnsRecords) FindByNetworkID ¶
func (records *DnsRecords) FindByNetworkID(id uint) error
type Exception ¶
type Exception struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` Type types.NFQActionType `db:"type" json:"type"` Alert bool `db:"alert" json:"alert"` Drop bool `db:"drop" json:"drop"` PatternID uint `db:"pattern_id" json:"patternId"` // can be loaded with PreLoad function Pattern *Pattern `db:"-" json:"-"` }
func (*Exception) Exists ¶
Exists directly updates the struct with the findings
type Exceptions ¶
type Exceptions []*Exception
func (*Exceptions) FindAll ¶
func (exceptions *Exceptions) FindAll() error
func (*Exceptions) FindOutOfSync ¶
func (exceptions *Exceptions) FindOutOfSync(migration PortalMigration) error
func (Exceptions) PreLoad ¶
func (exceptions Exceptions) PreLoad() error
type IPInformation ¶
type IPInformation struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` IP types.IP `db:"ip" json:"ip"` MacAddress string `db:"mac" json:"macAddress"` ReverseDNS string `db:"reverse_dns" json:"reverseDNS"` NetBIOS string `db:"net_bios" json:"netBIOS"` Country string `db:"country" json:"country"` EuropeanUnion bool `db:"european_union" json:"europeanUnion"` AnonymousProxy bool `db:"anonymous_proxy" json:"anonymousProxy"` SatelliteProvider bool `db:"satellite_provider" json:"satelliteProvider"` }
func NewIPInformation ¶
func NewIPInformation() *IPInformation
func (*IPInformation) CreateOrUpdate ¶
func (info *IPInformation) CreateOrUpdate() error
func (*IPInformation) Find ¶
func (info *IPInformation) Find() error
func (*IPInformation) InternalNetwork ¶
func (info *IPInformation) InternalNetwork() bool
func (*IPInformation) LookupMAC ¶
func (info *IPInformation) LookupMAC() error
func (*IPInformation) LookupNetBios ¶
func (info *IPInformation) LookupNetBios() error
func (*IPInformation) LookupRDNSAndGeoIP ¶
func (info *IPInformation) LookupRDNSAndGeoIP()
func (*IPInformation) Valid ¶
func (info *IPInformation) Valid() bool
type IPInformations ¶
type IPInformations []IPInformation
type IPProfile ¶
type IPProfile struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` IPInformationID uint `db:"ip_information_id" json:"ipInformationId"` ProtocolID uint `db:"protocol_id" json:"protocolId"` IPInformation IPInformation `db:"-" json:"ipInformation"` Protocol Protocol `db:"-" json:"protocol"` Weight float64 `db:"weight" json:"weight"` }
type IPProfiles ¶
type IPProfiles []IPProfile
func (*IPProfiles) Get ¶
func (profiles *IPProfiles) Get(ipInformationID, protocolID uint) *IPProfile
type Network ¶
type Network struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` Name string `db:"name" json:"name" binding="alphanum,min=4"` Address *types.IP `db:"address" json:"address,omitempty" binding="ip"` Network *types.IPNet `db:"network" json:"network,omitempty" binding="ipnet"` DHCP bool `db:"dhcp" json:"dhcp"` DNS bool `db:"dns" json:"dns"` Client bool `db:"client" json:"client"` }
func (*Network) Exists ¶
Exists directly updates the struct with the findings
type NetworkInterface ¶
type NetworkInterface struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` Name string `db:"name" json:"name"` DefaultGateway bool `db:"default_gateway" json:"defaultGateway"` GatewayID *uint `db:"gateway_id" json:"gatewayId,omitempty"` NetworkID uint `db:"network_id" json:"networkId" binding="required"` WirelessCard bool `db:"wireless" json:"wirelessCard"` PhysicalCard bool `db:"physical" json:"physicalCard"` BridgeMaster bool `db:"bridge_master" json:"bridgeMaster"` BridgeID *string `db:"bridge_id" json:"bridgeId"` TunTapDevice bool `db:"tun" json:"tunTapDevice"` Link bool `db:"link" json:"link"` }
func NewNetworkInterface ¶
func NewNetworkInterface() *NetworkInterface
func (*NetworkInterface) Create ¶
func (intf *NetworkInterface) Create() error
func (*NetworkInterface) Delete ¶
func (intf *NetworkInterface) Delete() error
func (*NetworkInterface) Exists ¶
func (intf *NetworkInterface) Exists() bool
Exists directly updates the struct with the findings
func (*NetworkInterface) Network ¶
func (intf *NetworkInterface) Network() (network *Network)
Network fetches the assigned ip network configuration for the interface
func (*NetworkInterface) ResetBridgeSetup ¶
func (intf *NetworkInterface) ResetBridgeSetup() error
ResetBridgeSetup will remove all bridge related flags from the master and salve interfaces.
func (*NetworkInterface) Update ¶
func (intf *NetworkInterface) Update() error
type NetworkInterfaces ¶
type NetworkInterfaces []NetworkInterface
func (*NetworkInterfaces) FindAll ¶
func (intfs *NetworkInterfaces) FindAll() error
func (*NetworkInterfaces) FindByNetworkID ¶
func (intfs *NetworkInterfaces) FindByNetworkID(id uint) error
FindByNetworkID returns all interfaces related to the given network ID
func (*NetworkInterfaces) FindWirelessCards ¶
func (intfs *NetworkInterfaces) FindWirelessCards() error
type Notification ¶
type Notification struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` TriggerCount uint `db:"trigger_count" json:"triggerCount"` Type types.NFQActionType `db:"type" json:"type"` Reviewed bool `db:"reviewed" json:"reviewed"` PatternID uint `db:"pattern_id" json:"patternId"` // can be loaded with PreLoad function Pattern *Pattern `db:"-" json:"-"` }
func NewNotification ¶
func NewNotification() *Notification
func (*Notification) Create ¶
func (notification *Notification) Create() error
func (*Notification) Exists ¶
func (notification *Notification) Exists() bool
Exists directly updates the struct with the findings
func (*Notification) FindByID ¶
func (notification *Notification) FindByID() error
func (*Notification) PreLoad ¶
func (notification *Notification) PreLoad() error
func (*Notification) Update ¶
func (notification *Notification) Update() error
type Notifications ¶
type Notifications []*Notification
func (*Notifications) FindOutOfSync ¶
func (notifications *Notifications) FindOutOfSync(migration PortalMigration) error
func (Notifications) PreLoad ¶
func (notifications Notifications) PreLoad() error
type Pattern ¶
type Pattern struct { ID uint `db:"id" json:"id"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` Raw string `db:"raw" json:"raw"` IP bool `db:"ip" json:"ip"` URL bool `db:"url" json:"url"` URLPath bool `db:"url_path" json:"urlPath"` }
func (*Pattern) Delete ¶
Delete will delete the pattern and all its relation e.g. category, category lists for more details see the postgres trigger function clean_up_after_pattern_delete
type PatternCategories ¶
type PatternCategories []*PatternCategory
func (*PatternCategories) FindAll ¶
func (categories *PatternCategories) FindAll() error
func (*PatternCategories) FindByEnabled ¶
func (categories *PatternCategories) FindByEnabled(enabled bool) error
func (PatternCategories) FindPatterns ¶
func (categories PatternCategories) FindPatterns() (patterns Patterns, err error)
func (PatternCategories) FixCategoryCounter ¶
func (categories PatternCategories) FixCategoryCounter() error
FixCategoryCounter will update the counter column. This happens normally after an update.
type PatternCategory ¶
type PatternCategory struct { ID uint `db:"id" json:"id"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` Name string `db:"name" json:"name"` ParentID *uint `db:"parent_id" json:"-"` Enabled bool `db:"enabled" json:"enabled"` Count int `db:"count" json:"count"` }
func NewPatternCategory ¶
func NewPatternCategory() *PatternCategory
func (*PatternCategory) Create ¶
func (category *PatternCategory) Create() error
func (*PatternCategory) Exists ¶
func (category *PatternCategory) Exists() bool
func (PatternCategory) FindPatterns ¶
func (category PatternCategory) FindPatterns() (patterns Patterns, err error)
func (*PatternCategory) Update ¶
func (category *PatternCategory) Update() error
type PatternCategoryList ¶
type PatternCategoryList struct { PatternID uint `db:"pattern_id" json:"patternId"` CategoryID uint `db:"category_id" json:"categoryId"` }
func NewPatternCategoryList ¶
func NewPatternCategoryList() *PatternCategoryList
func (*PatternCategoryList) Create ¶
func (list *PatternCategoryList) Create() error
func (*PatternCategoryList) Exists ¶
func (list *PatternCategoryList) Exists() bool
type PatternCategoryLists ¶
type PatternCategoryLists []PatternCategoryList
type Patterns ¶
type Patterns []*Pattern
func (*Patterns) Delete ¶
Delete will delete the pattern and all its relation e.g. category, category lists for more details see the postgres trigger function clean_up_after_pattern_delete
type PortalEvent ¶
type PortalEvent struct { ID uint `db:"id" json:"id" binding:"gt=0"` PID uint `db:"pid" json:"pid"` CreatedAt time.Time `db:"created_at" json:"createdAt" binding:"-"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt" binding:"-"` Ack *bool `db:"ack" json:"ack,omitempty"` Type types.PortalEventType `db:"type" json:"type" binding:"gt=0"` Message *types.JsonString `db:"message" json:"message,omitempty"` MessageID uint `db:"message_id" json:"messageId" binding:"gt=0"` UuidID uint `db:"uuid_id" json:"uuidId" binding:"gt=0"` ClientID uint `db:"client_id" json:"clientId,omitempty"` }
func NewPortalEvent ¶
func NewPortalEvent() *PortalEvent
func (*PortalEvent) Create ¶
func (event *PortalEvent) Create() error
func (*PortalEvent) Exists ¶
func (event *PortalEvent) Exists(pid uint) bool
func (*PortalEvent) Update ¶
func (event *PortalEvent) Update() error
type PortalEvents ¶
type PortalEvents []PortalEvent
func (*PortalEvents) FindAll ¶
func (events *PortalEvents) FindAll() error
type PortalMigration ¶
type PortalMigration struct { Type types.PortalEventType `db:"type" json:"type"` Version time.Time `db:"version" json:"version"` }
func NewPortalMigration ¶
func NewPortalMigration() *PortalMigration
func (*PortalMigration) CreateOrUpdate ¶
func (migration *PortalMigration) CreateOrUpdate() error
func (*PortalMigration) FindByType ¶
func (migration *PortalMigration) FindByType(id types.PortalEventType) error
type PortalMigrations ¶
type PortalMigrations []PortalMigration
type Profile ¶
type Profile struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` IPInformationID uint `db:"ip_information_id" json:"ipInformationId"` IPInformation IPInformation `db:"-" json:"ipInformation"` AnomalyDetection float64 `db:"anomaly_detection" json:"anomalyDetection"` }
func (*Profile) PreLoad ¶
PreLoad will fetch all extra information like e.g. IP information and write them to the profile struct
type Protocol ¶
type Protocol struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` Name string `db:"name" json:"name"` }
func (*Protocol) ParseIPHeader ¶
String will print the string representation of the network protocol layer (see https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)
type R2Profile ¶
type R2Profile struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` IPInformationID uint `db:"ip_information_id" json:"ipInformationId"` IPInformation IPInformation `db:"-" json:"ipInformation"` R2Daily float64 `db:"r2_daily" json:"r2Daily"` R2Weekly float64 `db:"r2_weekly" json:"r2Weekly"` R2Monthly float64 `db:"r2_monthly" json:"r2Monthly"` R2DailyNetwork float64 `db:"r2_daily_network" json:"r2DailyNetwork"` R2WeeklyNetwork float64 `db:"r2_weekly_network" json:"r2WeeklyNetwork"` R2MonthlyNetwork float64 `db:"r2_monthly_network" json:"r2MonthlyNetwork"` }
type R2Profiles ¶
type R2Profiles []R2Profile
func (*R2Profiles) CleanUp ¶
func (profiles *R2Profiles) CleanUp(days int) error
CleanUp will purge all profiles older then X days
func (*R2Profiles) FindAll ¶
func (profiles *R2Profiles) FindAll() error
func (*R2Profiles) FindTodaysProfiles ¶
func (profiles *R2Profiles) FindTodaysProfiles() error
FindTodaysProfiles selects all profiles with a creation time of now()::date
func (R2Profiles) Less ¶
func (profiles R2Profiles) Less(i, j int) bool
func (R2Profiles) Swap ¶
func (profiles R2Profiles) Swap(i, j int)
type Statistic ¶
type Statistic struct { ID uint `db:"id" json:"id"` Key types.StatisticKey `db:"key" json:"key"` Count float64 `db:"count" json:"count"` }
type Statistics ¶
type Statistics []Statistic
func (Statistics) CreateOrUpdate ¶
func (statistics Statistics) CreateOrUpdate() (errs []error)
func (*Statistics) Find ¶
func (statistics *Statistics) Find() error
func (*Statistics) FindAll ¶
func (statistics *Statistics) FindAll() error
type User ¶
type User struct { ID uint `db:"id" json:"id" binding:"-"` CreatedAt time.Time `db:"created_at" json:"createdAt" binding:"-"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt" binding:"-"` Name *string `db:"name" json:"name,omitempty"` Surname *string `db:"surname" json:"surname,omitempty"` Bio *string `db:"bio" json:"bio,omitempty"` Email *string `db:"email" json:"email,omitempty" binding="email,omitempty"` Nickname string `db:"nickname" json:"nickname" binding:"alphanum,min=4"` Password *string `db:"-" json:"password,omitempty" binding:"min=4,required"` // XXX Repassword must be validated manually Repassword *string `db:"-" json:"repassword,omitempty" binding:"-"` HashedPassword string `db:"hashed_password" json:"-" binding:"-"` Fingerprint string `db:"fingerprint" json:"fingerprint" binding:"fingerprint"` SerializedPublicKey string `db:"serialized_public_key" json:"serializedPublicKey" binding:"publickey"` SerializedPrivateKey string `db:"serialized_private_key" json:"-" binding:"privatekey"` }
type WatcherResult ¶
type WatcherResult struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` WorkerName string `db:"worker_name" json:"workerName"` Alive bool `db:"alive" json:"alive"` Retries int `db:"retries" json:"retries"` Error *string `db:"error" json:"error,omitempty"` }
func NewWatcherResult ¶
func NewWatcherResult() *WatcherResult
func (*WatcherResult) Create ¶
func (result *WatcherResult) Create() error
func (*WatcherResult) Exists ¶
func (result *WatcherResult) Exists() bool
func (*WatcherResult) Update ¶
func (result *WatcherResult) Update() error
type WatcherResults ¶
type WatcherResults []WatcherResult
func (*WatcherResults) FindAll ¶
func (results *WatcherResults) FindAll() error
func (*WatcherResults) ResetRetries ¶
func (results *WatcherResults) ResetRetries() error
Source Files ¶
- bearer_token.go
- configuration.go
- connection.go
- dns_record.go
- exception.go
- init.go
- ip_information.go
- ip_profile.go
- network.go
- network_interface.go
- notification.go
- pattern.go
- pattern_category.go
- pattern_category_list.go
- portal_event.go
- portal_migration.go
- profile.go
- protocol.go
- r2_profile.go
- statistic.go
- user.go
- watcher_result.go