resttunnel

package
v0.0.0-...-d0d75a4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliveResponse

type AliveResponse struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Reverse bool   `json:"reverse"`
}

AliveResponse represents the response to /alive

type AnalyticResponse

type AnalyticResponse struct {
	Uptime string `json:"uptime"`
	Charts struct {
		Hits            LineChart `json:"hits"`
		Misses          LineChart `json:"misses"`
		Waiting         LineChart `json:"waiting"`
		Requests        LineChart `json:"requests"`
		Callbacks       LineChart `json:"callbacks"`
		AverageResponse LineChart `json:"average_response"`
	} `json:"charts"`
	Numbers struct {
		Hits     int64 `json:"hits"`
		Misses   int64 `json:"misses"`
		Requests int64 `json:"requests"`
		Waiting  int64 `json:"waiting"`
	} `json:"numbers"`
}

AnalyticResponse returns the response to an api/analytics request

type DataStamp

type DataStamp struct {
	Time  interface{} `json:"x"`
	Value interface{} `json:"y"`
}

DataStamp is a struct to store a time and a corresponding value

type Dataset

type Dataset struct {
	Label            string        `json:"label"`
	BackgroundColour string        `json:"backgroundColor,omitempty"`
	BorderColour     string        `json:"borderColor,omitempty"`
	Data             []interface{} `json:"data"`
}

Dataset is a struct to store data for a Chart

type LineChart

type LineChart struct {
	Labels   []string  `json:"labels,omitempty"`
	Datasets []Dataset `json:"datasets"`
}

LineChart is a struct to store LineChart data easier

type RateLimitResponse

type RateLimitResponse struct {
	Message    string        `json:"message"`
	RetryAfter time.Duration `json:"retry_after"`
	Global     bool          `json:"global"`
}

RateLimitResponse represents the structure of a ratelimit message from discord

type ResponseType

type ResponseType int8

ResponseType represents the type of response the client wants

const (
	// RespondWithResponse defines the client wants the response.
	RespondWithResponse ResponseType = iota
	// RespondWithUUIDCallback defines the client will want the response at a later time.
	RespondWithUUIDCallback
	// NoResponse defines the client does not want the response.
	NoResponse
)

func ParseResponse

func ParseResponse(responseStr string) (ResponseType, error)

ParseResponse converts a response string into a ResponseType value. returns an error if the input string does not match known values.

func (ResponseType) String

func (rt ResponseType) String() string

type TooManyRequests

type TooManyRequests struct {
	Global     bool   `json:"global"`
	Message    string `json:"message"`
	RetryAfter int64  `json:"retry_after"`
}

TooManyRequests is the response structure when being ratelimited

type TunnelRequest

type TunnelRequest struct {
	ID uuid.UUID

	Req *fasthttp.RequestCtx

	URI         []byte
	Body        []byte
	Method      string
	QueryString []byte

	Headers *fasthttp.RequestHeader

	ResponseType ResponseType
	Priority     bool

	Bucket   string
	Callback chan bool
}

TunnelRequest represents a RestTunnel request

type TunnelResponse

type TunnelResponse struct {
	Expiration time.Time

	CompleteC chan bool

	Complete     bool
	ID           uuid.UUID
	RatelimitHit bool
	Response     *fasthttp.Response
	Error        error
}

TunnelResponse represents a RestTunnel response

Jump to

Keyboard shortcuts

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