Documentation ¶
Index ¶
- func Alive(c *gin.Context)
- func Broadcast(senderIP []byte, port int) error
- func CreateForward(c *gin.Context, Host string, IsHttps bool, CAPath string) func(*gin.Context)
- func Done(c *gin.Context, data ...interface{})
- func Error(c *gin.Context, errCode interface{}, err error, netCode ...int)
- func GenJWT(secret, Issuer, UserID, LoginFrom string, ExpireDuration time.Duration) (string, error)
- func GetVerTLSConfig(CAPath string) (*tls.Config, error)
- func GinJWTCheck() func(c *gin.Context)
- func GinNewRouterInit() *gin.Engine
- func GinRouterInit() *gin.Engine
- func GinRouterWithLogInit() *gin.Engine
- func GinSession(R *gin.Engine, path, domain, secret string, maxAge int) error
- func HostReverseProxy(w http.ResponseWriter, req *http.Request, targetHost *httputil.TargetHost)
- func HttpServer(addr string, handler http.Handler) *http.Server
- func InitFirewall(Port []string, Forward func(*gin.Context), Wall func() gin.HandlerFunc)
- func Logger(msgC chan string) gin.HandlerFunc
- func MiddleWare() gin.HandlerFunc
- func NewFormPost(target string, data interface{}) (*http.Request, error)
- func NewGet(target string) (*http.Request, error)
- func NewJsonPost(target string, data interface{}) (*http.Request, error)
- func NewReq(method, target string, data ...interface{}) (*http.Request, error)
- func PageNotFound(c *gin.Context)
- func StartHttpServer(addr string, handler http.Handler) error
- func StartMultiHttpServer(ServerList ...*http.Server) error
- func WebsocketServer(p func(ws *websocket.Conn) error) http.Handler
- type LogParams
- type PixuClaims
- type WebsocketHeartbeat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateForward ¶
func GinJWTCheck ¶
func GinNewRouterInit ¶
func GinRouterInit ¶
func GinRouterWithLogInit ¶
func HostReverseProxy ¶
func HostReverseProxy(w http.ResponseWriter, req *http.Request, targetHost *httputil.TargetHost)
func InitFirewall ¶
func InitFirewall(Port []string, Forward func(*gin.Context), Wall func() gin.HandlerFunc)
func Logger ¶
func Logger(msgC chan string) gin.HandlerFunc
func MiddleWare ¶
func MiddleWare() gin.HandlerFunc
func PageNotFound ¶
func StartMultiHttpServer ¶
Types ¶
type LogParams ¶
type LogParams struct { // TimeStamp shows the time after the server returns a response. TimeStamp time.Time `json:"TimeStamp" bson:"timestamp"` // StatusCode is HTTP response code. StatusCode int `json:"StatusCode" bson:"statuscode"` // Latency is how much time the server cost to process a certain request. Latency time.Duration `json:"Latency" bson:"latency"` // ClientIP equals Context's ClientIP method. ClientIP string `json:"ClientIP" bson:"clientip"` // Method is the HTTP method given to the request. Method string `json:"Method" bson:"method"` // Path is a path the client requests. Path string `json:"Path" bson:"path` // ErrorMessage is set if error has occurred in processing the request. ErrorMessage string `json:"ErrorMessage" bson:"errormessage"` // BodySize is the size of the Response Body BodySize int `json:"BodySize" bson:"bodysize"` // Keys are the keys set on the request's context. Keys map[string]interface{} `json:"Keys" bson:"keys"` }
type PixuClaims ¶
type PixuClaims struct { UserID string `json:"UserID"` LoginFrom string `json:"LoginFrom"` jwt.RegisteredClaims }
func ParseJWT ¶
func ParseJWT(secret, RawToken string) (*PixuClaims, error)
type WebsocketHeartbeat ¶
type WebsocketHeartbeat struct {
Alive string `json:"Alive"`
}
Click to show internal directories.
Click to hide internal directories.