Documentation ¶
Index ¶
- Constants
- Variables
- func AddAuthChecker(authLevels []int, ...)
- func AddCmd(name, comment string, function func())
- func AddShutdownHook(f func())
- func CacheByMemory(key string, seconds int64, maker func() any) any
- func CheckCmd()
- func ClearMemoryCache(key string)
- func DefaultAuthChecker(authLevel int, logger *log.Logger, url *string, in map[string]any, ...) (pass bool, sessionObject any)
- func ForForm(in any) any
- func GetAuthTokenLevel(authToken string) int
- func GetCPUMemoryStat() (uint, uint)
- func GetDomainWithScope(request *http.Request, scope string) string
- func GetInject(dataType reflect.Type) any
- func GetLocalPublicIP() []string
- func GetServerAddr() string
- func GetSessionId(request *http.Request) string
- func Id10(space string) string
- func Id10L(space string) string
- func Id12(space string) string
- func Id12L(space string) string
- func Id6(space string) string
- func Id6L(space string) string
- func Id8(space string) string
- func Id8L(space string) string
- func IgnoreTplTags(functions template.FuncMap, tags ...string) template.FuncMap
- func Init()
- func InitConfig()
- func IsRunning() bool
- func MakeArgots(argots any)
- func MakeDocument() ([]Api, []ArgotInfo)
- func MakeHtmlDocumentFile(title, toFile string) string
- func MakeHtmlDocumentFromFile(title, toFile, fromFile string) string
- func MakeJsonDocument() string
- func MakeJsonDocumentFile(file string)
- func MakeTpl(data any, functions template.FuncMap, text string) string
- func MakeTplOut(writer io.Writer, data any, functions template.FuncMap, text string)
- func MakeUrl(request *http.Request, path string) string
- func NewTimerServer(name string, interval time.Duration, run func(*bool), start func(), ...)
- func Proxy(authLevel int, path string, toApp, toPath string)
- func Publish(channel, data string) bool
- func Register(authLevel int, path string, serviceFunc any, memo string)
- func RegisterSimpleWebsocket(authLevel int, path string, onOpen any, memo string)
- func RegisterSimpleWebsocketWithOptions(authLevel int, path string, onOpen any, memo string, options WebServiceOptions)
- func RegisterVerify(name, setting string)
- func RegisterVerifyFunc(name string, f func(in any, args []string) bool)
- func RegisterWithOptions(authLevel int, path string, serviceFunc any, memo string, ...)
- func ResetAllSets()
- func Restful(authLevel int, method, path string, serviceFunc any, memo string)
- func RestfulWithOptions(authLevel int, method, path string, serviceFunc any, memo string, ...)
- func Rewrite(path string, toPath string)
- func RunTaskWhileRunning(duration time.Duration, taskFn func() bool)
- func SetActionAuthChecker(...)
- func SetAuthChecker(...)
- func SetAuthFailedData(data any)
- func SetAuthTokenLevel(authToken string, authLevel int)
- func SetChecker(ck func(request *http.Request) bool)
- func SetClientKeys(deviceIdKey, clientAppKey, sessionIdKey string)
- func SetErrorHandle(myErrorHandle func(err any, request *Request, response *Response) any)
- func SetInFilter(...)
- func SetInject(data any)
- func SetInjectFunc(factory func() any)
- func SetLimitFailedData(data any)
- func SetOutFilter(...)
- func SetProxyBy(...)
- func SetRewriteBy(by func(request *Request) (toPath string, rewrite bool))
- func SetSessionId(request *http.Request, sessionId string)
- func SetSessionIdMaker(maker func() string)
- func SetStartTimeValue(msTimeValue int64)
- func SetUserId(request *http.Request, userId string)
- func SetVerifyFailedData(data any)
- func SetVersion(serverVersion string)
- func SetWorkPath(p string)
- func SleepWhileRunning(duration time.Duration)
- func Start()
- func StartMemoryCacheCleaner()
- func Static(path, rootPath string)
- func StaticByHost(path, rootPath, host string)
- func Subscribe(channel string, reset func(), received func([]byte)) bool
- func Tpl(data any, functions template.FuncMap, files ...string) string
- func TplOut(writer io.Writer, data any, functions template.FuncMap, files ...string)
- func UniqueId() string
- func UniqueId12() string
- func UniqueId14() string
- func UniqueId16() string
- func UniqueId20() string
- func Unregister(method, path string)
- func Verify(in any, setting string, logger *log.Logger) (bool, string)
- func VerifyStruct(in any, logger *log.Logger) (ok bool, field string)
- type ActionRegister
- type Api
- type Argot
- type ArgotInfo
- type Arr
- type AsyncServer
- func (as *AsyncServer) Delete(path string, data any, headers ...string) *httpclient.Result
- func (as *AsyncServer) Do(method, path string, data any, headers ...string) *httpclient.Result
- func (as *AsyncServer) Get(path string, headers ...string) *httpclient.Result
- func (as *AsyncServer) Head(path string, headers ...string) *httpclient.Result
- func (as *AsyncServer) ManualDo(method, path string, data any, headers ...string) *httpclient.Result
- func (as *AsyncServer) NewClient(timeout time.Duration) *Client
- func (as *AsyncServer) OnStop(f func())
- func (as *AsyncServer) OnStopped(f func())
- func (as *AsyncServer) Post(path string, data any, headers ...string) *httpclient.Result
- func (as *AsyncServer) Put(path string, data any, headers ...string) *httpclient.Result
- func (as *AsyncServer) SetGlobalHeader(k, v string)
- func (as *AsyncServer) Start()
- func (as *AsyncServer) Stop()
- func (as *AsyncServer) Wait()
- type CertSet
- type Client
- func (c *Client) Delete(path string, data any, headers ...string) *httpclient.Result
- func (c *Client) Do(method, path string, data any, headers ...string) *httpclient.Result
- func (c *Client) Get(path string, headers ...string) *httpclient.Result
- func (c *Client) Head(path string, headers ...string) *httpclient.Result
- func (c *Client) Post(path string, data any, headers ...string) *httpclient.Result
- func (c *Client) Put(path string, data any, headers ...string) *httpclient.Result
- type CodeResult
- type Context
- type Counter
- type GzipResponseWriter
- type HostRegister
- func (host *HostRegister) Register(authLevel int, path string, serviceFunc any, memo string)
- func (host *HostRegister) RegisterSimpleWebsocket(authLevel int, path string, onOpen any, memo string)
- func (host *HostRegister) RegisterSimpleWebsocketWithOptions(authLevel int, path string, onOpen any, memo string, options WebServiceOptions)
- func (host *HostRegister) RegisterWebsocket(authLevel int, path string, updater *websocket.Upgrader, onOpen any, ...) *ActionRegister
- func (host *HostRegister) RegisterWebsocketWithOptions(authLevel int, path string, updater *websocket.Upgrader, onOpen any, ...) *ActionRegister
- func (host *HostRegister) RegisterWithOptions(authLevel int, path string, serviceFunc any, memo string, ...)
- func (host *HostRegister) Restful(authLevel int, method, path string, serviceFunc any, memo string)
- func (host *HostRegister) RestfulWithOptions(authLevel int, method, path string, serviceFunc any, memo string, ...)
- func (host *HostRegister) Static(path, rootPath string)
- func (host *HostRegister) Unregister(method, path string)
- type Limiter
- type Listen
- type Logger
- type Map
- type Request
- func (request *Request) Get(key string) any
- func (request *Request) GetRealIp() string
- func (request *Request) GetSessionId() string
- func (request *Request) MakeUrl(path string) string
- func (request *Request) ResetPath(path string)
- func (request *Request) Set(key string, value any)
- func (request *Request) SetSessionId(sessionId string)
- func (request *Request) SetUserId(userId string)
- type Response
- func (response *Response) DontLog200()
- func (response *Response) DontLogArg(arg string)
- func (response *Response) DownloadFile(contentType, filename string, data any)
- func (response *Response) Flush()
- func (response *Response) FlushString(s string) (int, error)
- func (response *Response) Header() http.Header
- func (response *Response) Location(location string)
- func (response *Response) SendFile(contentType, filename string)
- func (response *Response) Write(bytes []byte) (int, error)
- func (response *Response) WriteHeader(code int)
- func (response *Response) WriteString(s string) (int, error)
- type Result
- type ServiceConfig
- type StartCmd
- type Testing
- type TimeCounter
- type TimeStatistician
- type UploadFile
- type UserAgent
- type VerifySet
- type VerifyType
- type WebServiceOptions
Constants ¶
View Source
const ( ResponseCodeHeartbeatPidError = 591 ResponseCodeServiceNotRunning = 592 ResponseCodeHeartbeatFailed = 593 )
View Source
const ResponseCodeHeartbeatSucceed = 299
View Source
const (
ResponseCodePanicError = iota + 580
)
Variables ¶
View Source
var Config = ServiceConfig{}
View Source
var ServerLogger = log.New(serverId)
Functions ¶
func AddAuthChecker ¶ added in v1.7.6
func AddShutdownHook ¶ added in v1.5.9
func AddShutdownHook(f func())
func CacheByMemory ¶ added in v1.5.20
func ClearMemoryCache ¶ added in v1.5.21
func ClearMemoryCache(key string)
func DefaultAuthChecker ¶ added in v1.3.29
func DefaultAuthChecker(authLevel int, logger *log.Logger, url *string, in map[string]any, request *Request, response *Response, options *WebServiceOptions) (pass bool, sessionObject any)
noinspection GoUnusedParameter
func GetAuthTokenLevel ¶ added in v1.7.7
func GetCPUMemoryStat ¶ added in v1.5.40
func GetDomainWithScope ¶ added in v1.5.40
func GetLocalPublicIP ¶ added in v1.7.7
func GetLocalPublicIP() []string
func GetServerAddr ¶
func GetServerAddr() string
func IgnoreTplTags ¶ added in v1.5.30
func InitConfig ¶ added in v1.7.18
func InitConfig()
func MakeArgots ¶ added in v1.5.2
func MakeArgots(argots any)
func MakeHtmlDocumentFile ¶
生成文档并存储到 html 文件中,使用默认html模版
func MakeHtmlDocumentFromFile ¶
生成文档并存储到 html 文件中,使用指定html模版
func MakeJsonDocumentFile ¶
func MakeJsonDocumentFile(file string)
func MakeTplOut ¶ added in v1.5.42
func NewTimerServer ¶ added in v1.3.17
func RegisterSimpleWebsocket ¶ added in v1.3.29
注册Websocket服务
func RegisterSimpleWebsocketWithOptions ¶ added in v1.5.33
func RegisterSimpleWebsocketWithOptions(authLevel int, path string, onOpen any, memo string, options WebServiceOptions)
func RegisterVerify ¶ added in v1.7.7
func RegisterVerify(name, setting string)
RegisterVerify custom a new verify
func RegisterVerifyFunc ¶ added in v1.7.7
RegisterVerifyFunc custom a new func verify
func RegisterWithOptions ¶ added in v1.5.33
func RegisterWithOptions(authLevel int, path string, serviceFunc any, memo string, options WebServiceOptions)
注册服务
func ResetAllSets ¶
func ResetAllSets()
func RestfulWithOptions ¶ added in v1.5.33
func RestfulWithOptions(authLevel int, method, path string, serviceFunc any, memo string, options WebServiceOptions)
注册服务
func RunTaskWhileRunning ¶ added in v1.7.7
func SetActionAuthChecker ¶
func SetAuthChecker ¶
func SetAuthFailedData ¶ added in v1.3.15
func SetAuthFailedData(data any)
func SetAuthTokenLevel ¶ added in v1.7.7
func SetChecker ¶
func SetClientKeys ¶ added in v1.4.6
func SetClientKeys(deviceIdKey, clientAppKey, sessionIdKey string)
func SetErrorHandle ¶
func SetInFilter ¶
func SetInFilter(filter func(in *map[string]any, request *Request, response *Response, logger *log.Logger) (out any))
设置前置过滤器
func SetInjectFunc ¶ added in v1.3.10
func SetInjectFunc(factory func() any)
func SetLimitFailedData ¶ added in v1.7.7
func SetLimitFailedData(data any)
func SetOutFilter ¶
func SetOutFilter(filter func(in map[string]any, request *Request, response *Response, out any, logger *log.Logger) (newOut any, isOver bool))
设置后置过滤器
func SetProxyBy ¶
func SetProxyBy(by func(request *Request) (authLevel int, toApp, toPath *string, headers map[string]string))
跳转
func SetRewriteBy ¶
跳转 func SetRewriteBy(by func(request *http.Request) (toPath string, httpVersion int, headers *map[string]string, rewrite bool)) {
func SetSessionId ¶ added in v1.5.33
func SetSessionIdMaker ¶ added in v1.5.49
func SetSessionIdMaker(maker func() string)
func SetStartTimeValue ¶ added in v1.7.7
func SetStartTimeValue(msTimeValue int64)
func SetVerifyFailedData ¶ added in v1.7.7
func SetVerifyFailedData(data any)
func SetVersion ¶ added in v1.5.46
func SetVersion(serverVersion string)
func SetWorkPath ¶ added in v1.6.0
func SetWorkPath(p string)
func SleepWhileRunning ¶ added in v1.7.7
func StartMemoryCacheCleaner ¶ added in v1.5.20
func StartMemoryCacheCleaner()
func StaticByHost ¶ added in v1.5.49
func StaticByHost(path, rootPath, host string)
func UniqueId12 ¶ added in v1.5.30
func UniqueId12() string
func UniqueId14 ¶ added in v1.5.30
func UniqueId14() string
func UniqueId16 ¶ added in v1.5.30
func UniqueId16() string
func UniqueId20 ¶ added in v1.5.30
func UniqueId20() string
Types ¶
type ActionRegister ¶
type ActionRegister struct {
// contains filtered or unexported fields
}
func RegisterWebsocket ¶
func RegisterWebsocketWithOptions ¶ added in v1.5.33
func RegisterWebsocketWithOptions(authLevel int, path string, updater *websocket.Upgrader, onOpen any, onClose any, decoder func(data any) (action string, request map[string]any, err error), encoder func(action string, data any) any, isSimple bool, memo string, options WebServiceOptions) *ActionRegister
注册Websocket服务
func (*ActionRegister) RegisterAction ¶
func (ar *ActionRegister) RegisterAction(authLevel int, actionName string, action any, memo string)
func (*ActionRegister) RegisterActionWithPriority ¶
func (ar *ActionRegister) RegisterActionWithPriority(authLevel, priority int, actionName string, action any, memo string)
type AsyncServer ¶
type AsyncServer struct { Addr string Proto string ProtoName string // contains filtered or unexported fields }
func AsyncStart ¶
func AsyncStart() *AsyncServer
func (*AsyncServer) Delete ¶
func (as *AsyncServer) Delete(path string, data any, headers ...string) *httpclient.Result
func (*AsyncServer) Do ¶
func (as *AsyncServer) Do(method, path string, data any, headers ...string) *httpclient.Result
func (*AsyncServer) Get ¶
func (as *AsyncServer) Get(path string, headers ...string) *httpclient.Result
func (*AsyncServer) Head ¶
func (as *AsyncServer) Head(path string, headers ...string) *httpclient.Result
func (*AsyncServer) ManualDo ¶ added in v1.6.11
func (as *AsyncServer) ManualDo(method, path string, data any, headers ...string) *httpclient.Result
func (*AsyncServer) NewClient ¶ added in v1.5.47
func (as *AsyncServer) NewClient(timeout time.Duration) *Client
func (*AsyncServer) OnStop ¶ added in v1.5.50
func (as *AsyncServer) OnStop(f func())
func (*AsyncServer) OnStopped ¶ added in v1.7.7
func (as *AsyncServer) OnStopped(f func())
func (*AsyncServer) Post ¶
func (as *AsyncServer) Post(path string, data any, headers ...string) *httpclient.Result
func (*AsyncServer) Put ¶
func (as *AsyncServer) Put(path string, data any, headers ...string) *httpclient.Result
func (*AsyncServer) SetGlobalHeader ¶
func (as *AsyncServer) SetGlobalHeader(k, v string)
func (*AsyncServer) Start ¶ added in v1.3.33
func (as *AsyncServer) Start()
func (*AsyncServer) Stop ¶
func (as *AsyncServer) Stop()
func (*AsyncServer) Wait ¶ added in v1.3.33
func (as *AsyncServer) Wait()
type Client ¶ added in v1.5.47
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Get ¶ added in v1.5.47
func (c *Client) Get(path string, headers ...string) *httpclient.Result
func (*Client) Head ¶ added in v1.5.47
func (c *Client) Head(path string, headers ...string) *httpclient.Result
type CodeResult ¶ added in v1.3.15
func (*CodeResult) Failed ¶ added in v1.5.33
func (r *CodeResult) Failed(code int, message string)
func (*CodeResult) OK ¶ added in v1.4.5
func (r *CodeResult) OK()
type Counter ¶ added in v1.5.40
type Counter struct { StartTime time.Time EndTime time.Time Total float64 Times uint Failed uint Min float64 Max float64 Avg float64 }
func NewCounter ¶ added in v1.5.40
func NewCounter() *Counter
type GzipResponseWriter ¶
type GzipResponseWriter struct { *Response // contains filtered or unexported fields }
=================================================================================
func NewGzipResponseWriter ¶
func NewGzipResponseWriter(w *Response) *GzipResponseWriter
func (*GzipResponseWriter) Close ¶
func (gzw *GzipResponseWriter) Close()
type HostRegister ¶ added in v1.3.33
type HostRegister struct {
// contains filtered or unexported fields
}
func Host ¶ added in v1.3.33
func Host(host string) HostRegister
func (*HostRegister) Register ¶ added in v1.3.33
func (host *HostRegister) Register(authLevel int, path string, serviceFunc any, memo string)
func (*HostRegister) RegisterSimpleWebsocket ¶ added in v1.3.33
func (host *HostRegister) RegisterSimpleWebsocket(authLevel int, path string, onOpen any, memo string)
func (*HostRegister) RegisterSimpleWebsocketWithOptions ¶ added in v1.5.33
func (host *HostRegister) RegisterSimpleWebsocketWithOptions(authLevel int, path string, onOpen any, memo string, options WebServiceOptions)
func (*HostRegister) RegisterWebsocket ¶ added in v1.3.33
func (*HostRegister) RegisterWebsocketWithOptions ¶ added in v1.5.33
func (host *HostRegister) RegisterWebsocketWithOptions(authLevel int, path string, updater *websocket.Upgrader, onOpen any, onClose any, decoder func(data any) (action string, request map[string]any, err error), encoder func(action string, data any) any, isSimple bool, memo string, options WebServiceOptions) *ActionRegister
func (*HostRegister) RegisterWithOptions ¶ added in v1.5.33
func (host *HostRegister) RegisterWithOptions(authLevel int, path string, serviceFunc any, memo string, options WebServiceOptions)
func (*HostRegister) Restful ¶ added in v1.3.33
func (host *HostRegister) Restful(authLevel int, method, path string, serviceFunc any, memo string)
func (*HostRegister) RestfulWithOptions ¶ added in v1.5.33
func (host *HostRegister) RestfulWithOptions(authLevel int, method, path string, serviceFunc any, memo string, options WebServiceOptions)
func (*HostRegister) Static ¶ added in v1.5.49
func (host *HostRegister) Static(path, rootPath string)
func (*HostRegister) Unregister ¶ added in v1.5.40
func (host *HostRegister) Unregister(method, path string)
type Limiter ¶ added in v1.7.7
type Limiter struct {
// contains filtered or unexported fields
}
func NewLimiter ¶ added in v1.7.7
func NewLimiter(name string, from string, duration time.Duration, times int, rd *redis.Redis) *Limiter
NewLimiter 创建一个限制器,指定一个名称来区分,设置好多长时间内允许多少次,传入一个 redis 连接池用于存储临时计数器
func NewLocalLimiter ¶ added in v1.7.7
NewLocalLimiter 创建一个本地限制器,指定一个名称来区分,设置好多长时间内允许多少次
type Request ¶ added in v1.5.50
func (*Request) GetSessionId ¶ added in v1.5.50
func (*Request) SetSessionId ¶ added in v1.5.50
type Response ¶
type Response struct { Id string Writer http.ResponseWriter ProxyHeader *http.Header // contains filtered or unexported fields }
func (*Response) DontLog200 ¶ added in v1.5.8
func (response *Response) DontLog200()
func (*Response) DontLogArg ¶ added in v1.5.49
func (*Response) DownloadFile ¶ added in v1.5.30
func (*Response) FlushString ¶ added in v1.2.12
func (*Response) WriteHeader ¶
type ServiceConfig ¶ added in v1.7.5
type ServiceConfig struct { Listen string // 监听端口(|隔开多个监听)(,隔开多个选项)(如果不指定IP则监听在0.0.0.0,如果不指定端口则使用h2c协议监听在随机端口,80端口默认使用http协议,443端口默认使用https协议),例如 80,http|443|443:h2|127.0.0.1:8080,h2c SSL map[string]*CertSet // SSL证书配置,key为域名,value为cert和key的文件路径 //KeepaliveTimeout int // 连接允许空闲的最大时间,单位ms,默认值:15000 NoLogGets bool // 不记录GET请求的日志 NoLogHeaders string // 不记录请求头中包含的这些字段,多个字段用逗号分隔,默认不记录:Accept,Accept-Encoding,Cache-Control,Pragma,Connection,Upgrade-Insecure-Requests LogInputArrayNum int // 请求字段中容器类型(数组、Map)在日志打印个数限制 默认为10个,多余的数据将不再日志中记录 LogInputFieldSize int // 请求字段中单个字段在日志打印长度限制 默认为500个字符,多余的数据将不再日志中记录 NoLogOutputFields string // 不记录响应字段中包含的这些字段(key名),多个字段用逗号分隔 LogOutputArrayNum int // 响应字段中容器类型(数组、Map)在日志打印个数限制 默认为3个,多余的数据将不再日志中记录 LogOutputFieldSize int // 响应字段中单个字段在日志打印长度限制 默认为100个字符,多余的数据将不再日志中记录 LogWebsocketAction bool // 记录Websocket中每个Action的请求日志,默认不记录 Compress bool // 是否启用压缩,默认不启用 CompressMinSize int // 小于设定值的应答内容将不进行压缩,默认值:1024 CompressMaxSize int // 大于设定值的应答内容将不进行压缩,默认值:4096000 CheckDomain string // 心跳检测时使用域名,,默认使用IP地址,心跳检测使用 HEAD /__CHECK__ 请求,应答 299 表示正常,593 表示异常 AccessTokens map[string]*int // 请求接口时使用指定的Access-Token进行验证,值为Token对应的auth-level RedirectTimeout int // proxy和discover发起请求时的超时时间,单位ms,默认值:10000 AcceptXRealIpWithoutRequestId bool // 是否允许头部没有携带请求ID的X-Real-IP信息,默认不允许(防止伪造客户端IP) StatisticTime bool // 是否开启请求时间统计,默认不开启 StatisticTimeInterval int // 统计时间间隔,单位ms,默认值:10000 Fast bool // 是否启用快速模式(为了追求性能牺牲一部分特性),默认不启用 MaxUploadSize int64 // 最大上传文件大小(multipart/form-data请求的总空间),单位字节,默认值:104857600 IpPrefix string // discover服务发现时指定使用的IP网段,默认排除 172.17.(Docker) Cpu int // CPU占用的核数,默认为0,即不做限制 Memory int // 内存(单位M),默认为0,即不做限制 CpuMonitor bool // 在日志中记录CPU使用情况,默认不开启 MemoryMonitor bool // 在日志中记录内存使用情况,默认不开启 CpuLimitValue uint // CPU超过最高占用值(10-100)超过次数将自动重启(如果CpuMonitor开启的话),默认100 MemoryLimitValue uint // 内存超过最高占用值(10-100)超过次数将自动重启(如果MemoryMonitor开启的话),默认95 CpuLimitTimes uint // CPU超过最高占用值超过次数(1-100)将报警(如果CpuMonitor开启的话),默认6(即30秒内连续6次) MemoryLimitTimes uint // 内存超过最高占用值超过次数(1-100)将报警(如果MemoryMonitor开启的话),默认6(即30秒内连续6次) CookieScope string // 启用Session时Cookie的有效范围,host|domain|topDomain,默认值为host SessionWithoutCookie bool // Session禁用Cookie保持,默认使用Cookie DeviceWithoutCookie bool // 设备ID禁用Cookie保持,默认使用Cookie IdServer string // 用s.UniqueId、s.Id来生成唯一ID(雪花算法)时所需的redis服务器连接,如果不指定将不能实现跨服务的全局唯一 KeepKeyCase bool // 是否保持Key的首字母大小写?默认一律使用小写 IndexFiles []string // 访问静态文件时的索引文件,默认为 index.html IndexDir bool // 访问目录时显示文件列表 ReadTimeout int // 读取请求的超时时间,单位ms ReadHeaderTimeout int // 读取请求头的超时时间,单位ms WriteTimeout int // 响应写入的超时时间,单位ms IdleTimeout int // 连接空闲超时时间,单位ms MaxHeaderBytes int // 请求头的最大字节数 MaxHandlers int // 每个连接的最大处理程序数量 MaxConcurrentStreams uint32 // 每个连接的最大并发流数量 MaxDecoderHeaderTableSize uint32 // 解码器头表的最大大小 MaxEncoderHeaderTableSize uint32 // 编码器头表的最大大小 MaxReadFrameSize uint32 // 单个帧的最大读取大小 MaxUploadBufferPerConnection int32 // 每个连接的最大上传缓冲区大小 MaxUploadBufferPerStream int32 // 每个流的最大上传缓冲区大小 }
type TimeCounter ¶ added in v1.4.6
type TimeCounter struct {
// contains filtered or unexported fields
}
func StartTimeCounter ¶ added in v1.4.6
func StartTimeCounter() *TimeCounter
func (*TimeCounter) Add ¶ added in v1.4.6
func (t *TimeCounter) Add(name string) float64
func (*TimeCounter) Print ¶ added in v1.4.6
func (t *TimeCounter) Print()
func (*TimeCounter) Sprint ¶ added in v1.4.6
func (t *TimeCounter) Sprint() string
func (*TimeCounter) Total ¶ added in v1.4.6
func (t *TimeCounter) Total() float64
type TimeStatistician ¶ added in v1.4.6
type TimeStatistician struct {
// contains filtered or unexported fields
}
func NewTimeStatistic ¶ added in v1.4.6
func NewTimeStatistic(logger *log.Logger) *TimeStatistician
func (*TimeStatistician) Log ¶ added in v1.4.6
func (t *TimeStatistician) Log()
func (*TimeStatistician) Push ¶ added in v1.4.6
func (t *TimeStatistician) Push(c *TimeCounter) string
type UploadFile ¶ added in v1.5.23
type UploadFile struct { Filename string Header textproto.MIMEHeader Size int64 // contains filtered or unexported fields }
func (*UploadFile) Content ¶ added in v1.5.23
func (uploadFile *UploadFile) Content() ([]byte, error)
func (*UploadFile) Open ¶ added in v1.5.23
func (uploadFile *UploadFile) Open() (multipart.File, error)
func (*UploadFile) Save ¶ added in v1.5.23
func (uploadFile *UploadFile) Save(filename string) error
type UserAgent ¶ added in v1.4.6
type VerifyType ¶ added in v1.7.7
type VerifyType uint8
const ( Unknown VerifyType = iota Regex StringLength GreaterThan LessThan Between InList ByFunc )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.