Documentation
¶
Overview ¶
Package priority resolves trusted request importance and propagates it through explicitly selected HTTP destinations. It performs no authentication or I/O.
Index ¶
- Constants
- Variables
- func Inject(r *http.Request)
- func With(ctx context.Context, tier, identity string) context.Context
- type Cohorts
- type Config
- type Metadata
- type Policy
- func (p *Policy) Buckets() int
- func (p *Policy) Map(tier string) string
- func (p *Policy) Resolve(r *http.Request, fallback string, now time.Time) (*http.Request, Metadata, error)
- func (p *Policy) ResolveContext(ctx context.Context, fallback string, now time.Time) (context.Context, Metadata, error)
- func (p *Policy) Tiers() []Tier
- func (p *Policy) Valid(tier string) bool
- type Tier
- type Transport
Constants ¶
const Header = "X-Gatewise-Priority"
Variables ¶
var ErrInvalid = errors.New("priority_metadata_invalid")
var ErrUntrusted = errors.New("priority_metadata_untrusted")
Functions ¶
Types ¶
type Metadata ¶
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
func (*Policy) ResolveContext ¶ added in v0.8.0
func (p *Policy) ResolveContext(ctx context.Context, fallback string, now time.Time) (context.Context, Metadata, error)
ResolveContext accepts only application-authenticated context metadata. A previously HTTP-resolved context retains its bounded source and cohort key.
type Transport ¶
type Transport struct {
Base http.RoundTripper
Hosts []string
}
Transport propagates only to exact URL Host values (including port) in Hosts. Other destinations have the reserved metadata stripped. Caller requests are cloned. Redirects require the application's normal redirect/security policy as well.