Documentation
¶
Index ¶
- type BucketRepo
- type ListRepo
- func (lr *ListRepo) CheckColor(ctx context.Context, subnet string) (string, error)
- func (lr *ListRepo) DeleteFromList(ctx context.Context, subnet, color string) (string, error)
- func (lr *ListRepo) Drop() error
- func (lr *ListRepo) IterateSubnets(ctx context.Context, subnetA, color string) (bool, string, error)
- func (lr *ListRepo) SaveToList(ctx context.Context, subnet, color string) (bool, string, error)
- func (lr *ListRepo) SearchIPInList(ctx context.Context, ip net.IP) string
- func (lr *ListRepo) Up() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketRepo ¶
BucketRepo -.
func NewBucketRepo ¶
func NewBucketRepo(r *redis.Client, cfg *config.AppConfig) *BucketRepo
NewBucketRepo -.
func (*BucketRepo) CheckLimit ¶
func (b *BucketRepo) CheckLimit(request models.Request) bool
func (*BucketRepo) ClearBucket ¶
func (b *BucketRepo) ClearBucket(request models.Request) error
type ListRepo ¶
ListRepo -.
func NewListRepo ¶
func (*ListRepo) CheckColor ¶
CheckColor checks if a subnet exists in the specified list.
func (*ListRepo) DeleteFromList ¶
DeleteFromList subnet from lists -.
func (*ListRepo) IterateSubnets ¶
func (lr *ListRepo) IterateSubnets(ctx context.Context, subnetA, color string) (bool, string, error)
IterateSubnets checks if IP address ranges overlap. Returns false and message if there is an overlap conflict, true and empty string - if not.
func (*ListRepo) SaveToList ¶
SaveToList return (true, "", nil) if it is successfully added, return false if something went wrong, such as 1. internal error - return (false, empty string, error) 2. overlap conflict - return (false, message about conflict, nil).
func (*ListRepo) SearchIPInList ¶
SearchIPInList check if it is a given IP in the lists, returns color.
Click to show internal directories.
Click to hide internal directories.