Skip to content

Commit

Permalink
replace all legacy variable references (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
inconshreveable authored Oct 24, 2024
1 parent f2724a9 commit fabf468
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion docs/k8s/user-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ spec:
inbound:
- name: "deny_patch"
expressions:
- "req.Method == 'PATCH'"
- "req.method == 'PATCH'"
actions:
- type: "deny"
---
Expand Down
4 changes: 2 additions & 2 deletions examples/agent-config/tls-traffic-policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ tunnels:
on_tcp_connect:
- name: EnforceTLS1.3
expressions:
- "conn.TLS.Version != 'TLS 1.3'"
- "conn.tls.version != '1.3'"
actions:
- type: deny
- name: "LogRequestsFromKnownIP"
expressions:
- "conn.ClientIP == '110.0.0.1'"
- "conn.client_ip == '110.0.0.1'"
actions:
- type: log
config:
Expand Down
8 changes: 4 additions & 4 deletions examples/go-sdk/tcp-traffic-policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Traffic Policies can be defined in `json` or `yaml`!
"on_tcp_connect": [
{
"name": "DenyTrafficOutsideUS",
"expressions": ["conn.Geo.CountryCode != 'US'"],
"expressions": ["conn.geo.country_code != 'US'"],
"actions": [
{
"type": "deny"
Expand All @@ -42,7 +42,7 @@ Traffic Policies can be defined in `json` or `yaml`!
},
{
"name": "LogRequestsFromKnownIP",
"expressions": ["conn.ClientIP == '110.0.0.1"],
"expressions": ["conn.client_ip == '110.0.0.1"],
"actions": [
{
"type": "log",
Expand All @@ -64,12 +64,12 @@ Traffic Policies can be defined in `json` or `yaml`!
on_tcp_connect:
- name: DenyTrafficOutsideUS
expressions:
- conn.Geo.CountryCode != 'US'
- conn.geo.country_code != 'US'
actions:
- type: deny
- name: LogRequestsFromKnownIP
expressions:
- conn.ClientIP == '110.0.0.1
- conn.client_ip == '110.0.0.1
actions:
- type: log
config:
Expand Down
8 changes: 4 additions & 4 deletions examples/go-sdk/tls-traffic-policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Traffic Policies can be defined in `json` or `yaml`!
"on_tcp_connect": [
{
"name": "DenyTrafficOutsideUS",
"expressions": ["conn.Geo.CountryCode != 'US'"],
"expressions": ["conn.geo.country_code != 'US'"],
"actions": [
{
"type": "deny"
Expand All @@ -42,7 +42,7 @@ Traffic Policies can be defined in `json` or `yaml`!
},
{
"name": "LogRequestsFromKnownIP",
"expressions": ["conn.ClientIP == '110.0.0.1"],
"expressions": ["conn.client_ip == '110.0.0.1"],
"actions": [
{
"type": "log",
Expand All @@ -64,12 +64,12 @@ Traffic Policies can be defined in `json` or `yaml`!
on_tcp_connect:
- name: DenyTrafficOutsideUS
expressions:
- conn.Geo.CountryCode != 'US'
- conn.geo.country_code != 'US'
actions:
- type: deny
- name: LogRequestsFromKnownIP
expressions:
- conn.ClientIP == '110.0.0.1
- conn.client_ip == '110.0.0.1
actions:
- type: log
config:
Expand Down
8 changes: 4 additions & 4 deletions examples/javascript-sdk/tcp-traffic-policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Traffic Policies can be defined in `json` or `yaml`!
"on_tcp_connect": [
{
"name": "DenyTrafficOutsideUS",
"expressions": ["conn.Geo.CountryCode != 'US'"],
"expressions": ["conn.geo.country_code != 'US'"],
"actions": [
{
"type": "deny"
Expand All @@ -34,7 +34,7 @@ Traffic Policies can be defined in `json` or `yaml`!
},
{
"name": "LogRequestsFromKnownIP",
"expressions": ["conn.ClientIP == '110.0.0.1"],
"expressions": ["conn.client_ip == '110.0.0.1"],
"actions": [
{
"type": "log",
Expand All @@ -56,12 +56,12 @@ Traffic Policies can be defined in `json` or `yaml`!
on_tcp_connect:
- name: DenyTrafficOutsideUS
expressions:
- conn.Geo.CountryCode != 'US'
- conn.geo.country_code != 'US'
actions:
- type: deny
- name: LogRequestsFromKnownIP
expressions:
- conn.ClientIP == '110.0.0.1
- conn.client_ip == '110.0.0.1
actions:
- type: log
config:
Expand Down
8 changes: 4 additions & 4 deletions examples/javascript-sdk/tls-traffic-policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Traffic Policies can be defined in `json` or `yaml`!
"on_tcp_connect": [
{
"name": "DenyTrafficOutsideUS",
"expressions": ["conn.Geo.CountryCode != 'US'"],
"expressions": ["conn.geo.country_code != 'US'"],
"actions": [
{
"type": "deny"
Expand All @@ -34,7 +34,7 @@ Traffic Policies can be defined in `json` or `yaml`!
},
{
"name": "LogRequestsFromKnownIP",
"expressions": ["conn.ClientIP == '110.0.0.1"],
"expressions": ["conn.client_ip == '110.0.0.1"],
"actions": [
{
"type": "log",
Expand All @@ -56,12 +56,12 @@ Traffic Policies can be defined in `json` or `yaml`!
on_tcp_connect:
- name: DenyTrafficOutsideUS
expressions:
- conn.Geo.CountryCode != 'US'
- conn.geo.country_code != 'US'
actions:
- type: deny
- name: LogRequestsFromKnownIP
expressions:
- conn.ClientIP == '110.0.0.1
- conn.client_ip == '110.0.0.1
actions:
- type: log
config:
Expand Down
8 changes: 4 additions & 4 deletions examples/python-sdk/tcp-traffic-policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Traffic Policies can be defined in `json` or `yaml`!
"on_tcp_connect": [
{
"name": "DenyTrafficOutsideUS",
"expressions": ["conn.Geo.CountryCode != 'US'"],
"expressions": ["conn.geo.country_code != 'US'"],
"actions": [
{
"type": "deny"
Expand All @@ -24,7 +24,7 @@ Traffic Policies can be defined in `json` or `yaml`!
},
{
"name": "LogRequestsFromKnownIP",
"expressions": ["conn.ClientIP == '110.0.0.1"],
"expressions": ["conn.client_ip == '110.0.0.1"],
"actions": [
{
"type": "log",
Expand All @@ -46,12 +46,12 @@ Traffic Policies can be defined in `json` or `yaml`!
on_tcp_connect:
- name: DenyTrafficOutsideUS
expressions:
- conn.Geo.CountryCode != 'US'
- conn.geo.country_code != 'US'
actions:
- type: deny
- name: LogRequestsFromKnownIP
expressions:
- conn.ClientIP == '110.0.0.1
- conn.client_ip == '110.0.0.1
actions:
- type: log
config:
Expand Down
8 changes: 4 additions & 4 deletions examples/python-sdk/tls-traffic-policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Traffic Policies can be defined in `json` or `yaml`!
"on_tcp_connect": [
{
"name": "DenyTrafficOutsideUS",
"expressions": ["conn.Geo.CountryCode != 'US'"],
"expressions": ["conn.geo.country_code != 'US'"],
"actions": [
{
"type": "deny"
Expand All @@ -24,7 +24,7 @@ Traffic Policies can be defined in `json` or `yaml`!
},
{
"name": "LogRequestsFromKnownIP",
"expressions": ["conn.ClientIP == '110.0.0.1"],
"expressions": ["conn.client_ip == '110.0.0.1"],
"actions": [
{
"type": "log",
Expand All @@ -46,12 +46,12 @@ Traffic Policies can be defined in `json` or `yaml`!
on_tcp_connect:
- name: DenyTrafficOutsideUS
expressions:
- conn.Geo.CountryCode != 'US'
- conn.geo.country_code != 'US'
actions:
- type: deny
- name: LogRequestsFromKnownIP
expressions:
- conn.ClientIP == '110.0.0.1
- conn.client_ip == '110.0.0.1
actions:
- type: log
config:
Expand Down
34 changes: 17 additions & 17 deletions traffic-policy/gallery.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const JWTsRateLimiting = () => (
algorithm: "sliding_window",
capacity: 30,
rate: "60s",
bucket_key: ["req.Headers['x-api-key']"],
bucket_key: ["req.headers['x-api-key']"],
},
},
{
Expand Down Expand Up @@ -225,7 +225,7 @@ export const RateLimitAuthentication = () => (
config={{
on_http_request: [
{
expressions: ["!('Authorization' in req.Headers)"],
expressions: ["!('Authorization' in req.headers)"],
name: "Unauthorized rate limiting tier",
actions: [
{
Expand All @@ -235,13 +235,13 @@ export const RateLimitAuthentication = () => (
algorithm: "sliding_window",
capacity: 10,
rate: "60s",
bucket_key: ["conn.ClientIP"],
bucket_key: ["conn.client_ip"],
},
},
],
},
{
expressions: ["('Authorization' in req.Headers)"],
expressions: ["('Authorization' in req.headers)"],
name: "Authorized rate limiting tier",
actions: [
{
Expand All @@ -251,7 +251,7 @@ export const RateLimitAuthentication = () => (
algorithm: "sliding_window",
capacity: 100,
rate: "60s",
bucket_key: ["conn.ClientIP"],
bucket_key: ["conn.client_ip"],
},
},
],
Expand All @@ -268,7 +268,7 @@ export const BlockCountries = () => (
on_http_request: [
{
expressions: [
"conn.Geo.CountryCode in ['<COUNTRY-01>', '<COUNTRY-02>']",
"conn.geo.country_code in ['<COUNTRY-01>', '<COUNTRY-02>']",
],
name: "Block traffic from unwanted countries",
actions: [
Expand All @@ -292,7 +292,7 @@ export const RateLimitPricing = () => (
config={{
on_http_request: [
{
expressions: ["!('Tier' in req.Headers)"],
expressions: ["!('Tier' in req.headers)"],
name: "Free rate limiting tier",
actions: [
{
Expand All @@ -302,7 +302,7 @@ export const RateLimitPricing = () => (
algorithm: "sliding_window",
capacity: 10,
rate: "60s",
bucket_key: ["conn.ClientIP"],
bucket_key: ["conn.client_ip"],
},
},
],
Expand All @@ -320,7 +320,7 @@ export const RateLimitPricing = () => (
algorithm: "sliding_window",
capacity: 100,
rate: "60s",
bucket_key: ["conn.ClientIP"],
bucket_key: ["conn.client_ip"],
},
},
],
Expand All @@ -338,7 +338,7 @@ export const RateLimitPricing = () => (
algorithm: "sliding_window",
capacity: 1000,
rate: "60s",
bucket_key: ["conn.ClientIP"],
bucket_key: ["conn.client_ip"],
},
},
],
Expand All @@ -356,7 +356,7 @@ export const RateLimitPricing = () => (
algorithm: "sliding_window",
capacity: 10000,
rate: "60s",
bucket_key: ["conn.ClientIP"],
bucket_key: ["conn.client_ip"],
},
},
],
Expand All @@ -372,7 +372,7 @@ export const DeprecateVersion = () => (
config={{
on_http_request: [
{
expressions: ["'2' in req.Headers['X-Api-Version']"],
expressions: ["'2' in req.headers['X-Api-Version']"],
name: "Deprecate API v2",
actions: [
{
Expand Down Expand Up @@ -443,14 +443,14 @@ export const EnforceTLS = () => (
config={{
on_http_request: [
{
expressions: ["req.ClientTLS.Version > '1.3'"],
expressions: ["conn.tls.version < '1.3'"],
name: "Reject requests using old TLS versions",
actions: [
{
type: "custom-response",
config: {
status_code: 401,
content: "Unauthorized: bad TLS version",
content: "Unauthorized: TLS version too old",
},
},
],
Expand All @@ -467,7 +467,7 @@ export const LogUnsuccessful = () => (
on_http_request: [],
on_http_response: [
{
expressions: ["res.StatusCode < '200' && res.StatusCode >= '300'"],
expressions: ["res.status_code < '200' && res.status_code >= '300'"],
name: "Log unsuccessful requests",
actions: [
{
Expand All @@ -493,8 +493,8 @@ export const LimitSize = () => (
on_http_request: [
{
expressions: [
"req.Method == 'POST' || req.Method == 'PUT'",
"req.ContentLength >= 1000",
"req.method == 'POST' || req.method == 'PUT'",
"req.content_length >= 1000",
],
name: "Block POST/PUT requests of excessive length",
actions: [
Expand Down

0 comments on commit fabf468

Please sign in to comment.