lib

package
v0.0.0-...-f276231 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: MIT Imports: 22 Imported by: 1

Documentation

Overview

Package lib contains code shared by httplive packages.

Index

Constants

View Source
const DefaultDbName = "httplive-1a.db"

DefaultDbName ...

View Source
const DefaultMemory = 32 * 1024 * 1024

DefaultMemory Form data ...

Variables

View Source
var Clients = make(map[string]*websocket.Conn)

Clients ...

View Source
var Environments = EnvironmentVariables{}

Environments ...

Functions

func APIMiddleware

func APIMiddleware() gin.HandlerFunc

APIMiddleware ...

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func Broadcast

func Broadcast(c *gin.Context)

Broadcast ...

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware ...

func CloseDb

func CloseDb()

CloseDb ...

func ConfigJsMiddleware

func ConfigJsMiddleware() gin.HandlerFunc

ConfigJsMiddleware ...

func CreateDbBucket

func CreateDbBucket() error

CreateDbBucket ...

func CreateEndpointKey

func CreateEndpointKey(method string, endpoint string) string

CreateEndpointKey ...

func DeleteEndpoint

func DeleteEndpoint(endpointKey string) error

DeleteEndpoint ...

func GetFormBody

func GetFormBody(c *gin.Context) interface{}

GetFormBody ...

func GetHeaders

func GetHeaders(c *gin.Context) map[string]string

GetHeaders ...

func GetIP

func GetIP(c *gin.Context) string

GetIP ...

func GetMultiPartFormValue

func GetMultiPartFormValue(c *gin.Context) interface{}

GetMultiPartFormValue ...

func GetRequestBody

func GetRequestBody(c *gin.Context) interface{}

GetRequestBody ...

func InitDbValues

func InitDbValues()

InitDbValues ...

func NewUUID

func NewUUID() (string, error)

NewUUID ...

func OpenDb

func OpenDb() error

OpenDb ...

func SaveEndpoint

func SaveEndpoint(model *APIDataModel) error

SaveEndpoint ...

func StaticFileMiddleware

func StaticFileMiddleware() gin.HandlerFunc

StaticFileMiddleware ...

func TryBind

func TryBind(c *gin.Context) interface{}

TryBind ...

func TryGetAssetFile

func TryGetAssetFile(c *gin.Context, filePath string)

TryGetAssetFile ...

func TryGetLocalFile

func TryGetLocalFile(c *gin.Context, filePath string)

TryGetLocalFile ...

Types

type APIDataModel

type APIDataModel struct {
	ID          int    `json:"id"`
	Endpoint    string `json:"endpoint"`
	Method      string `json:"method"`
	MimeType    string `json:"mimeType"`
	Filename    string `json:"filename"`
	FileContent []byte `json:"-"`
	Body        string `json:"body"`
}

APIDataModel ...

func EndpointList

func EndpointList() []APIDataModel

EndpointList ...

func GetEndpoint

func GetEndpoint(endpointKey string) (*APIDataModel, error)

GetEndpoint ...

type BasicAuthResponse

type BasicAuthResponse struct {
	Authenticated bool   `json:"authenticated"`
	User          string `json:"string"`
}

BasicAuthResponse ...

type CookiesResponse

type CookiesResponse struct {
	Cookies map[string]string `json:"cookies"`
}

CookiesResponse ...

type DeflateResponse

type DeflateResponse struct {
	HeadersResponse
	IPResponse
	Deflated bool `json:"deflated"`
}

DeflateResponse ...

type EndpointModel

type EndpointModel struct {
	OriginKey    string `form:"originKey"`
	Endpoint     string `form:"endpoint"`
	Method       string `form:"method"`
	IsFileResult bool   `form:"isFileResult"`
}

EndpointModel ...

type EnvironmentVariables

type EnvironmentVariables struct {
	WorkingDirectory string
	DatabaseFullPath string
	DefaultPort      string
	HasMultiplePort  bool
}

EnvironmentVariables ...

type GetResponse

type GetResponse struct {
	Args map[string][]string `json:"args"`
	HeadersResponse
	IPResponse
	URL string `json:"url"`
}

GetResponse ...

type GzipResponse

type GzipResponse struct {
	HeadersResponse
	IPResponse
	Gzipped bool `json:"gzipped"`
}

GzipResponse ...

type HeadersResponse

type HeadersResponse struct {
	Headers map[string]string `json:"headers"`
}

HeadersResponse ...

type IPResponse

type IPResponse struct {
	Origin string `json:"origin"`
}

IPResponse ...

type JSONResponse

type JSONResponse interface{}

JSONResponse ...

type JsTreeDataModel

type JsTreeDataModel struct {
	ID        int               `json:"id"`
	Key       string            `json:"key"`
	OriginKey string            `json:"originKey"`
	Text      string            `json:"text"`
	Type      string            `json:"type"`
	Children  []JsTreeDataModel `json:"children"`
}

JsTreeDataModel ...

type Pair

type Pair struct {
	Key   string
	Value APIDataModel
}

Pair ...

type PairList

type PairList []Pair

PairList ...

func OrderByID

func OrderByID(items map[string]APIDataModel) PairList

OrderByID ...

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

type PostResponse

type PostResponse struct {
	Args map[string][]string `json:"args"`
	Data JSONResponse        `json:"data"`
	Form map[string]string   `json:"form"`
	HeadersResponse
	IPResponse
	URL string `json:"url"`
}

PostResponse ...

type UserAgentResponse

type UserAgentResponse struct {
	UserAgent string `json:"user-agent"`
}

UserAgentResponse ...

type WebCliController

type WebCliController struct {
	Port string
}

WebCliController ...

func (WebCliController) Backup

func (ctrl WebCliController) Backup(c *gin.Context)

Backup ...

func (WebCliController) DeleteEndpoint

func (ctrl WebCliController) DeleteEndpoint(c *gin.Context)

DeleteEndpoint ...

func (WebCliController) DownloadFile

func (ctrl WebCliController) DownloadFile(c *gin.Context)

DownloadFile ...

func (WebCliController) Endpoint

func (ctrl WebCliController) Endpoint(c *gin.Context)

Endpoint ...

func (WebCliController) Save

func (ctrl WebCliController) Save(c *gin.Context)

Save ...

func (WebCliController) SaveEndpoint

func (ctrl WebCliController) SaveEndpoint(c *gin.Context)

SaveEndpoint ...

func (WebCliController) Tree

func (ctrl WebCliController) Tree(c *gin.Context)

Tree ...

type WsMessage

type WsMessage struct {
	Host   string              `json:"host"`
	Body   interface{}         `json:"body"`
	Header map[string]string   `json:"header"`
	Method string              `json:"method"`
	Path   string              `json:"path"`
	Query  map[string][]string `json:"query"`
}

WsMessage ...

Jump to

Keyboard shortcuts

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