pog-server
Описание
Языки
- Go95,3%
- Dockerfile2,8%
- HCL1,9%
Proxy over gRPC
pog-server is a HTTP proxy which uses gRPC for sending bytes:
User <-(HTTP proxying)-> pog client <-(gRPC)-> pog server <-(HTTP proxying)-> destination server
Applications of Proxy over gRPC (PoG)
- terraform: if https://registry.terraform.io/ is
, one can use it with a proxy like:not currently available in your region
- If a site is not available from your IP address, use the proxy, e.g. with Google Chrome:
Simple example of use
The pog server:
The pog client:
A user of the HTTP proxy:
Here the user reaches the destination URL ifconfig.me via the HTTP proxy at https://localhost:18080 .
How to build
Go programming language version > 1.21 is required.
How to build Docker image
How to deploy to Google Cloud Run using Terraform1
The server part can be deployed into GCP Cloud Run, see as an example. First, let's gate our server service with auth with login and password:
This JSON value we assign to the env variable POG_AUTH_ITEM1, see
Having a GCP project , do:
Optionally, let's gate user requests to our client service, login=user and password=password:
The client part:
Finally, the user request:
Optional tweaks to GCP service config (pog-server.tf)
For a single home usage, the Cloud Run costs might be not affordable (around 15$/m), so one might try those tweaks:
Options
All the options are represented as environment variables.
The server part options:
| Variable | Description |
|---|---|
| PORT | Port to listen to. Default: |
| POG_AUTH_* | Enables authorization for PoG clients. Use to generate JSON values |
| GRPC_AND_HTTP_MUX | Listen to both gRPC and HTTP requests (/metrics). Default: (enabled) |
The client part options:
| Variable | Description |
|---|---|
| SERVER_ADDR | PoG server address (host:port). Required. Example: |
| INSECURE | Skip SSL validation. Default: `` (false) |
| CLIENT_LISTEN | Client address to listen to ([host]:port). Default: |
| CLIENT_POG_AUTH | Auth string to connect to PoG server, in the form |
| CLIENT_AUTH_* | Enables authorization for proxy users. Use to generate JSON values |
| MUX_SERVER_METRICS | Serve both server and client metrics from , iff there is any connection to the server. Default: `` (false) |
The common options:
| Variable | Description |
|---|---|
| DISABLE_ACCESS_LOGGING | Disables request logging in the form |
| METRIC_NAMESPACE | Prepends metrics with a prefix (useful to avoid confusion between server and client metrics in case of ) |
| GRPC_BUILTIN_METRICS | Populates with the builtin gRPC metrics. Default: (enabled) |
Metrics and operations
Both PoG server and client provides Prometheus metrics at . An example:
What does it mean:
: stats how much requests were processed and their successrpcs: a gauge featuring how many connections are being proccessed now; if the value is growing over time then there is a memory leaktunnelling_connections_total: time when a user account is to expire (both at server and client side)auth_item_earliest_expiry