Documentation
¶
Index ¶
- Constants
- Variables
- func BuildUrl(url string) string
- func ContainsString(arr *[]string, target *string) bool
- func EnforceHTTP(url string) string
- func GetUserIP(r *http.Request) string
- func LowestUnixTime() int64
- func NotValidShortString(short *string) bool
- func RateLimit(r *http.Request, auth string, defaultLimit *URLLimit) (time.Duration, error)
- func RedisSetup()
- func RemoverDomainError(url string) bool
- func SendJSONError(w http.ResponseWriter, statusCode int, errorMessage string)
- func SetHeaders(type_ string, w http.ResponseWriter, status int)
- func SetupTracker(dur time.Duration, maxEvents int, eventsLength int)
- func SystemUnderMaintenance(revalidate bool) bool
- func TimeRemaining(duration time.Duration) string
- type ErrorResponse
- type RateConfig
- type RateLimitLog
- type RedisDB
- type SystemConfig
- type SystemConfigKey
- type TrackEventType
- type TrackerType
- type URLLimit
Constants ¶
View Source
const RateConfigName string = "rate_limit_config"
View Source
const RateConfigNameCacheKey string = "cached_rate_limit_config"
Variables ¶
View Source
var ENV string
View Source
var Redis = &RedisDB{}
Functions ¶
func ContainsString ¶
func EnforceHTTP ¶
func LowestUnixTime ¶
func LowestUnixTime() int64
func NotValidShortString ¶
func RedisSetup ¶
func RedisSetup()
func RemoverDomainError ¶
func SendJSONError ¶
func SendJSONError(w http.ResponseWriter, statusCode int, errorMessage string)
func SetHeaders ¶
func SetHeaders(type_ string, w http.ResponseWriter, status int)
func SystemUnderMaintenance ¶
func TimeRemaining ¶
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type RateConfig ¶
type RateConfig struct { Name string `json:"name"` Limit map[string]*URLLimit `json:"limit"` ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` }
func GetRateConfig ¶
func GetRateConfig(revalidateCache bool) *RateConfig
type RateLimitLog ¶
type SystemConfig ¶
type SystemConfig struct { Name SystemConfigKey `json:"name"` Maintenance bool `json:"maintenance"` ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` }
func GetDefaultSystemConfig ¶
func GetDefaultSystemConfig() *SystemConfig
func GetSystemConfig ¶
func GetSystemConfig(revalidateCache bool) *SystemConfig
type SystemConfigKey ¶
type SystemConfigKey string
const SystemConfigName SystemConfigKey = "system_limit_config"
const SystemConfigNameCacheKey SystemConfigKey = "cached_system_limit_config"
type TrackEventType ¶
type TrackEventType string
type TrackerType ¶
type TrackerType struct {
// contains filtered or unexported fields
}
var Tracker *TrackerType
func (*TrackerType) CaptureRedirectEvent ¶
func (*TrackerType) StartFlush ¶
func (eq *TrackerType) StartFlush()
Click to show internal directories.
Click to hide internal directories.