cors

package
v0.0.0-...-034c2bd Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 7 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"`
	AllowMethods     string `json:"allow_methods"`
	AllowCredentials bool   `json:"allow_credentials"`
	AllowHeaders     string `json:"allow_headers"`
	ExposeHeaders    string `json:"expose_headers"`
	MaxAge           int32  `json:"max_age"`
	ResponseType     string `json:"response_type"`
}

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 http_service.IHttpContext, next http_service.IChain) (err error)

func (*CorsFilter) Id

func (c *CorsFilter) Id() string

func (*CorsFilter) Reset

func (c *CorsFilter) Reset(conf interface{}, workers map[eosc.RequireId]interface{}) 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]interface{}) 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]interface{}) (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)

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