cors

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 10 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 Check added in v0.9.0

func Check(v *Config, workers map[eosc.RequireId]eosc.IWorker) error

func Create added in v0.9.0

func Create(id, name string, conf *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

func NewFactory

func NewFactory() eosc.IExtenderDriverFactory

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 {
	drivers.WorkerBase
	// 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) 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
}

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