Documentation ¶
Index ¶
- Variables
- func GetRequestBody(c *gin.Context) ([]byte, error)
- func Init()
- func InitRedisClient() (err error)
- func RedisDel(key string) error
- func RedisGet(key string) (string, error)
- func RedisSet(key string, value string, expiration time.Duration) error
- func SetEventStreamHeaders(c *gin.Context)
- func UnmarshalBodyReusable(c *gin.Context, v any) error
- type CustomEvent
- type InMemoryRateLimiter
- type RateLimitWindow
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UsingSQLite = false UsingPostgreSQL = false UsingMySQL = false )
View Source
var ( SQLitePath = "aiproxy.db" SQLiteBusyTimeout = env.Int("SQLITE_BUSY_TIMEOUT", 3000) )
View Source
var ( Port = flag.Int("port", 3000, "the listening port") LogDir = flag.String("log-dir", "", "specify the log directory") )
View Source
var ( RDB *redis.Client RedisEnabled = false )
View Source
var StartTime = time.Now().UnixMilli() // unit: millisecond
Functions ¶
func InitRedisClient ¶
func InitRedisClient() (err error)
InitRedisClient This function is called after init()
func SetEventStreamHeaders ¶
Types ¶
type CustomEvent ¶
func (CustomEvent) Render ¶
func (r CustomEvent) Render(w http.ResponseWriter) error
func (CustomEvent) WriteContentType ¶
func (r CustomEvent) WriteContentType(w http.ResponseWriter)
type InMemoryRateLimiter ¶
type InMemoryRateLimiter struct {
// contains filtered or unexported fields
}
func (*InMemoryRateLimiter) Init ¶
func (l *InMemoryRateLimiter) Init(expirationDuration time.Duration)
type RateLimitWindow ¶
type RateLimitWindow struct {
// contains filtered or unexported fields
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.