engine

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCore

func RunCore(ip string, port int, path string, opt ...config.Opt) error

RunCore 函数负责启动 gin 实例,开始提供 HTTP 服务

Types

type Context

type Context struct {
	gin.Context
}

type Engine

type Engine struct {
	*gin.Engine
	*config.Config
}

func Default

func Default() *Engine

func New

func New(mode Mode) *Engine

func NewWithConfig

func NewWithConfig(mode Mode, c *config.Config) *Engine

func (*Engine) CheckLevel

func (e *Engine) CheckLevel() gin.HandlerFunc

CheckLevel 负责检查当前访问层级是否超出设定最大层级 例如:

共享目录为 /a/b/ , 最大层级为 2
✓: /a/b/			根目录
✓: /a/b/file	    根目录下文件
✓: /a/b/c/			根目录下第一层目录
✓: /a/b/c/file		根目录下第一层目录下的文件
✓: /a/b/c/d/		根目录下第二层目录
✓: /a/b/c/d/file	根目录下第二层目录下的文件
x: /a/b/c/d/e/		根目录下第三层目录
x: /a/b/c/d/e/file	根目录下第三层目录下的文件

func (*Engine) CheckLogin

func (e *Engine) CheckLogin() gin.HandlerFunc

func (*Engine) InterceptICO

func (e *Engine) InterceptICO() gin.HandlerFunc

InterceptICO 拦截浏览器默认请求 favicon.ico 的行为

func (*Engine) PrintInfo

func (e *Engine) PrintInfo(opt ...config.PrintOpt) *Engine

func (*Engine) Run

func (e *Engine) Run(ports ...int) error

func (*Engine) SetConfig

func (e *Engine) SetConfig(ip string, port int, path string, opt ...config.Opt) *Engine

func (*Engine) SetMiddleware

func (e *Engine) SetMiddleware() *Engine

func (*Engine) SetRoute

func (e *Engine) SetRoute() *Engine

type Mode

type Mode string
const (
	Debug   Mode = "debug"
	Release Mode = "release"
	Test    Mode = "test"
)

Jump to

Keyboard shortcuts

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