Documentation
¶
Index ¶
- func ExtIndex(exts string, ext string) int
- func Redirect(root http.Dir, rw http.ResponseWriter, req *http.Request) bool
- type Dir
- type Finish
- func AllowExtIn(exts string) Finish
- func AllowPrefix(prefix string) Finish
- func DenyExtIn(exts string) Finish
- func DenyPrefix(prefix string) Finish
- func DirList(root http.Dir, n int) Finish
- func DirRedirect(root http.Dir) Finish
- func GzipPre(root http.Dir, exts string) Finish
- func SetCacheControl(cc map[string]string) Finish
- func Static(root http.Dir, exts string) Finish
- type Interface
- type String
- type Uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dir ¶
func GzipPreInExts ¶
* GzipPre 发送静态预压缩文件, root 路径由调用者传递.
依据:
Request.Method 为 GET/HEAD Request.Header 含 "Accept-Encoding" 支持 "gzip". URL.Path 有扩展名. exts 非空, 扩展名在 exts 内. 对应的 ".gz" 预压缩文件存在.
参数:
exts 指定文件扩展名, 如果为空, 表示尝试所有文件.
返回:
文件被发送返回 true, 否则返回 false
注意:
确保相应文件类型已注册 mime Content-Type.
func List ¶
* List 使用简洁风格列表目录, root 路径由调用者传递.
参数:
n 限制目录列表的个数, n <= 0 表示不限制.
返回:
true 目录被列表 false 目录未被列表
func StaticInExts ¶
* StaticInExts 发送静态文件, root 路径由调用者传递.
依据:
Request.Method 为 GET/HEAD URL.Path 有扩展名. exts 非空, 扩展名在 exts 内. 文件存在.
参数:
exts 指定文件扩展名, 如果为空, 表示尝试所有文件.
返回:
文件被发送返回 true, 否则返回 false
func (Dir) GitHubTypepressMod ¶
func (h Dir) GitHubTypepressMod()
type Finish ¶
type Finish func(http.ResponseWriter, *http.Request) bool
func AllowPrefix ¶
* AllowPrefix, URL.Path 不含有指定 prefix, 403 完结.
func DirList ¶
* DirList 调用 List 使用简洁风格列表目录.
参数:
root 指定文档根路径 n 限制目录列表的个数, n <= 0 表示不限制.
返回:
true 目录被列表 false 目录未被列表
func GzipPre ¶
* GzipPre 调用 GzipPreInExts 发送静态预压缩文件. 参数:
root 指定文档根路径 exts 指定文件扩展名, 如果为空, 表示尝试所有文件.
返回:
文件被发送返回 true, 否则返回 false
func SetCacheControl ¶
* SetCacheControl 以扩展名设置 Cache-Control 头 参数:
cc 举例 map[string]string{ ".jpg": "max-age=31536000", }
返回:
总是 false
func Static ¶
* Static 调用 StaticInExts 发送静态文件. 参数:
root 指定文档根路径 exts 指定文件扩展名, 如果为空, 表示尝试所有文件.
返回:
文件被发送返回 true, 否则返回 false
func (Finish) GitHubTypepressMod ¶
func (h Finish) GitHubTypepressMod()
type Interface ¶
type Interface interface {
// 占位签名, 表示采用 mod 的接口风格.
GitHubTypepressMod()
}
* Interface for mod
type String ¶
func (String) GitHubTypepressMod ¶
func (h String) GitHubTypepressMod()
Click to show internal directories.
Click to hide internal directories.