http

package
v0.0.0-...-b87ab60 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS() gin.HandlerFunc

func CheckSign

func CheckSign(cfg *cfgargs.SrvConfig) gin.HandlerFunc

func GetAPIString

func GetAPIString(host, path string) string

func IPWhiteList

func IPWhiteList(whitelist map[string]bool) gin.HandlerFunc

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient() *Client

NewClient Return a new http client.

func (*Client) GetGoReq

func (c *Client) GetGoReq() *gorequest.SuperAgent

func (*Client) GetWithQueryParams

func (c *Client) GetWithQueryParams(url string, vals url.Values, respModel interface{}) error

GetWithQueryParams Send a Get request and unmarshal.

func (*Client) ObjectToUrlValues

func (c *Client) ObjectToUrlValues(obj interface{}) url.Values

ObjectToUrlValues marshal interface{} into url.Values with `json` tags

func (*Client) PostForm

func (c *Client) PostForm(url string, vals url.Values, respModel interface{}) error

func (*Client) PostJson

func (c *Client) PostJson(url string, reqModel, respModel interface{}) error

PostJson Post with marshal interface{} request and unmarshal response body

type NodeRoute

type NodeRoute struct {
	// contains filtered or unexported fields
}

func NewNodeRoute

func NewNodeRoute(path string, routers ...*Route) *NodeRoute

type Route

type Route struct {
	// contains filtered or unexported fields
}

func NewRoute

func NewRoute(method, path string, handler gin.HandlerFunc) *Route

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server ...

func NewServer

func NewServer() *Server

NewServer ...

func (*Server) AddNodeRoute

func (s *Server) AddNodeRoute(nodes ...*NodeRoute)

func (*Server) Init

func (s *Server) Init(cfg *cfgargs.SrvConfig)

Init Read HTTP configuration: cross-domain, signature, Release

func (*Server) Run

func (s *Server) Run() error

Run Route and start HTTP based on the port of the yaml file.

func (*Server) Use

func (s *Server) Use(middlewares ...gin.HandlerFunc)

Jump to

Keyboard shortcuts

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