Documentation ¶
Index ¶
- Constants
- type AggregateEndpoint
- type AggregateEndpoints
- type AggregateRoute
- func (r *AggregateRoute) Check() error
- func (r *AggregateRoute) InjectByEndpoint(req *http.Request, endpoint AggregateEndpoint)
- func (r *AggregateRoute) InjectForwardUrl(req *http.Request)
- func (r *AggregateRoute) IsMethodAllowedMethod(req *http.Request) bool
- func (r *AggregateRoute) Load() error
- func (r *AggregateRoute) MatchAuth(req *http.Request) bool
- func (r *AggregateRoute) MatchInclude(req *http.Request) bool
- func (r *AggregateRoute) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Auth
- type BasicAuth
- type CtxUpstream
- type HostMatcher
- type HostMatchers
- type JWTCheck
- type JWTChecks
- type Oauth2Auth
- type PathMatcher
- func (re PathMatcher) AppPath() string
- func (re PathMatcher) CreateRoutePath(finalPath string) string
- func (re *PathMatcher) Load(s string) error
- func (re PathMatcher) Match(path string) bool
- func (re PathMatcher) String() string
- func (re *PathMatcher) UnmarshalCloud(data interface{}) error
- func (re *PathMatcher) UnmarshalJSON(b []byte) error
- func (re *PathMatcher) UnmarshalYAML(unmarshal func(interface{}) error) error
- type PathMatchers
- type Upstream
Constants ¶
View Source
const (
PathRegex = "(?i)^((/[^/\\*]*)*)(/((\\*){1,2}))?$"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateEndpoint ¶
type AggregateEndpoints ¶
type AggregateEndpoints []AggregateEndpoint
type AggregateRoute ¶
type AggregateRoute struct { // Name of your aggregate Name string `json:"name" yaml:"name" cloud:"name"` // Includes path for making aggregation // You can use globs: // - appending /* will only make requests available in first level to aggregate // - appending /** will mark everything to aggregate // e.g.: /app/** Includes PathMatchers `json:"includes" yaml:"includes" cloud:"includes"` // Same pattern has includes but for excludes this time Excludes PathMatchers `json:"excludes" yaml:"excludes" cloud:"excludes"` // Allowed method for aggregating, by default only GET is accepted AllowedMethods []string // Upstream URL where all request will be redirected // Query parameters can be passed, e.g.: http://localhost?param=1 // User and password are given as basic auth too (this is not recommended to use it), e.g.: http://user:password@localhost Upstream *Upstream `json:"upstream" yaml:"upstream" cloud:"upstream"` // By default response from upstream are buffered, it can be issue when sending big files // Set to true to stream response NoBuffer bool `json:"no_buffer" yaml:"no_buffer" cloud:"no_buffer"` // Set to true to not check ssl certificates from upstream (not really recommended) InsecureSkipVerify bool `json:"insecure_skip_verify" yaml:"insecure_skip_verify" cloud:"insecure_skip_verify"` // Will forward directly to proxified route OPTIONS method without using middlewares OptionsPassthrough bool `json:"options_passthrough" yaml:"options_passthrough" cloud:"options_passthrough"` // Must match host Hosts HostMatchers `json:"hosts" yaml:"hosts" cloud:"hosts"` // Auth Auth Auth `json:"auth" yaml:"auth" cloud:"auth"` // Path Path string `json:"path" yaml:"path" cloud:"path"` // endpoints AggregateEndpoints AggregateEndpoints `json:"aggregate_endpoints" yaml:"aggregate_endpoints" cloud:"aggregate_endpoints"` Identifier string `json:"identifier" yaml:"identifier" cloud:"identifier"` }
func NewAggregateRoute ¶
func NewAggregateRoute( name string, identifier string, upstream *Upstream, aggrEndpoints AggregateEndpoints, auth Auth, includes, excludes PathMatchers, ) (*AggregateRoute, error)
func NewAggregateRouteWithHandler ¶
func NewAggregateRouteWithHandler( name string, identifier string, handler http.Handler, aggrEndpoints AggregateEndpoints, auth Auth, includes, excludes PathMatchers, ) (*AggregateRoute, error)
func (*AggregateRoute) Check ¶
func (r *AggregateRoute) Check() error
func (*AggregateRoute) InjectByEndpoint ¶
func (r *AggregateRoute) InjectByEndpoint(req *http.Request, endpoint AggregateEndpoint)
func (*AggregateRoute) InjectForwardUrl ¶
func (r *AggregateRoute) InjectForwardUrl(req *http.Request)
func (*AggregateRoute) IsMethodAllowedMethod ¶ added in v1.1.0
func (r *AggregateRoute) IsMethodAllowedMethod(req *http.Request) bool
func (*AggregateRoute) Load ¶
func (r *AggregateRoute) Load() error
func (*AggregateRoute) MatchInclude ¶
func (r *AggregateRoute) MatchInclude(req *http.Request) bool
func (*AggregateRoute) UnmarshalYAML ¶
func (r *AggregateRoute) UnmarshalYAML(unmarshal func(interface{}) error) error
type Auth ¶
type Auth struct { // Where to do Auth Includes PathMatchers `json:"includes" yaml:"includes" cloud:"includes"` // Where not to do Auth Excludes PathMatchers `json:"excludes" yaml:"excludes" cloud:"excludes"` // Oauth2 auth Oauth2Auth *Oauth2Auth `json:"oauth2" yaml:"oauth2" cloud:"oauth2"` BasicAuth *BasicAuth `json:"basic_auth" yaml:"basic" cloud:"basic_auth"` JWTCheck JWTChecks `json:"jwt_checks" yaml:"jwt_checks" cloud:"jwt_checks"` LoginPageTemplate string `json:"login_page_template" yaml:"login_page_template" cloud:"login_page_template"` LoginPageTemplatePath string `json:"login_page_template_path" yaml:"login_page_template_path" cloud:"login_page_template_path"` }
func NewAuthWithOauth2 ¶
func NewAuthWithOauth2( oauth2Auth *Oauth2Auth, jwtChecks JWTChecks, includes, excludes PathMatchers, ) Auth
func (Auth) MakeLoginPageTemplate ¶
type HostMatcher ¶
func NewHostMatcher ¶
func NewHostMatcher(hostOrWildcard string) *HostMatcher
func (*HostMatcher) Load ¶
func (re *HostMatcher) Load(s string) error
func (HostMatcher) String ¶
func (re HostMatcher) String() string
func (*HostMatcher) UnmarshalCloud ¶
func (re *HostMatcher) UnmarshalCloud(data interface{}) error
func (*HostMatcher) UnmarshalJSON ¶
func (re *HostMatcher) UnmarshalJSON(b []byte) error
func (*HostMatcher) UnmarshalYAML ¶
func (re *HostMatcher) UnmarshalYAML(unmarshal func(interface{}) error) error
type HostMatchers ¶
type HostMatchers []*HostMatcher
func (HostMatchers) Match ¶
func (m HostMatchers) Match(s string) bool
type JWTCheck ¶
type JWTCheck struct { // Algorithm to use to validate the token // This is mandatory due to a security issue (see: https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries) Alg string `json:"alg" yaml:"alg" cloud:"alg"` // Secret or private key to verify the jwt // This is required Secret string `json:"secret" yaml:"secret" cloud:"secret"` // it will validate that the jwt contains this issuer Issuer string `json:"issuer" yaml:"issuer" cloud:"issuer"` // Set to true to not verify issued at of token (Useful when you have different time between user and server) NotVerifyIssuedAt bool `json:"not_verify_issued_at" yaml:"not_verify_expire" cloud:"not_verify_issued_at"` }
type Oauth2Auth ¶
type Oauth2Auth struct { TokenURL string `json:"token_url" yaml:"token_url" cloud:"token_url"` ClientID string `json:"client_id" yaml:"client_id" cloud:"client_id"` ClientSecret string `json:"client_secret" yaml:"client_secret" cloud:"client_secret"` ParamsAsJson bool `json:"params_as_json" yaml:"params_as_json" cloud:"params_as_json"` TokenFormat string `json:"token_format" yaml:"token_format" cloud:"token_format"` Scopes []string `json:"scopes" yaml:"scopes" cloud:"scopes"` }
func NewOauth2Auth ¶
func NewOauth2Auth( tokenURL string, clientID string, clientSecret string, scopes []string, ) *Oauth2Auth
func (*Oauth2Auth) Load ¶
func (c *Oauth2Auth) Load() error
func (*Oauth2Auth) UnmarshalJSON ¶
func (c *Oauth2Auth) UnmarshalJSON(b []byte) error
func (*Oauth2Auth) UnmarshalYAML ¶
func (c *Oauth2Auth) UnmarshalYAML(unmarshal func(interface{}) error) error
type PathMatcher ¶
type PathMatcher struct {
// contains filtered or unexported fields
}
func NewPathMatcher ¶
func NewPathMatcher(path string) *PathMatcher
func (PathMatcher) AppPath ¶
func (re PathMatcher) AppPath() string
func (PathMatcher) CreateRoutePath ¶
func (re PathMatcher) CreateRoutePath(finalPath string) string
func (*PathMatcher) Load ¶
func (re *PathMatcher) Load(s string) error
func (PathMatcher) Match ¶
func (re PathMatcher) Match(path string) bool
func (PathMatcher) String ¶
func (re PathMatcher) String() string
func (*PathMatcher) UnmarshalCloud ¶
func (re *PathMatcher) UnmarshalCloud(data interface{}) error
func (*PathMatcher) UnmarshalJSON ¶
func (re *PathMatcher) UnmarshalJSON(b []byte) error
func (*PathMatcher) UnmarshalYAML ¶
func (re *PathMatcher) UnmarshalYAML(unmarshal func(interface{}) error) error
type PathMatchers ¶
type PathMatchers []*PathMatcher
func (PathMatchers) Match ¶
func (res PathMatchers) Match(path string) bool
type Upstream ¶
func NewUpstreamFromHandler ¶
func NewUpstreamFromUrl ¶
func (*Upstream) UnmarshalCloud ¶
func (*Upstream) UnmarshalJSON ¶
func (*Upstream) UnmarshalYAML ¶
Click to show internal directories.
Click to hide internal directories.