lib

package
v0.0.0-...-aa48f79 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package lib contains code shared by httplive packages.

Index

Constants

This section is empty.

Variables

View Source
var Broadcast = make(chan WsMessage)

Broadcast ...

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

Clients ...

View Source
var Database = "httplive.db"

Database ...

View Source
var DatabasePath string

DatabasePath ...

View Source
var Environments = EnvironmentVariables{DatabaseName: "httplive.db"}

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 AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

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

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

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 GetBodyJSON

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

GetBodyJSON ...

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 HandleMessages

func HandleMessages()

HandleMessages ...

func InitDbValues

func InitDbValues()

InitDbValues ...

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewUUID

func NewUUID() (string, error)

NewUUID ...

func OpenDb

func OpenDb() error

OpenDb ...

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SaveEndpoint

func SaveEndpoint(model *APIDataModel) error

SaveEndpoint ...

func StaticFileMiddleware

func StaticFileMiddleware() gin.HandlerFunc

StaticFileMiddleware ...

Types

type APIDataModel

type APIDataModel struct {
	ID       int    `json:"id"`
	Endpoint string `json:"endpoint"`
	Method   string `json:"method"`
	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 `json:originKey`
	Endpoint  string `json:"endpoint"`
	Method    string `json:"method"`
}

EndpointModel ...

type EnvironmentVariables

type EnvironmentVariables struct {
	DbFile                   string
	DatabaseName             string
	DatabaseAttachedFullPath 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) 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"`
	URL    string            `json:"url"`
	Method string            `json:"method"`
	Path   string            `json:"path"`
}

WsMessage ...

Jump to

Keyboard shortcuts

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