host

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package host 管理路由中域名的切换等操作

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWell added in v2.3.4

func IsWell(pattern string) (err error)

IsWell 检测格式是否正确

Types

type Hosts

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

Hosts 域名管理

func New

func New(disableOptions, disableHead, skipCleanPath bool) *Hosts

New 声明新的 Hosts 变量

func (*Hosts) Add

func (hs *Hosts) Add(pattern string, h http.Handler, method ...string) error

Add 添加路由项

func (*Hosts) All added in v2.2.0

func (hs *Hosts) All(ignoreHead, ignoreOptions bool) (routes map[string][]string)

All 返回所有的路由项

ignoreHead 是否忽略自动生成的 HEAD 请求 ignoreOptions 是否忽略自动生成的 OPTIONS 请求

func (*Hosts) Clean

func (hs *Hosts) Clean(prefix string)

Clean 消除指定前缀的路由项

func (*Hosts) CleanAll

func (hs *Hosts) CleanAll()

CleanAll 清除所有的路由项

func (*Hosts) Handler

func (hs *Hosts) Handler(hostname, path string) (*handlers.Handlers, params.Params)

Handler 获取匹配的路由项

func (*Hosts) Remove

func (hs *Hosts) Remove(pattern string, method ...string)

Remove 移除指定的路由项。

func (*Hosts) SetAllow

func (hs *Hosts) SetAllow(pattern string, allow string)

SetAllow 设置 Options 的 allow 报头值

func (*Hosts) URL

func (hs *Hosts) URL(pattern string, params map[string]string) (string, error)

URL 根据参数生成地址

Jump to

Keyboard shortcuts

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