Documentation
¶
Index ¶
- Constants
- Variables
- type ChangeLog
- type DBServiceGeoip
- type DbChangeListener
- type DbService
- type DbServiceConfig
- type DbServiceImpl
- func (ds *DbServiceImpl) GetConfigValueForKey(key string) (string, error)
- func (ds *DbServiceImpl) GetConfigs() (map[string]string, error)
- func (ds *DbServiceImpl) GetGeoipCountries() (map[string]bool, error)
- func (ds *DbServiceImpl) GetGeoipSource() (*GeoipSource, error)
- func (ds *DbServiceImpl) GetGeoipSourceTimestamp() (time.Time, error)
- func (ds *DbServiceImpl) NotifyChange(table int, key string) error
- func (ds *DbServiceImpl) SetConfigValueForKey(key string, value string) error
- func (ds *DbServiceImpl) SetGeoipCountries(countryCodes []string, allow bool) error
- func (ds *DbServiceImpl) SetGeoipSource(timestamp time.Time, source []byte) error
- func (ds *DbServiceImpl) SubscribeChanges(table int, listener DbChangeListener)
- func (ds *DbServiceImpl) Watch(stopChannel chan struct{})
- type DbServiceSubscriber
- type GeoipCountry
- type GeoipSource
- type GlobalConfig
- type Logger
- func (l *Logger) Error(ctx context.Context, s string, args ...interface{})
- func (l *Logger) Info(ctx context.Context, s string, args ...interface{})
- func (l *Logger) LogMode(level gorm_logger.LogLevel) gorm_logger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, s string, args ...interface{})
Constants ¶
View Source
const ( CHANGELOG_TABLE_CONFIG = iota CHANGELOG_TABLE_GEOIP )
Variables ¶
View Source
var AutoMigrateTables = []interface{}{ ChangeLog{}, GlobalConfig{}, GeoipSource{}, GeoipCountry{}, }
Functions ¶
This section is empty.
Types ¶
type DBServiceGeoip ¶
type DBServiceGeoip interface { DbServiceSubscriber GetGeoipCountries() (map[string]bool, error) SetGeoipCountries(countryCodes []string, allow bool) error GetGeoipSourceTimestamp() (time.Time, error) GetGeoipSource() (*GeoipSource, error) SetGeoipSource(timestamp time.Time, source []byte) error }
Geoip plugin specific
type DbChangeListener ¶
type DbChangeListener interface {
NotifyDbChange(key string)
}
type DbService ¶
type DbService interface { DbServiceSubscriber // NotifyChange create a ChangeLog row to notify // to other nodes that there is a DB change // in a specific table, for a specific key NotifyChange(table int, key string) error // Watch() start a go routine, that will periodically // check if there is any changelog Watch(stopChannel chan struct{}) DbServiceConfig DBServiceGeoip }
type DbServiceConfig ¶
type DbServiceConfig interface { DbServiceSubscriber GetConfigs() (map[string]string, error) GetConfigValueForKey(key string) (string, error) SetConfigValueForKey(key string, value string) error }
General WAF configuration
type DbServiceImpl ¶
type DbServiceImpl struct {
// contains filtered or unexported fields
}
func (*DbServiceImpl) GetConfigValueForKey ¶
func (ds *DbServiceImpl) GetConfigValueForKey(key string) (string, error)
func (*DbServiceImpl) GetConfigs ¶
func (ds *DbServiceImpl) GetConfigs() (map[string]string, error)
func (*DbServiceImpl) GetGeoipCountries ¶
func (ds *DbServiceImpl) GetGeoipCountries() (map[string]bool, error)
GetGeoipAllow returns - an enmpty list (everything is allowed/deny) - or a specifc list of country code, + allow
func (*DbServiceImpl) GetGeoipSource ¶
func (ds *DbServiceImpl) GetGeoipSource() (*GeoipSource, error)
func (*DbServiceImpl) GetGeoipSourceTimestamp ¶
func (ds *DbServiceImpl) GetGeoipSourceTimestamp() (time.Time, error)
func (*DbServiceImpl) NotifyChange ¶
func (ds *DbServiceImpl) NotifyChange(table int, key string) error
func (*DbServiceImpl) SetConfigValueForKey ¶
func (ds *DbServiceImpl) SetConfigValueForKey(key string, value string) error
func (*DbServiceImpl) SetGeoipCountries ¶
func (ds *DbServiceImpl) SetGeoipCountries(countryCodes []string, allow bool) error
func (*DbServiceImpl) SetGeoipSource ¶
func (ds *DbServiceImpl) SetGeoipSource(timestamp time.Time, source []byte) error
func (*DbServiceImpl) SubscribeChanges ¶
func (ds *DbServiceImpl) SubscribeChanges(table int, listener DbChangeListener)
func (*DbServiceImpl) Watch ¶
func (ds *DbServiceImpl) Watch(stopChannel chan struct{})
type DbServiceSubscriber ¶
type DbServiceSubscriber interface { // Register to be notified when a changelog event // occurs on a given table SubscribeChanges(table int, listener DbChangeListener) }
type GeoipCountry ¶
type GeoipSource ¶
type GeoipSource struct { Timestamp time.Time Source []byte `gorm:"type:blob"` // Geoip2-Country.mmdb }
GeoipSource is a one row table to store the source of the Geoip2-Country.mmdb Database are usually not good at storing large binary data, but the database is centric to the application, and I dont want to introduce a new subsystem
type GlobalConfig ¶
Click to show internal directories.
Click to hide internal directories.