storage

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltConfigStorage

type BoltConfigStorage struct {
	// contains filtered or unexported fields
}

BoltConfigStorage bolt DB storage for config

func NewBoltConfigStorage

func NewBoltConfigStorage(timeout time.Duration, fileName string) (*BoltConfigStorage, error)

NewBoltConfigStorage bolt DB config storage constructor

func (*BoltConfigStorage) AddToBlackList

func (b *BoltConfigStorage) AddToBlackList(ctx context.Context, n *net.IPNet) error

AddToBlackList Method to add IP network to Blacklist

func (*BoltConfigStorage) AddToWhiteList

func (b *BoltConfigStorage) AddToWhiteList(ctx context.Context, n *net.IPNet) error

AddToWhiteList Method to add IP network to Whitelist

func (*BoltConfigStorage) CheckIP

func (b *BoltConfigStorage) CheckIP(ctx context.Context, ip net.IP) (bool, error)

CheckIP Method to check IP permissions with white/black lists

func (*BoltConfigStorage) Close

func (b *BoltConfigStorage) Close(ctx context.Context) error

Close Method to close connection to bolt DB

func (*BoltConfigStorage) DeleteFromBlackList

func (b *BoltConfigStorage) DeleteFromBlackList(ctx context.Context, n *net.IPNet) error

DeleteFromBlackList Method to delete IP network from Blacklist

func (*BoltConfigStorage) DeleteFromWhiteList

func (b *BoltConfigStorage) DeleteFromWhiteList(ctx context.Context, n *net.IPNet) error

DeleteFromWhiteList Method to delete IP network from Whitelist

type MapBucketStorage

type MapBucketStorage struct {
	Buckets map[string]interfaces.Bucket
	// contains filtered or unexported fields
}

MapBucketStorage Map bucket storage struct

func NewMapBucketStorage

func NewMapBucketStorage() *MapBucketStorage

NewMapBucketStorage Map bucket storage constructor

func (MapBucketStorage) Close

func (m MapBucketStorage) Close(ctx context.Context)

Close Method to close connection to storage (to implement Bucket storage interface)

func (MapBucketStorage) DeleteBucket

func (m MapBucketStorage) DeleteBucket(ctx context.Context, id string) error

DeleteBucket Method to delete bucket from storage

func (MapBucketStorage) GetBucket

func (m MapBucketStorage) GetBucket(ctx context.Context, id string) (interfaces.Bucket, error)

GetBucket Method to get bucket from storage

func (MapBucketStorage) SaveBucket

func (m MapBucketStorage) SaveBucket(ctx context.Context, id string, rateLimit uint64, bucket interfaces.Bucket) error

SaveBucket Method to save bucket into storage

type MapConfigStorage

type MapConfigStorage struct {
	Whitelist *models.NetList
	Blacklist *models.NetList
	// contains filtered or unexported fields
}

MapConfigStorage Map config storage struct

func NewMapConfigStorage

func NewMapConfigStorage() (*MapConfigStorage, error)

NewMapConfigStorage Map config storage constructor

func (MapConfigStorage) AddToBlackList

func (m MapConfigStorage) AddToBlackList(ctx context.Context, n *net.IPNet) error

AddToBlackList Method to add IP network to Blacklist

func (MapConfigStorage) AddToWhiteList

func (m MapConfigStorage) AddToWhiteList(ctx context.Context, n *net.IPNet) error

AddToWhiteList Method to add IP network to Whitelist

func (MapConfigStorage) CheckIP

func (m MapConfigStorage) CheckIP(ctx context.Context, ip net.IP) (bool, error)

CheckIP Method to check IP permissions with white/black lists

func (MapConfigStorage) Close

func (m MapConfigStorage) Close(ctx context.Context) error

Close Method to close connection to Map config storage (to implement ConfigStorage interface)

func (MapConfigStorage) DeleteFromBlackList

func (m MapConfigStorage) DeleteFromBlackList(ctx context.Context, n *net.IPNet) error

DeleteFromBlackList Method to delete IP network from Blacklist

func (MapConfigStorage) DeleteFromWhiteList

func (m MapConfigStorage) DeleteFromWhiteList(ctx context.Context, n *net.IPNet) error

DeleteFromWhiteList Method to delete IP network from Whitelist

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL