repo

package
v0.0.0-...-27e5e2b Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 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 BucketRepo

type BucketRepo struct {
	Redis *redis.Client
	// contains filtered or unexported fields
}

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

type ListRepo struct {
	*postgres.Postgres
}

ListRepo -.

func NewListRepo

func NewListRepo(pg *postgres.Postgres) *ListRepo

func (*ListRepo) CheckColor

func (lr *ListRepo) CheckColor(ctx context.Context, subnet string) (string, error)

CheckColor checks if a subnet exists in the specified list.

func (*ListRepo) DeleteFromList

func (lr *ListRepo) DeleteFromList(ctx context.Context, subnet, color string) (string, error)

DeleteFromList subnet from lists -.

func (*ListRepo) Drop

func (lr *ListRepo) Drop() error

Drop attaches the provider and drop the table.

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

func (lr *ListRepo) SaveToList(ctx context.Context, subnet, color string) (bool, string, error)

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

func (lr *ListRepo) SearchIPInList(ctx context.Context, ip net.IP) string

SearchIPInList check if it is a given IP in the lists, returns color.

func (*ListRepo) Up

func (lr *ListRepo) Up() error

Jump to

Keyboard shortcuts

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