routes

package
v0.0.0-...-6dc645d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 26 Imported by: 2

Documentation

Index

Constants

View Source
const ConditionFailActionError = "ERROR"
View Source
const ConditionFailActionIgnore = "IGNORE"
View Source
const MatchTypeExact = "EXACT"
View Source
const MatchTypePrefix = "PREFIX"

Variables

This section is empty.

Functions

func CloneRequest

func CloneRequest(ctx context.Context, request *http.Request) (req *http.Request, err error)

func RunFuncSteps

func RunFuncSteps(ctx context.Context, funcSteps map[string]*FuncStep, request *http.Request, reqVars map[string]*TemplateVars, resVars map[string]*TemplateVars, mainRouteName string, funcThreads int, loopThreads int) (response *http.Response, err error)

Types

type Authorizer

type Authorizer struct {
	AuthorizerName string
	TokenHeaderKey string
	SecretAlgo     string
	JwkUrl         string
	Audience       []string
	Issuer         []string
}

func (Authorizer) VerifyToken

func (authorizer Authorizer) VerifyToken(ctx context.Context, token string) (claims interface{}, err error)

type FilePart

type FilePart struct {
	FileName    string `eru:"required"`
	FileVarName string `eru:"required"`
	FileContent string `eru:"required"`
}

type FuncGroup

type FuncGroup struct {
	FuncCategoryName string
	FuncGroupName    string
	FuncSteps        map[string]*FuncStep //routename is the key
	TokenSecret      TokenSecret          `json:"-"`
}

func (*FuncGroup) Execute

func (funcGroup *FuncGroup) Execute(ctx context.Context, request *http.Request, FuncThreads int, LoopThreads int) (response *http.Response, err error)

type FuncJob

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

type FuncResult

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

type FuncStep

type FuncStep struct {
	Condition            string
	ConditionFailMessage string
	ConditionFailAction  string
	Async                bool
	AsyncMessage         string
	LoopVariable         string
	LoopInParallel       bool
	RouteName            string
	FunctionName         string
	QueryName            string
	QueryOutput          string
	QueryOutputEncode    bool
	Api                  TargetHost
	ApiPath              string
	Path                 string
	Route                Route     `json:"-"`
	FuncGroup            FuncGroup `json:"-"`
	RequestHeaders       []Headers
	QueryParams          []Headers
	FormData             []Headers
	FileData             []FilePart
	ResponseHeaders      []Headers
	TransformRequest     string
	TransformResponse    string
	IsPublic             bool
	RemoveParams         RemoveParams
	FuncSteps            map[string]*FuncStep
}

func (*FuncStep) GetRouteName

func (funcStep *FuncStep) GetRouteName() (routeName string)

func (*FuncStep) RunFuncStep

func (funcStep *FuncStep) RunFuncStep(octx context.Context, req *http.Request, reqVars map[string]*TemplateVars, resVars map[string]*TemplateVars, mainRouteName string, FuncThread int, LoopThread int) (response *http.Response, err error)

func (*FuncStep) RunFuncStepInner

func (funcStep *FuncStep) RunFuncStepInner(ctx context.Context, req *http.Request, reqVars map[string]*TemplateVars, resVars map[string]*TemplateVars, mainRouteName string, asyncMsg string, funcThread int, loopThread int, strCond string) (response *http.Response, err error)

type FuncTemplateVars

type FuncTemplateVars struct {
	Vars    *TemplateVars
	ReqVars map[string]*TemplateVars
	ResVars map[string]*TemplateVars
}

type Headers

type Headers struct {
	Key        string `eru:"required"`
	Value      string `eru:"required"`
	IsTemplate bool
}

type Job

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

type RemoveParams

type RemoveParams struct {
	RequestHeaders  []string
	QueryParams     []string
	FormData        []string
	ResponseHeaders []string
}

type Result

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

type Route

type Route struct {
	Condition            string
	ConditionFailMessage string
	ConditionFailAction  string
	Async                bool
	AsyncMessage         string
	LoopVariable         string
	LoopInParallel       bool
	RouteName            string `eru:"required"`
	RouteCategoryName    string
	Url                  string `eru:"required"`
	MatchType            string `eru:"required"`
	RewriteUrl           string
	TargetHosts          []TargetHost `eru:"required"`
	AllowedHosts         []string
	AllowedMethods       []string
	RequiredHeaders      []Headers
	EnableCache          bool
	RequestHeaders       []Headers
	QueryParams          []Headers
	FormData             []Headers
	FileData             []FilePart
	ResponseHeaders      []Headers
	TransformRequest     string
	TransformResponse    string
	IsPublic             bool
	Authorizer           string      `json:"-"`
	AuthorizerException  []string    `json:"-"`
	TokenSecret          TokenSecret `json:"-"`
	RemoveParams         RemoveParams
	OnError              string
	Redirect             bool
	RedirectUrl          string
	FinalRedirectUrl     string `json:"-"`
	RedirectScheme       string
	RedirectParams       []Headers
}

func (*Route) CheckPathException

func (route *Route) CheckPathException(path string) (bypass bool)

func (*Route) Execute

func (route *Route) Execute(ctx context.Context, request *http.Request, url string, async bool, asyncMsg string, trReqVars *TemplateVars, loopThread int) (response *http.Response, trResVar *TemplateVars, resErr error)

func (*Route) GetTargetSchemeHostPortPath

func (route *Route) GetTargetSchemeHostPortPath(ctx context.Context, url string) (scheme string, host string, port string, path string, method string, err error)

func (*Route) RunRoute

func (route *Route) RunRoute(ctx context.Context, req *http.Request, url string, trReqVars *TemplateVars, async bool, asyncMsg string) (response *http.Response, trResVars *TemplateVars, err error)

func (*Route) Validate

func (route *Route) Validate(ctx context.Context, host string, url string, method string, headers http.Header) (err error)

type TargetHost

type TargetHost struct {
	Host       string
	Port       string
	Method     string
	Scheme     string
	Allocation int64
}

type TemplateVars

type TemplateVars struct {
	Headers          map[string]interface{}
	FormData         map[string]interface{}
	FileData         []FilePart
	Params           map[string]interface{}
	Vars             map[string]interface{}
	Body             interface{}
	OrgBody          interface{}
	Token            interface{}
	FormDataKeyArray []string
	LoopVars         interface{}
	LoopVar          interface{}
}

type TokenSecret

type TokenSecret struct {
	HeaderKey  string
	SecretAlgo string
	SecretKey  string
	JwkUrl     string
	Audience   []string
	Issuer     []string
}

Jump to

Keyboard shortcuts

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