cors

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "cors"
)

Variables

View Source
var (
	ErrorCredentialTypeError = errors.New("the other options cannot be `*` when `allowCredentials` is true")
)

Functions

func Register

func Register(register eosc.IExtenderDriverRegister)

Types

type Checker

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

func NewChecker

func NewChecker(checks string, headerKey string) *Checker

func (*Checker) Check

func (c *Checker) Check(check string, isHeader bool) bool

Check 检查字段是否允许

func (*Checker) GetKey

func (c *Checker) GetKey() string

func (*Checker) GetOrigin

func (c *Checker) GetOrigin() string

type Config

type Config struct {
	AllowOrigins     string `json:"allow_origins" label:"允许跨域访问的Origin" default:"*"`
	AllowMethods     string `json:"allow_methods" label:"允许通过的请求方式" default:"*" description:"多种请求方式用英文逗号隔开"`
	AllowCredentials bool   `json:"allow_credentials" label:"请求中是否携带cookie"`
	AllowHeaders     string `` /* 162-byte string literal not displayed */
	ExposeHeaders    string `` /* 163-byte string literal not displayed */
	MaxAge           int32  `` /* 134-byte string literal not displayed */
}

type CorsFilter

type CorsFilter struct {
	*Driver
	// contains filtered or unexported fields
}

func (*CorsFilter) CheckSkill

func (c *CorsFilter) CheckSkill(skill string) bool

func (*CorsFilter) Destroy

func (c *CorsFilter) Destroy()

func (*CorsFilter) DoFilter

func (c *CorsFilter) DoFilter(ctx eocontext.EoContext, next eocontext.IChain) (err error)

func (*CorsFilter) DoHttpFilter added in v0.8.0

func (c *CorsFilter) DoHttpFilter(ctx http_service.IHttpContext, next eocontext.IChain) (err error)

func (*CorsFilter) Id

func (c *CorsFilter) Id() string

func (*CorsFilter) Reset

func (c *CorsFilter) Reset(conf interface{}, workers map[eosc.RequireId]eosc.IWorker) error

func (*CorsFilter) Start

func (c *CorsFilter) Start() error

func (*CorsFilter) Stop

func (c *CorsFilter) Stop() error

func (*CorsFilter) WriteHeader

func (c *CorsFilter) WriteHeader(ctx http_service.IHttpContext)

WriteHeader CORS响应告诉本服务的规则

type Driver

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

func (*Driver) Check

func (d *Driver) Check(v interface{}, workers map[eosc.RequireId]eosc.IWorker) error

func (*Driver) ConfigType

func (d *Driver) ConfigType() reflect.Type

func (*Driver) Create

func (d *Driver) Create(id, name string, v interface{}, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

type Factory

type Factory struct {
}

func NewFactory

func NewFactory() *Factory

func (*Factory) Create

func (f *Factory) Create(profession string, name string, label string, desc string, params map[string]interface{}) (eosc.IExtenderDriver, error)

func (*Factory) Render added in v0.6.0

func (f *Factory) Render() interface{}

type ICheck

type ICheck interface {
	Check(check string, isHeader bool) bool
}

type IHeader

type IHeader interface {
	GetOrigin() string
	GetKey() string
}

Jump to

Keyboard shortcuts

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