internal

package
v0.0.0-...-7ad3d75 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCacheKey

func GetCacheKey(cmd string, params []string) string

GetCacheKey get cache key

func InArray

func InArray(item string, arr []string) bool

InArray lick php func in_array

func IsFileExists

func IsFileExists(path string) bool

IsFileExists check file exists

func LoadParamValuesFromFile

func LoadParamValuesFromFile(ctx context.Context, file string) (values []string)

LoadParamValuesFromFile load values file as slice

Types

type Config

type Config struct {
	Listen   string // 服务端口,可选,默认 ":8310"
	Title    string
	Intro    string
	Timeout  int      // 超时时间,单位秒,默认 30s
	Charset  string   // 默认字符集,可选
	Charsets []string // 可选字符集,可选
	Commands map[string]*cmdConfig
	LogPath  string
	CacheDir string
	TmpDir   string            // 运行临时数据目录,可选,默认是和配置文件平行的 tmp 目录
	Users    map[string]string // 账号和密码,如 user:psw,可选
	// contains filtered or unexported fields
}

func (*Config) String

func (cfg *Config) String() string

type Server

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

func NewServer

func NewServer(confPath string) *Server

func (*Server) Run

func (srv *Server) Run() error

Run start http server

func (*Server) SetListen

func (srv *Server) SetListen(addr string)

SetListen set cmd server http port

func (*Server) SetUsers

func (srv *Server) SetUsers(users string)

type Task

type Task struct {
	Ctx     context.Context
	Writer  http.ResponseWriter
	Request *http.Request

	// Path 请求的路径,已经 trim 左右的 /
	//  如 请求 /any ,则 Path = any
	Path string
	// contains filtered or unexported fields
}

func (*Task) Close

func (tk *Task) Close()

func (*Task) Deal

func (tk *Task) Deal()

Jump to

Keyboard shortcuts

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