Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigureDiscordHTTPClient(ip string, timeout time.Duration)
- func EnvGet(name string, defaultVal string) string
- func EnvGetInt(name string, defaultVal int) int
- func EnvMustGet(name string) string
- func GetBotGlobalLimit(token string) (uint, error)
- func GetBotId(token string) string
- func GetMetricsPath(route string) string
- func GetOptimisticBucketPath(url string, method string) string
- func GetSnowflakeCreatedAt(snowflake string) (time.Time, error)
- func HashCRC64(data string) uint64
- func IsNumericInput(str string) bool
- func IsSnowflake(str string) bool
- func ProcessRequest(ctx context.Context, item *QueueItem) (*http.Response, error)
- func SetLogger(l *logrus.Logger)
- func StartMetrics(addr string)
- func StartProfileServer()
- type BotGatewayResponse
- type BotUserResponse
- type QueueChannel
- type QueueItem
- type RequestQueue
Constants ¶
View Source
const ( MajorUnknown = "unk" MajorChannels = "channels" MajorGuilds = "guilds" MajorWebhooks = "webhooks" MajorInvites = "invites" MajorInteractions = "interactions" )
View Source
const EpochDiscord = 1420070400000
Variables ¶
View Source
var ( ErrorCounter = promauto.NewCounter(prometheus.CounterOpts{ Name: "nirn_proxy_error", Help: "The total number of errors when processing requests", }) RequestHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "nirn_proxy_requests", Help: "Request histogram", Buckets: []float64{.1, .25, 1, 2.5, 5, 20}, }, []string{"method", "status", "route", "clientId"}) ConnectionsOpen = promauto.NewGauge(prometheus.GaugeOpts{ Name: "nirn_proxy_open_connections", Help: "Gauge for client connections currently open with the proxy", }) )
Functions ¶
func EnvMustGet ¶
func GetBotGlobalLimit ¶
func GetMetricsPath ¶
func GetOptimisticBucketPath ¶
func IsNumericInput ¶
func IsSnowflake ¶
func ProcessRequest ¶
func StartMetrics ¶
func StartMetrics(addr string)
func StartProfileServer ¶
func StartProfileServer()
Types ¶
type BotGatewayResponse ¶
type BotUserResponse ¶
type BotUserResponse struct { Id string `json:"id"` Username string `json:"username"` Discrim string `json:"discriminator"` }
func GetBotUser ¶
func GetBotUser(token string) (*BotUserResponse, error)
type QueueChannel ¶
type QueueChannel struct {
// contains filtered or unexported fields
}
type QueueItem ¶
type QueueItem struct { Req *http.Request Res *http.ResponseWriter // contains filtered or unexported fields }
type RequestQueue ¶
func NewRequestQueue ¶
func NewRequestQueue(processor func(ctx context.Context, item *QueueItem) (*http.Response, error), globalLimit uint, bufferSize int, user *BotUserResponse) *RequestQueue
Click to show internal directories.
Click to hide internal directories.