Documentation ¶
Index ¶
- Constants
- Variables
- type DBUpdated
- type FQDNRuleIdIndexer
- type IPNetIndexer
- type IndexID
- type IntegrityChecker
- func IntegrityChecker4CidrSgRules() IntegrityChecker
- func IntegrityChecker4FqdnRules() IntegrityChecker
- func IntegrityChecker4Networks() IntegrityChecker
- func IntegrityChecker4SG() IntegrityChecker
- func IntegrityChecker4SGRules() IntegrityChecker
- func IntegrityChecker4SgIcmpRules() IntegrityChecker
- func IntegrityChecker4SgSgIcmpRules() IntegrityChecker
- type MemDB
- type MemDBTables
- type MemDbIndexSchema
- type MemDbIterator
- type MemDbOption
- type MemDbReader
- type MemDbSchema
- type MemDbSchemaInit
- type MemDbStringFieldIndex
- type MemDbTableSchema
- type MemDbWriter
- type Option
- type ProtoSgTrafficIndexer
- type Reader
- type Registry
- type SGRuleIdIndexer
- type Scope
- func And(t1 Scope, t2 Scope) Scope
- func IPs(one net.IP, all bool, other ...net.IP) Scope
- func NetworkNames(names ...model.NetworkName) Scope
- func Not(t Scope) Scope
- func Or(t1 Scope, t2 Scope) Scope
- func PKScopeOfFQDNRules(others ...model.FQDNRule) Scope
- func PKScopeOfSGRules(others ...model.SGRule) Scope
- func PKScopeOfSgIcmpRules(rules ...model.SgIcmpRule) Scope
- func PKScopeOfSgSgIcmpRules(rules ...model.SgSgIcmpRule) Scope
- func PKScopedCidrSgRules(rules ...model.CidrSgRule) Scope
- func SG(names ...string) Scope
- func SGFrom(one string, other ...string) Scope
- func SGTo(one string, other ...string) Scope
- type ScopedNetTransport
- type SgIcmpIdIndexer
- type SgSgIcmpIdIndexer
- type SingleObjectIndexer
- type SyncOmitDelete
- type SyncOmitInsert
- type SyncOmitUpdate
- type TableID
- type Writer
Constants ¶
const (
// NotifyCommit -
NotifyCommit = "commit"
)
const SchemaName = "sgroups"
SchemaName database scheme name
Variables ¶
var ( // ErrNoRegistry - ErrNoRegistry = errors.New("no registry available") // ErrWriterClosed - ErrWriterClosed = errors.New("writer is closed") // ErrReaderClosed - ErrReaderClosed = errors.New("reader is closed") )
var ErrUnexpectedScope = errors.New("unexpected scope")
ErrUnexpectedScope -
var ErrValidate = errors.New("validation failure")
ErrValidate validation failure
var NoScope noScope
NoScope no any scope
Functions ¶
This section is empty.
Types ¶
type FQDNRuleIdIndexer ¶
type FQDNRuleIdIndexer struct{} //nolint:revive
FQDNRuleIdIndexer indexer
func (FQDNRuleIdIndexer) FromObject ¶
FromObject impl Indexer
type IPNetIndexer ¶
type IPNetIndexer struct {
DataAccessor func(obj interface{}) interface{}
}
IPNetIndexer indexer
func (IPNetIndexer) FromArgs ¶
func (idx IPNetIndexer) FromArgs(args ...interface{}) ([]byte, error)
FromArgs impl Indexer
func (IPNetIndexer) FromObject ¶
func (idx IPNetIndexer) FromObject(obj interface{}) (bool, []byte, error)
FromObject impl Indexer
type IntegrityChecker ¶
type IntegrityChecker func(MemDbReader) error
IntegrityChecker mem db data integrity checker
func IntegrityChecker4CidrSgRules ¶
func IntegrityChecker4CidrSgRules() IntegrityChecker
IntegrityChecker4CidrSgRules -
func IntegrityChecker4FqdnRules ¶
func IntegrityChecker4FqdnRules() IntegrityChecker
IntegrityChecker4FqdnRules checks SG Rules restrictions
func IntegrityChecker4Networks ¶
func IntegrityChecker4Networks() IntegrityChecker
func IntegrityChecker4SG ¶
func IntegrityChecker4SG() IntegrityChecker
IntegrityChecker4SG checks if every network belongs to only one SG
func IntegrityChecker4SGRules ¶
func IntegrityChecker4SGRules() IntegrityChecker
IntegrityChecker4SGRules checks SG Rules restrictions
func IntegrityChecker4SgIcmpRules ¶
func IntegrityChecker4SgIcmpRules() IntegrityChecker
IntegrityChecker4SgIcmpRules -
func IntegrityChecker4SgSgIcmpRules ¶
func IntegrityChecker4SgSgIcmpRules() IntegrityChecker
IntegrityChecker4SgIcmpRules -
type MemDB ¶
type MemDB interface { Reader() MemDbReader Writer() MemDbWriter Schema() *MemDbSchema }
MemDB memory db impl
func NewMemDB ¶
func NewMemDB(opts ...MemDbOption) (MemDB, error)
NewMemDB creates memory db instance
type MemDbIndexSchema ¶
type MemDbIndexSchema = memdb.IndexSchema
MemDbIndexSchema alias to memdb.IndexSchema
type MemDbIterator ¶
type MemDbIterator = memdb.ResultIterator
MemDbIterator alias to memdb.ResultIterator
type MemDbOption ¶
type MemDbOption interface {
// contains filtered or unexported methods
}
MemDbOption update option
type MemDbReader ¶
type MemDbReader interface { First(tabName TableID, index IndexID, args ...interface{}) (interface{}, error) Get(tabName TableID, index IndexID, args ...interface{}) (MemDbIterator, error) }
MemDbReader reader interface
type MemDbSchemaInit ¶
type MemDbSchemaInit func(*MemDbSchema)
MemDbSchemaInit init mem db schema Option
type MemDbStringFieldIndex ¶
type MemDbStringFieldIndex = memdb.StringFieldIndex
MemDbStringFieldIndex alias to MemDbStringFieldIndex
type MemDbTableSchema ¶
type MemDbTableSchema = memdb.TableSchema
MemDbTableSchema alias to memdb.TableSchema
type MemDbWriter ¶
type MemDbWriter interface { MemDbReader Commit() error Abort() Upsert(tabName TableID, obj interface{}) error Delete(tabName TableID, obj interface{}) error DeleteAll(tabName TableID, index IndexID, args ...interface{}) (int, error) }
MemDbWriter writer interface
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option sync option
type ProtoSgTrafficIndexer ¶
type ProtoSgTrafficIndexer struct{}
ProtoSgTrafficIndexer -
type Reader ¶
type Reader interface { Close() error // contains filtered or unexported methods }
Reader db reader abstract
type Registry ¶
type Registry interface { Subject() patterns.Subject Writer(ctx context.Context) (Writer, error) Reader(ctx context.Context) (Reader, error) Close() error }
Registry abstract db registry
func NewRegistryFromMemDB ¶
NewRegistryFromMemDB new Registry from MemDB
type SGRuleIdIndexer ¶
type SGRuleIdIndexer struct{} //nolint:revive
SGRuleIdIndexer indexer
func (SGRuleIdIndexer) FromObject ¶
FromObject impl Indexer
type Scope ¶
type Scope interface {
// contains filtered or unexported methods
}
Scope scope interface
func NetworkNames ¶
func NetworkNames(names ...model.NetworkName) Scope
NetworkNames makes networks name(s) scope
func PKScopeOfFQDNRules ¶
PKScopeOfFQDNRules makes FQDN rule scope
func PKScopeOfSGRules ¶
PKScopeOfSGRules makes SG rule scope
func PKScopeOfSgIcmpRules ¶
func PKScopeOfSgIcmpRules(rules ...model.SgIcmpRule) Scope
PKScopeOfSgIcmpRules makes SG:ICMP prinary rule scope
func PKScopeOfSgSgIcmpRules ¶
func PKScopeOfSgSgIcmpRules(rules ...model.SgSgIcmpRule) Scope
PKScopeOfSgSgIcmpRules makes SG-SG:ICMP prinary rule scope
func PKScopedCidrSgRules ¶
func PKScopedCidrSgRules(rules ...model.CidrSgRule) Scope
PKScopedCidrSgRules makes PROTO:CIDR:SG:TRAFFIC prinary rule scope
type ScopedNetTransport ¶
type ScopedNetTransport model.NetworkTransport
ScopedNetTransport network transport scope
type SgIcmpIdIndexer ¶
type SgIcmpIdIndexer struct{}
SgIcmpIdIndexer -
func (SgIcmpIdIndexer) FromObject ¶
FromObject impl Indexer
type SgSgIcmpIdIndexer ¶
type SgSgIcmpIdIndexer struct{}
SgSgIcmpIdIndexer -
func (SgSgIcmpIdIndexer) FromObject ¶
FromObject impl Indexer
type SingleObjectIndexer ¶
type SingleObjectIndexer[T any] struct { // contains filtered or unexported fields }
SingleObjectIndexer -
func (SingleObjectIndexer[T]) FromArgs ¶
func (idx SingleObjectIndexer[T]) FromArgs(args ...any) ([]byte, error)
FromArgs -
func (SingleObjectIndexer[T]) FromObject ¶
func (idx SingleObjectIndexer[T]) FromObject(obj any) (bool, []byte, error)
FromObject -
type TableID ¶
type TableID int
TableID memory table ID
const ( // TblNetworks table 'networks' TblNetworks TableID = iota // TblSecGroups table 'security groups' TblSecGroups // TblSecRules table 'security rules' TblSecRules // TblSecRules table 'sync-status' TblSyncStatus // TblFqdnRules table 'fqdn rules' TblFqdnRules // TblSgIcmpRules table SG:ICMP<4|6> rules TblSgIcmpRules // TblSgIcmpRules table SG-SG:ICMP<4|6> rules TblSgSgIcmpRules // TblCidrSgRules table l4-proto:[INGRESS|EGRESS]-CIDR-SG rules TblCidrSgRules )
func (TableID) IntegrityChecks ¶
func (tid TableID) IntegrityChecks() []IntegrityChecker
IntegrityChecks -
type Writer ¶
type Writer interface { SyncNetworks(ctx context.Context, networks []model.Network, scope Scope, opts ...Option) error SyncSecurityGroups(ctx context.Context, sgs []model.SecurityGroup, scope Scope, opts ...Option) error SyncSGRules(ctx context.Context, rules []model.SGRule, scope Scope, opts ...Option) error SyncFqdnRules(ctx context.Context, rules []model.FQDNRule, scope Scope, opts ...Option) error SyncSgIcmpRules(ctx context.Context, rules []model.SgIcmpRule, scope Scope, opts ...Option) error SyncSgSgIcmpRules(ctx context.Context, rules []model.SgSgIcmpRule, scope Scope, opts ...Option) error SyncCidrSgRules(ctx context.Context, rules []model.CidrSgRule, scope Scope, opts ...Option) error Commit() error Abort() }
Writer db writer abstract