osprey 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Cargo.toml ADDED
@@ -0,0 +1,7 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/osprey"]
7
+ resolver = "2"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Wouter Coppieters
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ - Test WSS
2
+ - Test SSE
3
+ - Fix Single Mode
4
+ - Fix Dead Daemon replacement
5
+ - Partial Hijack
6
+ - Performance
7
+ - Inline best prac
8
+ - Support IPv6 + IPv4 binds
9
+ - Early hints
10
+ - Static file serving (Support Rack::File and Rack::Directory)
11
+ - Self-generate certs (Let's encrypt if on hostname, else self-signed)
12
+ - Readme
13
+ - Use own scheduler implementation
14
+ - Release
15
+
16
+ Later:
17
+ - Fuzz
18
+ - gRPC
19
+ - Molds/Templates
20
+
21
+ # Osprey
22
+
23
+ TODO: Delete this and the text below, and describe your gem
24
+
25
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/osprey`. To experiment with that code, run `bin/console` for an interactive prompt.
26
+
27
+ ## Installation
28
+
29
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
30
+
31
+ Install the gem and add to the application's Gemfile by executing:
32
+
33
+ ```bash
34
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
35
+ ```
36
+
37
+ If bundler is not being used to manage dependencies, install the gem by executing:
38
+
39
+ ```bash
40
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ TODO: Write usage instructions here
46
+
47
+ ## Development
48
+
49
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+
51
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/osprey. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/osprey/blob/master/CODE_OF_CONDUCT.md).
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
60
+
61
+ ## Code of Conduct
62
+
63
+ Everyone interacting in the Osprey project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/osprey/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ require "rb_sys/extensiontask"
13
+
14
+ task build: :compile
15
+
16
+ GEMSPEC = Gem::Specification.load("osprey.gemspec")
17
+
18
+ RbSys::ExtensionTask.new("osprey", GEMSPEC) do |ext|
19
+ ext.lib_dir = "lib/osprey"
20
+ end
21
+
22
+ task default: %i[compile test rubocop]
data/exe/osprey ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../lib/osprey"
5
+
6
+ require "optparse"
7
+ require "rack"
8
+ require "etc"
9
+
10
+ options = {
11
+ host: "[::]",
12
+ port: 8443,
13
+ http_port: 8080,
14
+ workers: Etc.nprocessors,
15
+ threads: 3,
16
+ shutdown_timeout: 5,
17
+ script_name: "/"
18
+ }
19
+
20
+ # Define the option parser
21
+ OptionParser.new do |opts|
22
+ opts.banner = "Usage: script.rb [options]"
23
+
24
+ opts.on("-w", "--workers WORKERS", Integer, "Number of workers (default: #{options[:workers]})") do |w|
25
+ options[:workers] = w
26
+ end
27
+
28
+ opts.on("-t", "--threads THREADS", Integer, "Number of threads (default: #{options[:threads]})") do |t|
29
+ options[:threads] = t
30
+ end
31
+
32
+ opts.on("-h", "--host HOST", String, "Host to bind to (default: #{options[:host]})") do |h|
33
+ options[:host] = h
34
+ end
35
+
36
+ opts.on("-p", "--port PORT", Integer, "Port for the application (default: #{options[:port]})") do |p|
37
+ options[:port] = p
38
+ end
39
+
40
+ opts.on("--http_port HTTP_PORT", Integer, "HTTP port for the application (default: #{options[:http_port]})") do |hp|
41
+ options[:http_port] = hp
42
+ end
43
+
44
+ opts.on("--cert_path CERT_PATH", String, "Path to the SSL certificate file") do |cp|
45
+ options[:cert_path] = cp
46
+ end
47
+
48
+ opts.on("--key_path KEY_PATH", String, "Path to the SSL key file") do |kp|
49
+ options[:key_path] = kp
50
+ end
51
+
52
+ opts.on("--shutdown_timeout SHUTDOWN_TIMEOUT", String,
53
+ "Graceful timeout period before forcing workers to shutdown") do |shutdown_timeout|
54
+ options[:shutdown_timeout] = shutdown_timeout
55
+ end
56
+
57
+ opts.on("--script_name SCRIPT_NAME", String, "Script name to inject into Rack ENV") do |script_name|
58
+ options[:script_name] = script_name
59
+ end
60
+
61
+ opts.on("--help", "Show this help message") do
62
+ puts opts
63
+ exit
64
+ end
65
+ end.parse!
66
+
67
+ # Parse the Rack application
68
+ rack_app, rack_options = Rack::Builder.parse_file("config.ru")
69
+
70
+ # Merge Rack options with CLI options
71
+ options.merge!((rack_options || {}).slice(options.keys))
72
+
73
+ # Start the Osprey server
74
+ Osprey.start(
75
+ app: rack_app,
76
+ **options
77
+ )
@@ -0,0 +1,28 @@
1
+ [package]
2
+ name = "osprey"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ authors = ["Wouter Coppieters <wc@pico.net.nz>"]
6
+ license = "MIT"
7
+ publish = false
8
+
9
+ [lib]
10
+ crate-type = ["cdylib"]
11
+
12
+ [dependencies]
13
+ nix = { version = "0.29.0", features = ["socket", "uio"] }
14
+ libc = "0.2.169"
15
+ magnus = { version = "0.7.1", features = ["rb-sys", "bytes"] }
16
+ rb-sys = "0.9.105"
17
+ socket2 = "0.5.8"
18
+ bytes = "1.3"
19
+ http-body-util = "0.1.2"
20
+ hyper = { version = "1.5.0", features = ["full", "server", "http1", "http2"] }
21
+ tokio = { version = "1", features = ["full"] }
22
+ tokio-rustls = "0.23"
23
+ hyper-util = { version = "0.1.10", features = ["full"] }
24
+ log = { version = "0.4.25", features = ["kv"] }
25
+ simple_logger = "5.0.0"
26
+ crossbeam = "0.8.4"
27
+ dashmap = "6.1.0"
28
+ tokio-stream = "0.1.17"
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "mkmf"
4
+ require "rb_sys/mkmf"
5
+
6
+ create_rust_makefile("osprey/osprey")
Binary file