geofiltering-thruster 0.1.17-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +125 -0
- data/exe/thrust +11 -0
- data/exe/x86_64-linux/thrust +0 -0
- data/lib/thruster/version.rb +3 -0
- data/lib/thruster.rb +4 -0
- metadata +50 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a677a18bc873d8745b6fc94f762bd5bee878abb166e8abe620361bbae0da432b
|
|
4
|
+
data.tar.gz: 323d42a72042f9418296e77c579156014168eb1beea8461bb534df0a88fa166f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 85f051ab08b0f3c77325c4641aa6a70a6536470d04cb40ab108707632e1617b7ad66f3dd33e75ccecdc491b6833bbdc523bfc0b604e4eabde4bb9beacfc525f3
|
|
7
|
+
data.tar.gz: '0579b7d1911c740c452f976765ac7a966250a52afc8345a92f15f3e887905d760bbacc3ef65e90db0998717a3fdd2058a6d14fe2fbaefafceaf555f29a5a40b1'
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 37signals, LLC
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# GeoFiltering-Thruster
|
|
2
|
+
|
|
3
|
+
This fork adds IP based GeoFiltering capability to Thruster.
|
|
4
|
+
|
|
5
|
+
==> **I'm a golang novice and these changes were made with ample help from Claude. Use it at your own risk.** <==
|
|
6
|
+
|
|
7
|
+
Thruster is an HTTP/2 proxy for simple production-ready deployments of Rails
|
|
8
|
+
applications. It runs alongside the Puma webserver to provide a few additional
|
|
9
|
+
features that help your app run efficiently and safely on the open Internet:
|
|
10
|
+
|
|
11
|
+
- HTTP/2 support
|
|
12
|
+
- Automatic TLS certificate management with Let's Encrypt
|
|
13
|
+
- Basic HTTP caching of public assets
|
|
14
|
+
- X-Sendfile support and compression, to efficiently serve static files
|
|
15
|
+
|
|
16
|
+
Thruster aims to be as zero-config as possible. It has no configuration file,
|
|
17
|
+
and most features are automatically enabled with sensible defaults. The goal is
|
|
18
|
+
that simply running your Puma server with Thruster should be enough to get a
|
|
19
|
+
production-ready setup.
|
|
20
|
+
|
|
21
|
+
The only exception to this is TLS provisioning: in order for Thruster to
|
|
22
|
+
provision TLS certificates, it needs to know which domain those certificates
|
|
23
|
+
should be for. So to use TLS, you need to set the `TLS_DOMAIN` environment
|
|
24
|
+
variable. If you don't set this variable, Thruster will run in HTTP-only mode.
|
|
25
|
+
|
|
26
|
+
Thruster also wraps the Puma process so that you can use it without managing
|
|
27
|
+
multiple processes yourself. This is particularly useful when running in a
|
|
28
|
+
containerized environment, where you typically won't have a process manager
|
|
29
|
+
available to coordinate the processes. Instead you can use Thruster as your
|
|
30
|
+
`CMD`, and it will manage Puma for you.
|
|
31
|
+
|
|
32
|
+
Thruster was originally created for the [ONCE](https://once.com) project, where
|
|
33
|
+
we wanted a no-fuss way to serve a Rails application from a single container,
|
|
34
|
+
directly on the open Internet. We've since found it useful for simple
|
|
35
|
+
deployments of other Rails applications.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Thruster is distributed as a Ruby gem. Because Thruster is written in Go, we
|
|
41
|
+
provide several pre-built platform-specific binaries. Installing the gem will
|
|
42
|
+
automatically fetch the appropriate binary for your platform.
|
|
43
|
+
|
|
44
|
+
To install it, add it to your application's Gemfile:
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
gem 'thruster'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or install it globally:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
$ gem install thruster
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
To run your Puma application inside Thruster, prefix your usual command string
|
|
60
|
+
with `thrust`. For example:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
$ thrust bin/rails server
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or with automatic TLS:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
$ TLS_DOMAIN=myapp.example.com thrust bin/rails server
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Custom configuration
|
|
74
|
+
|
|
75
|
+
In most cases, Thruster should work out of the box with no additional
|
|
76
|
+
configuration. But if you need to customize its behavior, there are a few
|
|
77
|
+
environment variables that you can set.
|
|
78
|
+
|
|
79
|
+
| Variable Name | Description | Default Value |
|
|
80
|
+
|-----------------------------|---------------------------------------------------------|---------------|
|
|
81
|
+
| `TLS_DOMAIN` | Comma-separated list of domain names to use for TLS provisioning. If not set, TLS will be disabled. | None |
|
|
82
|
+
| `TARGET_PORT` | The port that your Puma server should run on. Thruster will set `PORT` to this value when starting your server. | 3000 |
|
|
83
|
+
| `CACHE_SIZE` | The size of the HTTP cache in bytes. | 64MB |
|
|
84
|
+
| `MAX_CACHE_ITEM_SIZE` | The maximum size of a single item in the HTTP cache in bytes. | 1MB |
|
|
85
|
+
| `GZIP_COMPRESSION_ENABLED` | Whether to enable gzip compression for static assets. Set to `0` or `false` to disable. | Enabled |
|
|
86
|
+
| `X_SENDFILE_ENABLED` | Whether to enable X-Sendfile support. Set to `0` or `false` to disable. | Enabled |
|
|
87
|
+
| `MAX_REQUEST_BODY` | The maximum size of a request body in bytes. Requests larger than this size will be refused; `0` means no maximum size is enforced. | `0` |
|
|
88
|
+
| `STORAGE_PATH` | The path to store Thruster's internal state. Provisioned TLS certificates will be stored here, so that they will not need to be requested every time your application is started. | `./storage/thruster` |
|
|
89
|
+
| `BAD_GATEWAY_PAGE` | Path to an HTML file to serve when the backend server returns a 502 Bad Gateway error. If there is no file at the specific path, Thruster will serve an empty 502 response instead. Because Thruster boots very quickly, a custom page can be a useful way to show that your application is starting up. | `./public/502.html` |
|
|
90
|
+
| `HTTP_PORT` | The port to listen on for HTTP traffic. | 80 |
|
|
91
|
+
| `HTTPS_PORT` | The port to listen on for HTTPS traffic. | 443 |
|
|
92
|
+
| `HTTP_IDLE_TIMEOUT` | The maximum time in seconds that a client can be idle before the connection is closed. | 60 |
|
|
93
|
+
| `HTTP_READ_TIMEOUT` | The maximum time in seconds that a client can take to send the request headers and body. | 30 |
|
|
94
|
+
| `HTTP_WRITE_TIMEOUT` | The maximum time in seconds during which the client must read the response. | 30 |
|
|
95
|
+
| `ACME_DIRECTORY` | The URL of the ACME directory to use for TLS certificate provisioning. | `https://acme-v02.api.letsencrypt.org/directory` (Let's Encrypt production) |
|
|
96
|
+
| `EAB_KID` | The EAB key identifier to use when provisioning TLS certificates, if required. | None |
|
|
97
|
+
| `EAB_HMAC_KEY` | The Base64-encoded EAB HMAC key to use when provisioning TLS certificates, if required. | None |
|
|
98
|
+
| `FORWARD_HEADERS` | Whether to forward X-Forwarded-* headers from the client. | Disabled when running with TLS; enabled otherwise |
|
|
99
|
+
| `LOG_REQUESTS` | Log all requests. Set to `0` or `false` to disable request logging | Enabled |
|
|
100
|
+
| `DEBUG` | Set to `1` or `true` to enable debug logging. | Disabled |
|
|
101
|
+
| `ALLOW_COUNTRIES` | Comma-separated list of ISO country codes to allow (e.g., "US,CA,GB"). Requests from other countries will be blocked. Automatically enables GeoIP2. | None |
|
|
102
|
+
| `BLOCK_COUNTRIES` | Comma-separated list of ISO country codes to block (e.g., "CN,RU"). Requests from these countries will be blocked. Automatically enables GeoIP2. | None |
|
|
103
|
+
|
|
104
|
+
To prevent naming clashes with your application's own environment variables,
|
|
105
|
+
Thruster's environment variables can optionally be prefixed with `THRUSTER_`.
|
|
106
|
+
For example, `TLS_DOMAIN` can also be written as `THRUSTER_TLS_DOMAIN`. Whenever
|
|
107
|
+
a prefixed variable is set, it will take precedence over the unprefixed version.
|
|
108
|
+
|
|
109
|
+
## GeoIP2 Integration
|
|
110
|
+
|
|
111
|
+
Thruster includes optional GeoIP2 support for geographic location detection based on client IP addresses. When enabled, Thruster adds geographic information to request headers that can be accessed by your application.
|
|
112
|
+
|
|
113
|
+
### Enabling GeoIP2
|
|
114
|
+
|
|
115
|
+
GeoIP2 functionality is automatically enabled when you configure country filtering (`ALLOW_COUNTRIES` or `BLOCK_COUNTRIES`). The GeoIP2 database file should be placed in one of these common locations:
|
|
116
|
+
- `./GeoLite2-Country.mmdb`
|
|
117
|
+
- `./data/GeoLite2-Country.mmdb`
|
|
118
|
+
- `./storage/GeoLite2-Country.mmdb`
|
|
119
|
+
|
|
120
|
+
When a request is processed with GeoIP2 enabled, Thruster will add the following header to the request:
|
|
121
|
+
- `X-GeoIP-Country`: ISO country code (e.g., "US", "CA")
|
|
122
|
+
|
|
123
|
+
Your Rails application can then access this information via `request.headers['X-GeoIP-Country']`.
|
|
124
|
+
|
|
125
|
+
**Note:** You'll need to obtain a GeoIP2 database file from MaxMind. The free GeoLite2 databases are available at https://dev.maxmind.com/geoip/geolite2-free-geolocation-data.
|
data/exe/thrust
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
PLATFORM = [ :cpu, :os ].map { |m| Gem::Platform.local.send(m) }.join("-")
|
|
4
|
+
EXECUTABLE = File.expand_path(File.join(__dir__, PLATFORM, "thrust"))
|
|
5
|
+
|
|
6
|
+
if File.exist?(EXECUTABLE)
|
|
7
|
+
exec(EXECUTABLE, *ARGV)
|
|
8
|
+
else
|
|
9
|
+
STDERR.puts("ERROR: Unsupported platform: #{PLATFORM}")
|
|
10
|
+
exit 1
|
|
11
|
+
end
|
|
Binary file
|
data/lib/thruster.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: geofiltering-thruster
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.17
|
|
5
|
+
platform: x86_64-linux
|
|
6
|
+
authors:
|
|
7
|
+
- Kevin McConnell
|
|
8
|
+
- Bhal Agashe
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A zero-config HTTP/2 proxy for lightweight production deployments with
|
|
14
|
+
country-based request filtering
|
|
15
|
+
email: kevin@37signals.com
|
|
16
|
+
executables:
|
|
17
|
+
- thrust
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- MIT-LICENSE
|
|
22
|
+
- README.md
|
|
23
|
+
- exe/thrust
|
|
24
|
+
- exe/x86_64-linux/thrust
|
|
25
|
+
- lib/thruster.rb
|
|
26
|
+
- lib/thruster/version.rb
|
|
27
|
+
homepage: https://github.com/bagashe/geofiltering-thruster
|
|
28
|
+
licenses:
|
|
29
|
+
- MIT
|
|
30
|
+
metadata:
|
|
31
|
+
homepage_uri: https://github.com/bagashe/geofiltering-thruster
|
|
32
|
+
rubygems_mfa_required: 'true'
|
|
33
|
+
rdoc_options: []
|
|
34
|
+
require_paths:
|
|
35
|
+
- lib
|
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
requirements: []
|
|
47
|
+
rubygems_version: 3.6.9
|
|
48
|
+
specification_version: 4
|
|
49
|
+
summary: Zero-config HTTP/2 proxy with GeoIP filtering
|
|
50
|
+
test_files: []
|