Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am gszr on github.
  • I am gszr (https://keybase.io/gszr) on keybase.
  • I have a public key ASBcYvnFN8zoVLdM_9sA36lmowmPU87HD4QM2EPBk2PTWAo

To claim this, I am signing this object:

diff --git a/spec/helpers.lua b/spec/helpers.lua
index 85e9589d6..061ac68d0 100644
--- a/spec/helpers.lua
+++ b/spec/helpers.lua
@@ -1415,4 +1415,11 @@ return {
ngx.ctx.workspaces = old_ws
return res
end,
+ setenv = function(env, value)
+ local ffi = require "ffi"
@gszr
gszr / grpc_pr.md
Last active July 16, 2019 22:02
gRPC PR description

Summary

This PR adds native gRPC proxying support to Kong. New named location blocks -- grpc and grpcs were added to the Kong Nginx template. Incoming gRPC requests are redirected to said locations, where a grpc_pass happens -- as opposed to proxy_pass. New protocols were added for gRPC and gRPCs, which can be specified, e.g., upon Route and Service creation.

Examples

The following example shows how to create a gRPC Service and Route. grpcbin and grpcurl are used in these examples.

Single Service and Route

# go.yml
_format_version: "1.1"
services:
- url: https://httpbin.org
routes:
- paths:
- "/"
plugins:
- name: go-hello
config:
_format_version: "1.1"
services:
- connect_timeout: 60000
host: localhost
name: hello-grpc-dev
port: 9000
protocol: grpc
read_timeout: 60000
retries: 5
write_timeout: 60000
_format_version: "1.1"
services:
- name: service1
host: upstream1
protocol: http
retries: 5
connect_timeout: 60000
write_timeout: 60000
read_timeout: 60000
path: /
@gszr
gszr / README
Last active February 26, 2024 16:10
Not following me back!
From: https://stackoverflow.com/questions/32407851/instagram-api-how-can-i-retrieve-the-list-of-people-a-user-is-following-on-ins
@gszr
gszr / gist:6164e79c596bd98d3a4fd170ff351611
Created March 8, 2024 14:26
GCC optimization levels
# -O1
-fauto-inc-dec
-fbranch-count-reg
-fcombine-stack-adjustments
-fcompare-elim
-fcprop-registers
-fdce
-fdefer-pop
-fdelayed-branch
0xffffffffb2fae15d
C:ngx_http_lua_socket_tcp_receive
@./kong/runloop/plugin_servers/pb_rpc.lua:263
@./kong/runloop/plugin_servers/pb_rpc.lua:301
@./kong/runloop/plugin_servers/pb_rpc.lua:394
@./kong/runloop/plugin_servers/bridge.lua:175
23
0xffffffffb22fdc3a
C:ngx_http_lua_socket_tcp_receive
@./kong/runloop/plugin_servers/pb_rpc.lua:263
=header_filter_by_lua(nginx-kong.conf:116):0;@./kong/init.lua:1528;@./kong/runloop/handler.lua:1468;T:@./kong/runloop/handler.lua:1468;0x7049c48dad63 3
=header_filter_by_lua(nginx-kong.conf:116):0;@./kong/init.lua:1528;@./kong/runloop/handler.lua:1468;T:@./kong/runloop/handler.lua:1468;0x7049c48dae2a 3
=header_filter_by_lua(nginx-kong.conf:116):0;@./kong/init.lua:1528;@./kong/runloop/handler.lua:1468;T:@./kong/runloop/handler.lua:1468;ngx_http_lua_escape_uri 3
=log_by_lua(nginx-kong.conf:124):0;@./kong/init.lua:1701;@./kong/init.lua:432;@./kong/plugins/file-log/handler.lua:73;@./kong/pdk/log.lua:794;@./kong/tools/table.lua:204;T:@./kong/tools/table.lua:204;__default_morecore 5
=log_by_lua(nginx-kong.conf:124):0;@./kong/init.lua:1701;@./kong/init.lua:432;@./kong/plugins/file-log/handler.lua:73;@./kong/plugins/file-log/handler.lua:40;C:json_encode;0x7049c48ec009 7
=log_by_lua(nginx-kong.conf:124):0;@./kong/init.lua:1701;@./kong/init.lua:432;@./kong/plugins/file-log/handler.lua:73;@./kong/plugins/file-log/handle