Better trie implementations
This commit is contained in:
@@ -12,12 +12,12 @@ import (
|
||||
proxy "git.maze.io/maze/styx/proxy"
|
||||
)
|
||||
|
||||
func NewRequestHandler(p *Policy) proxy.RequestHandler {
|
||||
log := logger.StandardLog.Value("policy", p.name)
|
||||
func NewRequestHandler(policy *Policy) proxy.RequestHandler {
|
||||
log := logger.StandardLog.Value("policy", policy.name)
|
||||
return proxy.RequestHandlerFunc(func(ctx proxy.Context) (*http.Request, *http.Response) {
|
||||
input := NewInputFromRequest(ctx, ctx.Request())
|
||||
input.logValues(log).Trace("Running request handler")
|
||||
result, err := p.Query(input)
|
||||
result, err := policy.Query(input, proxy.PolicyQueryOptions(ctx)...)
|
||||
if err != nil {
|
||||
log.Err(err).Error("Error evaulating policy")
|
||||
return nil, nil
|
||||
@@ -32,12 +32,12 @@ func NewRequestHandler(p *Policy) proxy.RequestHandler {
|
||||
})
|
||||
}
|
||||
|
||||
func NewDialHandler(p *Policy) proxy.DialHandler {
|
||||
log := logger.StandardLog.Value("policy", p.name)
|
||||
func NewDialHandler(policy *Policy) proxy.DialHandler {
|
||||
log := logger.StandardLog.Value("policy", policy.name)
|
||||
return proxy.DialHandlerFunc(func(ctx proxy.Context, req *http.Request) (net.Conn, error) {
|
||||
input := NewInputFromRequest(ctx, req)
|
||||
input.logValues(log).Trace("Running dial handler")
|
||||
result, err := p.Query(input)
|
||||
result, err := policy.Query(input, proxy.PolicyQueryOptions(ctx)...)
|
||||
if err != nil {
|
||||
log.Err(err).Error("Error evaulating policy")
|
||||
return nil, nil
|
||||
|
Reference in New Issue
Block a user