Matthew Holt
5 years ago
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
4 changed files with
11 additions and
3 deletions
-
go.mod
-
go.sum
-
modules/caddyhttp/celmatcher.go
-
replacer.go
|
@ -11,7 +11,8 @@ require ( |
|
|
github.com/go-acme/lego/v3 v3.7.0 |
|
|
github.com/go-acme/lego/v3 v3.7.0 |
|
|
github.com/go-chi/chi v4.1.1+incompatible |
|
|
github.com/go-chi/chi v4.1.1+incompatible |
|
|
github.com/gogo/protobuf v1.3.1 |
|
|
github.com/gogo/protobuf v1.3.1 |
|
|
github.com/google/cel-go v0.5.0 |
|
|
github.com/golang/protobuf v1.3.4 |
|
|
|
|
|
github.com/google/cel-go v0.5.1 |
|
|
github.com/jsternberg/zap-logfmt v1.2.0 |
|
|
github.com/jsternberg/zap-logfmt v1.2.0 |
|
|
github.com/klauspost/compress v1.10.5 |
|
|
github.com/klauspost/compress v1.10.5 |
|
|
github.com/klauspost/cpuid v1.2.4 |
|
|
github.com/klauspost/cpuid v1.2.4 |
|
|
|
@ -286,8 +286,8 @@ github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039/go.mod h1:qOQCunE |
|
|
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= |
|
|
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= |
|
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= |
|
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= |
|
|
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= |
|
|
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= |
|
|
github.com/google/cel-go v0.5.0 h1:mKsiw/KmT+VlDZnYFd2SE5ULrbe8RPlb0rHBem2Bv7I= |
|
|
github.com/google/cel-go v0.5.1 h1:oDsbtAwlwFPEcC8dMoRWNuVzWJUDeDZeHjoet9rXjTs= |
|
|
github.com/google/cel-go v0.5.0/go.mod h1:9SvtVVTtZV4DTB1/RuAD1D2HhuqEIdmZEE/r/lrFyKE= |
|
|
github.com/google/cel-go v0.5.1/go.mod h1:9SvtVVTtZV4DTB1/RuAD1D2HhuqEIdmZEE/r/lrFyKE= |
|
|
github.com/google/cel-spec v0.4.0/go.mod h1:2pBM5cU4UKjbPDXBgwWkiwBsVgnxknuEJ7C5TDWwORQ= |
|
|
github.com/google/cel-spec v0.4.0/go.mod h1:2pBM5cU4UKjbPDXBgwWkiwBsVgnxknuEJ7C5TDWwORQ= |
|
|
github.com/google/certificate-transparency-go v1.1.0/go.mod h1:i+Q7XY+ArBveOUT36jiHGfuSK1fHICIg6sUkRxPAbCs= |
|
|
github.com/google/certificate-transparency-go v1.1.0/go.mod h1:i+Q7XY+ArBveOUT36jiHGfuSK1fHICIg6sUkRxPAbCs= |
|
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= |
|
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= |
|
|
|
@ -21,10 +21,12 @@ import ( |
|
|
"reflect" |
|
|
"reflect" |
|
|
"regexp" |
|
|
"regexp" |
|
|
"strings" |
|
|
"strings" |
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
"github.com/caddyserver/caddy/v2" |
|
|
"github.com/caddyserver/caddy/v2" |
|
|
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" |
|
|
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" |
|
|
"github.com/gogo/protobuf/proto" |
|
|
"github.com/gogo/protobuf/proto" |
|
|
|
|
|
"github.com/golang/protobuf/ptypes/timestamp" |
|
|
"github.com/google/cel-go/cel" |
|
|
"github.com/google/cel-go/cel" |
|
|
"github.com/google/cel-go/checker/decls" |
|
|
"github.com/google/cel-go/checker/decls" |
|
|
"github.com/google/cel-go/common/types" |
|
|
"github.com/google/cel-go/common/types" |
|
@ -204,6 +206,9 @@ func (celTypeAdapter) NativeToValue(value interface{}) ref.Val { |
|
|
switch v := value.(type) { |
|
|
switch v := value.(type) { |
|
|
case celHTTPRequest: |
|
|
case celHTTPRequest: |
|
|
return v |
|
|
return v |
|
|
|
|
|
case time.Time: |
|
|
|
|
|
// TODO: eliminate direct protobuf dependency, sigh -- just wrap stdlib time.Time instead...
|
|
|
|
|
|
return types.Timestamp{Timestamp: ×tamp.Timestamp{Seconds: v.Unix(), Nanos: int32(v.Nanosecond())}} |
|
|
case error: |
|
|
case error: |
|
|
types.NewErr(v.Error()) |
|
|
types.NewErr(v.Error()) |
|
|
} |
|
|
} |
|
|
|
@ -276,6 +276,8 @@ func globalDefaultReplacements(key string) (interface{}, bool) { |
|
|
return runtime.GOOS, true |
|
|
return runtime.GOOS, true |
|
|
case "system.arch": |
|
|
case "system.arch": |
|
|
return runtime.GOARCH, true |
|
|
return runtime.GOARCH, true |
|
|
|
|
|
case "time.now": |
|
|
|
|
|
return nowFunc(), true |
|
|
case "time.now.common_log": |
|
|
case "time.now.common_log": |
|
|
return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true |
|
|
return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true |
|
|
case "time.now.year": |
|
|
case "time.now.year": |
|
|