Versions in this module Expand all Collapse all v1 v1.0.1 Jul 31, 2025 Changes in this version + const DEBUG + const DEFAULT_DELIMITER + const DEFAULT_MAX_TOKENS + const DEFAULT_TOKEN_RENEW_TIME + const DIR_PERM + const ERROR + const FILE_PERM + const INFO + const SECONDS_PER_DAY + const SECONDS_PER_HOUR + const SECONDS_PER_MINUTE + const TIMESTAMP_BYTE_SIZE + const TOKEN_BYTE_SIZE + func ConvGroup(raw models.GroupRaw, delimiter string) *models.Group + func InitTM[T any](config models.ConfigRaw, groups []models.GroupRaw) (models.IManager[T], error) + func SanitizeInput(input string) string + func ValidateConfig(config models.ConfigRaw) error + func ValidateGroupRaw(group models.GroupRaw) error + func ValidateIPAddress(ip string) error + func ValidateTokenFormat(token string) bool + type ConcurrentMap struct + func NewConcurrentMap[K comparable, V any](shardNum int) *ConcurrentMap[K, V] + func (cm *ConcurrentMap[K, V]) Clear() + func (cm *ConcurrentMap[K, V]) Delete(key K) bool + func (cm *ConcurrentMap[K, V]) Get(key K) (V, bool) + func (cm *ConcurrentMap[K, V]) Keys() []K + func (cm *ConcurrentMap[K, V]) Range(fn func(K, V) bool) + func (cm *ConcurrentMap[K, V]) Set(key K, value V) + func (cm *ConcurrentMap[K, V]) Size() int + type Manager struct + func (tm *Manager[T]) AddGroup(raw *models.GroupRaw) error + func (tm *Manager[T]) AddToken(userID uint, groupID uint, clientIp string) (string, error) + func (tm *Manager[T]) Auth(key string, clientIp string, api string) error + func (tm *Manager[T]) BatchAuth(key string, clientIp string, apis []string) []bool + func (tm *Manager[T]) BatchDeleteExpiredTokens() error + func (tm *Manager[T]) BatchDeleteTokensByGroupIDs(groupIDs []uint) error + func (tm *Manager[T]) BatchDeleteTokensByUserIDs(userIDs []uint) error + func (tm *Manager[T]) CleanExpiredTokens() + func (tm *Manager[T]) DelGroup(groupID uint) error + func (tm *Manager[T]) DelToken(key string) error + func (tm *Manager[T]) DelTokensByGroupID(groupID uint) error + func (tm *Manager[T]) DelTokensByUserID(userID uint) error + func (tm *Manager[T]) GenerateToken() (string, error) + func (tm *Manager[T]) GetGroup(groupID uint) (*models.Group, error) + func (tm *Manager[T]) GetStats() models.Stats + func (tm *Manager[T]) GetToken(key string) (*models.Token[T], error) + func (tm *Manager[T]) GetTokensByGroupID(groupID uint) []*models.Token[T] + func (tm *Manager[T]) GetTokensByUserID(userID uint) []*models.Token[T] + func (tm *Manager[T]) GetUserData(key string) (T, error) + func (tm *Manager[T]) SetUserData(key string, data T) error + func (tm *Manager[T]) UpdateAllGroup(groups []models.GroupRaw) error + func (tm *Manager[T]) UpdateGroup(groupID uint, raw *models.GroupRaw) error + func (tm *Manager[T]) UpdateToken(key string, token *models.Token[T]) error + type RWMutexWithTimeout struct + func NewRWMutexWithTimeout(timeout time.Duration) *RWMutexWithTimeout + func (rw *RWMutexWithTimeout) RUnlock() + func (rw *RWMutexWithTimeout) TryLockWithTimeout(ctx context.Context) bool + func (rw *RWMutexWithTimeout) TryRLockWithTimeout(ctx context.Context) bool + func (rw *RWMutexWithTimeout) Unlock() + type SecurityManager struct + func NewSecurityManager(password string) *SecurityManager + func NewSecurityManagerWithSalt(password string, salt []byte) *SecurityManager + func (sm *SecurityManager) DecryptToken(ciphertext string) (string, error) + func (sm *SecurityManager) EncryptToken(plaintext string) (string, error) + func (sm *SecurityManager) HashSensitiveData(data string) string + func (sm *SecurityManager) RotateKey(newPassword string) + type WorkerPool struct + func NewWorkerPool(workerCount int) *WorkerPool + func (wp *WorkerPool) Start() + func (wp *WorkerPool) Stop() + func (wp *WorkerPool) Submit(job func()) bool