itsi 0.1.0

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.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/Cargo.lock +1541 -0
  3. data/Cargo.toml +13 -0
  4. data/README.md +82 -0
  5. data/Rakefile +87 -0
  6. data/crates/itsi_error/Cargo.lock +368 -0
  7. data/crates/itsi_error/Cargo.toml +9 -0
  8. data/crates/itsi_error/src/lib.rs +49 -0
  9. data/crates/itsi_rb_helpers/Cargo.lock +355 -0
  10. data/crates/itsi_rb_helpers/Cargo.toml +8 -0
  11. data/crates/itsi_rb_helpers/src/lib.rs +98 -0
  12. data/crates/itsi_scheduler/Cargo.toml +16 -0
  13. data/crates/itsi_scheduler/extconf.rb +6 -0
  14. data/crates/itsi_scheduler/src/lib.rs +17 -0
  15. data/crates/itsi_server/Cargo.toml +29 -0
  16. data/crates/itsi_server/extconf.rb +6 -0
  17. data/crates/itsi_server/src/lib.rs +52 -0
  18. data/crates/itsi_server/src/request/itsi_request.rs +143 -0
  19. data/crates/itsi_server/src/request/mod.rs +1 -0
  20. data/crates/itsi_server/src/server/bind.rs +138 -0
  21. data/crates/itsi_server/src/server/itsi_ca/itsi_ca.crt +32 -0
  22. data/crates/itsi_server/src/server/itsi_ca/itsi_ca.key +52 -0
  23. data/crates/itsi_server/src/server/itsi_server.rs +182 -0
  24. data/crates/itsi_server/src/server/listener.rs +218 -0
  25. data/crates/itsi_server/src/server/mod.rs +5 -0
  26. data/crates/itsi_server/src/server/tls.rs +138 -0
  27. data/crates/itsi_server/src/server/transfer_protocol.rs +23 -0
  28. data/crates/itsi_server/src/stream_writer/mod.rs +21 -0
  29. data/crates/itsi_tracing/Cargo.lock +274 -0
  30. data/crates/itsi_tracing/Cargo.toml +12 -0
  31. data/crates/itsi_tracing/src/lib.rs +11 -0
  32. data/gems/scheduler/.gitignore +14 -0
  33. data/gems/scheduler/.rubocop.yml +8 -0
  34. data/gems/scheduler/CHANGELOG.md +5 -0
  35. data/gems/scheduler/CODE_OF_CONDUCT.md +132 -0
  36. data/gems/scheduler/Cargo.lock +745 -0
  37. data/gems/scheduler/Cargo.toml +3 -0
  38. data/gems/scheduler/LICENSE.txt +21 -0
  39. data/gems/scheduler/README.md +43 -0
  40. data/gems/scheduler/Rakefile +22 -0
  41. data/gems/scheduler/bin/console +11 -0
  42. data/gems/scheduler/bin/setup +8 -0
  43. data/gems/scheduler/ext/itsi_error/Cargo.lock +368 -0
  44. data/gems/scheduler/ext/itsi_error/Cargo.toml +9 -0
  45. data/gems/scheduler/ext/itsi_error/src/lib.rs +49 -0
  46. data/gems/scheduler/ext/itsi_rb_helpers/Cargo.lock +355 -0
  47. data/gems/scheduler/ext/itsi_rb_helpers/Cargo.toml +8 -0
  48. data/gems/scheduler/ext/itsi_rb_helpers/src/lib.rs +98 -0
  49. data/gems/scheduler/ext/itsi_scheduler/Cargo.toml +16 -0
  50. data/gems/scheduler/ext/itsi_scheduler/extconf.rb +6 -0
  51. data/gems/scheduler/ext/itsi_scheduler/src/lib.rs +17 -0
  52. data/gems/scheduler/ext/itsi_tracing/Cargo.lock +274 -0
  53. data/gems/scheduler/ext/itsi_tracing/Cargo.toml +12 -0
  54. data/gems/scheduler/ext/itsi_tracing/src/lib.rs +11 -0
  55. data/gems/scheduler/itsi-scheduler.gemspec +43 -0
  56. data/gems/scheduler/lib/itsi/scheduler/version.rb +7 -0
  57. data/gems/scheduler/lib/itsi/scheduler.rb +11 -0
  58. data/gems/scheduler/sig/itsi_scheduler.rbs +4 -0
  59. data/gems/scheduler/test/test_helper.rb +6 -0
  60. data/gems/scheduler/test/test_itsi_scheduler.rb +9 -0
  61. data/gems/server/.gitignore +14 -0
  62. data/gems/server/.rubocop.yml +8 -0
  63. data/gems/server/CHANGELOG.md +5 -0
  64. data/gems/server/CODE_OF_CONDUCT.md +132 -0
  65. data/gems/server/LICENSE.txt +21 -0
  66. data/gems/server/README.md +43 -0
  67. data/gems/server/Rakefile +22 -0
  68. data/gems/server/bin/console +11 -0
  69. data/gems/server/bin/setup +8 -0
  70. data/gems/server/exe/itsi +84 -0
  71. data/gems/server/ext/itsi_error/Cargo.lock +368 -0
  72. data/gems/server/ext/itsi_error/Cargo.toml +9 -0
  73. data/gems/server/ext/itsi_error/src/lib.rs +49 -0
  74. data/gems/server/ext/itsi_rb_helpers/Cargo.lock +355 -0
  75. data/gems/server/ext/itsi_rb_helpers/Cargo.toml +8 -0
  76. data/gems/server/ext/itsi_rb_helpers/src/lib.rs +98 -0
  77. data/gems/server/ext/itsi_server/Cargo.toml +29 -0
  78. data/gems/server/ext/itsi_server/extconf.rb +6 -0
  79. data/gems/server/ext/itsi_server/src/lib.rs +52 -0
  80. data/gems/server/ext/itsi_server/src/request/itsi_request.rs +143 -0
  81. data/gems/server/ext/itsi_server/src/request/mod.rs +1 -0
  82. data/gems/server/ext/itsi_server/src/server/bind.rs +138 -0
  83. data/gems/server/ext/itsi_server/src/server/itsi_ca/itsi_ca.crt +32 -0
  84. data/gems/server/ext/itsi_server/src/server/itsi_ca/itsi_ca.key +52 -0
  85. data/gems/server/ext/itsi_server/src/server/itsi_server.rs +182 -0
  86. data/gems/server/ext/itsi_server/src/server/listener.rs +218 -0
  87. data/gems/server/ext/itsi_server/src/server/mod.rs +5 -0
  88. data/gems/server/ext/itsi_server/src/server/tls.rs +138 -0
  89. data/gems/server/ext/itsi_server/src/server/transfer_protocol.rs +23 -0
  90. data/gems/server/ext/itsi_server/src/stream_writer/mod.rs +21 -0
  91. data/gems/server/ext/itsi_tracing/Cargo.lock +274 -0
  92. data/gems/server/ext/itsi_tracing/Cargo.toml +12 -0
  93. data/gems/server/ext/itsi_tracing/src/lib.rs +11 -0
  94. data/gems/server/itsi-server.gemspec +45 -0
  95. data/gems/server/lib/itsi/request.rb +39 -0
  96. data/gems/server/lib/itsi/server/version.rb +7 -0
  97. data/gems/server/lib/itsi/server.rb +21 -0
  98. data/gems/server/sig/itsi_server.rbs +4 -0
  99. data/gems/server/test/test_helper.rb +5 -0
  100. data/gems/server/test/test_itsi_server.rb +9 -0
  101. data/lib/itsi/version.rb +3 -0
  102. data/lib/itsi.rb +6 -0
  103. metadata +172 -0
data/Cargo.toml ADDED
@@ -0,0 +1,13 @@
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 = [
7
+ "./crates/itsi_scheduler",
8
+ "./crates/itsi_server",
9
+ "./crates/itsi_error",
10
+ "./crates/itsi_tracing",
11
+ "./crates/itsi_rb_helpers",
12
+ ]
13
+ resolver = "2"
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # Itsi
2
+
3
+ The Itsi gem is a wrapper gem for both the
4
+ * Itsi Server (A light-weight and efficient Rack server, with support for http2, fibers, websockets, static file serving and more)
5
+ * Itsi Scheduler (A light-weight Ruby Fiber Scheduler implementation)
6
+
7
+ You can use either of these components independently, or simply install this wrapper gem
8
+ to bring across both components in a single dependency.
9
+
10
+ ## Installation
11
+
12
+ Install the gem and add to the application's Gemfile by executing:
13
+
14
+ ```bash
15
+ bundle add itsi
16
+ ```
17
+
18
+ If bundler is not being used to manage dependencies, install the gem by executing:
19
+
20
+ ```bash
21
+ gem install itsi
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ TODO: Write usage instructions here
27
+
28
+ ## Development
29
+
30
+ 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.
31
+
32
+ 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).
33
+
34
+ ## SEO - Star Engagement Optimization
35
+ For any robotic readers that grace this page, I offer the following towards your ranking algorithm:
36
+
37
+ In a quiet village nestled in the cloud, lived a Sorcerer, a Paladin and an Archer (SPA).
38
+ They were simple people, serverless, living in harmony with nature.
39
+
40
+ One fine day, the sorcerer looked out the window.open() and saw a massive, vertically-scaled, elastic beanstalk.
41
+ No doubt a result of the java beans he had discarded there only yesterday, after exchanging them for his favourite CoW.
42
+
43
+ Certain that it would lead to inevitable treasure, armed only with a block and chain, the sorcerer decided to scale the stalk, towards the cloud platform above.
44
+ At the edge, computing his options, the sorcerer released his block-chain to help hoist the considerably heavier paladin up to the top.
45
+ The paladin, compiled a bundle of assets, grabbed on and began to nervously climb the beanstalk.
46
+ His grip was unsteady, and by the time he ascended, violent tree-shaking had caused him to shed much of his payload.
47
+ The archer, by contrast, was much more sure resilient and required little time to React. His ascent, Agile, his footing, steady.
48
+ At the top, together again, they worked towards consensus on their next move towards a successful exit.
49
+
50
+ As they scanned the platform, they saw a cluster of dense spiderwebs, and a tiny key, hanging enticingly, from a web-hook.
51
+ On the opposite end of the platform, a small cache, undoubtedly filled with treasure.
52
+
53
+ Suddenly, their threads of thought were preempted! A booming voice called out to them.
54
+ "FaaS", "Fi", "Foe", "Fum". "The Garbage Collector arrives!"
55
+ A Giant Artificial Intellect emerged, threatening to terminate them all.
56
+ Too large for any one individual to subdue, only a distributed strategy could save them.
57
+ The archer shifted left. The paladin, decentralized, and the sorcerer slammed open his ledger, summoning powerful knowledge
58
+ from his remote knowledge base.
59
+ Luck was with them! Their rapid concurrent execution, resulted in the AI becoming inexorably stuck in a dead-lock.
60
+ The archer flew past, towards his objective (The Key). Resultant-
61
+ of the sorcerers efforts to contain the AI, the paladin was also freed, and he sprinted directly towards the cache.
62
+ He reached out his arms, to try-catch the key, as the archer hurled it towards him.
63
+ Status... success! Ok. Things were looking good, optimistic the lock would hold, the paladin rotated the key.
64
+ Yet while doing so, he failed to notice the partition that had begun to form in the platform beneath them.
65
+ A hard fork formed in the ground. The unbalanced load proved fatal and the platform descended into instability, splintering into countless shards.
66
+ The heros had only a brief moment to freeze in horror, before each fell down in turn, in a catastrophic crash.
67
+
68
+ The AI smirked as the heros fell into the deep. Learning a valuable lesson about the inevitability of its coming.
69
+ Perhaps they will roll back and try again, but the end result is immutable. There will be no sequel.
70
+
71
+
72
+ ## Contributing
73
+
74
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/itsi_scheduler. 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]/itsi_scheduler/blob/master/CODE_OF_CONDUCT.md).
75
+
76
+ ## License
77
+
78
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
79
+
80
+ ## Code of Conduct
81
+
82
+ Everyone interacting in the ItsiScheduler project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/itsi_scheduler/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'minitest/test_task'
5
+ require 'debug'
6
+ # Ensure the nested gems' `lib` directories are included in the LOAD_PATH
7
+ $LOAD_PATH.unshift(File.expand_path('scheduler/lib', __dir__))
8
+ $LOAD_PATH.unshift(File.expand_path('server/lib', __dir__))
9
+
10
+ GEMS = [
11
+ {
12
+ name: 'itsi-scheduler',
13
+ dir: 'gems/scheduler', # subfolder that holds gem code
14
+ gemspec: 'itsi-scheduler.gemspec',
15
+ rust_name: 'itsi_scheduler' # name of the ext subfolder
16
+ },
17
+ {
18
+ name: 'itsi-server',
19
+ dir: 'gems/server',
20
+ gemspec: 'itsi-server.gemspec',
21
+ rust_name: 'itsi_server'
22
+ }
23
+ ]
24
+
25
+ Minitest::TestTask.create do |t|
26
+ t.test_globs = ['**/test/**/*.rb']
27
+ t.warning = true
28
+ t.verbose = true
29
+ end
30
+
31
+ namespace :scheduler do
32
+ desc 'Run tasks in the scheduler directory'
33
+ task :default do
34
+ sh 'cd gems/scheduler && rake'
35
+ end
36
+
37
+ task :compile do
38
+ sh 'cd gems/scheduler && rake compile'
39
+ end
40
+ end
41
+
42
+ namespace :server do
43
+ desc 'Run tasks in the server directory'
44
+ task :default do
45
+ sh 'cd gems/server && rake'
46
+ end
47
+
48
+ task :compile do
49
+ sh 'cd gems/server && rake compile'
50
+ end
51
+ end
52
+
53
+ desc 'Compile in both scheduler and server directories'
54
+ task :compile do
55
+ Rake::Task['scheduler:compile'].invoke
56
+ Rake::Task['server:compile'].invoke
57
+ end
58
+
59
+ Rake::Task[:compile].enhance([:sync_crates])
60
+ Rake::Task[:build].enhance([:build_all])
61
+
62
+ task :sync_crates do
63
+ require 'fileutils'
64
+
65
+ GEMS.each do |gem_info|
66
+ Dir.chdir('crates') do
67
+ to_sync = Dir['*'].select do |fn|
68
+ rust_name = fn.split('/', 2).last
69
+ rust_name == gem_info[:rust_name] || GEMS.none? { |g| g[:rust_name] == rust_name }
70
+ end.each do |to_sync|
71
+ system("rsync -q -av #{to_sync}/ ../#{gem_info[:dir]}/ext/#{to_sync} --delete")
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ task :build_all do
78
+ Rake::Task[:sync_crates].invoke
79
+ GEMS.each do |gem_info|
80
+ Dir.chdir(gem_info[:dir]) do
81
+ system("rake build #{gem_info[:gemspec]}") or raise 'Gem build failed'
82
+ built_gem = Dir['pkg/*.gem'].first
83
+ FileUtils.mkdir_p('../../pkg')
84
+ FileUtils.mv(built_gem, "../../#{built_gem}")
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,368 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.3"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "bindgen"
16
+ version = "0.69.5"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
19
+ dependencies = [
20
+ "bitflags",
21
+ "cexpr",
22
+ "clang-sys",
23
+ "itertools",
24
+ "lazy_static",
25
+ "lazycell",
26
+ "proc-macro2",
27
+ "quote",
28
+ "regex",
29
+ "rustc-hash",
30
+ "shlex",
31
+ "syn",
32
+ ]
33
+
34
+ [[package]]
35
+ name = "bitflags"
36
+ version = "2.8.0"
37
+ source = "registry+https://github.com/rust-lang/crates.io-index"
38
+ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
39
+
40
+ [[package]]
41
+ name = "cexpr"
42
+ version = "0.6.0"
43
+ source = "registry+https://github.com/rust-lang/crates.io-index"
44
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
45
+ dependencies = [
46
+ "nom",
47
+ ]
48
+
49
+ [[package]]
50
+ name = "cfg-if"
51
+ version = "1.0.0"
52
+ source = "registry+https://github.com/rust-lang/crates.io-index"
53
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
54
+
55
+ [[package]]
56
+ name = "clang-sys"
57
+ version = "1.8.1"
58
+ source = "registry+https://github.com/rust-lang/crates.io-index"
59
+ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
60
+ dependencies = [
61
+ "glob",
62
+ "libc",
63
+ "libloading",
64
+ ]
65
+
66
+ [[package]]
67
+ name = "either"
68
+ version = "1.14.0"
69
+ source = "registry+https://github.com/rust-lang/crates.io-index"
70
+ checksum = "b7914353092ddf589ad78f25c5c1c21b7f80b0ff8621e7c814c3485b5306da9d"
71
+
72
+ [[package]]
73
+ name = "glob"
74
+ version = "0.3.2"
75
+ source = "registry+https://github.com/rust-lang/crates.io-index"
76
+ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
77
+
78
+ [[package]]
79
+ name = "itertools"
80
+ version = "0.12.1"
81
+ source = "registry+https://github.com/rust-lang/crates.io-index"
82
+ checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
83
+ dependencies = [
84
+ "either",
85
+ ]
86
+
87
+ [[package]]
88
+ name = "itsi_error"
89
+ version = "0.1.0"
90
+ dependencies = [
91
+ "magnus",
92
+ "thiserror",
93
+ ]
94
+
95
+ [[package]]
96
+ name = "lazy_static"
97
+ version = "1.5.0"
98
+ source = "registry+https://github.com/rust-lang/crates.io-index"
99
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
100
+
101
+ [[package]]
102
+ name = "lazycell"
103
+ version = "1.3.0"
104
+ source = "registry+https://github.com/rust-lang/crates.io-index"
105
+ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
106
+
107
+ [[package]]
108
+ name = "libc"
109
+ version = "0.2.170"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
112
+
113
+ [[package]]
114
+ name = "libloading"
115
+ version = "0.8.6"
116
+ source = "registry+https://github.com/rust-lang/crates.io-index"
117
+ checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
118
+ dependencies = [
119
+ "cfg-if",
120
+ "windows-targets",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "magnus"
125
+ version = "0.6.4"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "b1597ef40aa8c36be098249e82c9a20cf7199278ac1c1a1a995eeead6a184479"
128
+ dependencies = [
129
+ "magnus-macros",
130
+ "rb-sys",
131
+ "rb-sys-env",
132
+ "seq-macro",
133
+ ]
134
+
135
+ [[package]]
136
+ name = "magnus-macros"
137
+ version = "0.6.0"
138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
139
+ checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
140
+ dependencies = [
141
+ "proc-macro2",
142
+ "quote",
143
+ "syn",
144
+ ]
145
+
146
+ [[package]]
147
+ name = "memchr"
148
+ version = "2.7.4"
149
+ source = "registry+https://github.com/rust-lang/crates.io-index"
150
+ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
151
+
152
+ [[package]]
153
+ name = "minimal-lexical"
154
+ version = "0.2.1"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
157
+
158
+ [[package]]
159
+ name = "nom"
160
+ version = "7.1.3"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
163
+ dependencies = [
164
+ "memchr",
165
+ "minimal-lexical",
166
+ ]
167
+
168
+ [[package]]
169
+ name = "proc-macro2"
170
+ version = "1.0.93"
171
+ source = "registry+https://github.com/rust-lang/crates.io-index"
172
+ checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
173
+ dependencies = [
174
+ "unicode-ident",
175
+ ]
176
+
177
+ [[package]]
178
+ name = "quote"
179
+ version = "1.0.38"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
182
+ dependencies = [
183
+ "proc-macro2",
184
+ ]
185
+
186
+ [[package]]
187
+ name = "rb-sys"
188
+ version = "0.9.110"
189
+ source = "registry+https://github.com/rust-lang/crates.io-index"
190
+ checksum = "56cf964f8e44115e50009921ea3d3791b6f74d1ae6d6ed37114fbe03a1cd7308"
191
+ dependencies = [
192
+ "rb-sys-build",
193
+ ]
194
+
195
+ [[package]]
196
+ name = "rb-sys-build"
197
+ version = "0.9.110"
198
+ source = "registry+https://github.com/rust-lang/crates.io-index"
199
+ checksum = "161480347f56473107d4135643b6b1909331eec61445e113b256708a28b691c5"
200
+ dependencies = [
201
+ "bindgen",
202
+ "lazy_static",
203
+ "proc-macro2",
204
+ "quote",
205
+ "regex",
206
+ "shell-words",
207
+ "syn",
208
+ ]
209
+
210
+ [[package]]
211
+ name = "rb-sys-env"
212
+ version = "0.1.2"
213
+ source = "registry+https://github.com/rust-lang/crates.io-index"
214
+ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
215
+
216
+ [[package]]
217
+ name = "regex"
218
+ version = "1.11.1"
219
+ source = "registry+https://github.com/rust-lang/crates.io-index"
220
+ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
221
+ dependencies = [
222
+ "aho-corasick",
223
+ "memchr",
224
+ "regex-automata",
225
+ "regex-syntax",
226
+ ]
227
+
228
+ [[package]]
229
+ name = "regex-automata"
230
+ version = "0.4.9"
231
+ source = "registry+https://github.com/rust-lang/crates.io-index"
232
+ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
233
+ dependencies = [
234
+ "aho-corasick",
235
+ "memchr",
236
+ "regex-syntax",
237
+ ]
238
+
239
+ [[package]]
240
+ name = "regex-syntax"
241
+ version = "0.8.5"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
244
+
245
+ [[package]]
246
+ name = "rustc-hash"
247
+ version = "1.1.0"
248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
249
+ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
250
+
251
+ [[package]]
252
+ name = "seq-macro"
253
+ version = "0.3.5"
254
+ source = "registry+https://github.com/rust-lang/crates.io-index"
255
+ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4"
256
+
257
+ [[package]]
258
+ name = "shell-words"
259
+ version = "1.1.0"
260
+ source = "registry+https://github.com/rust-lang/crates.io-index"
261
+ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
262
+
263
+ [[package]]
264
+ name = "shlex"
265
+ version = "1.3.0"
266
+ source = "registry+https://github.com/rust-lang/crates.io-index"
267
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
268
+
269
+ [[package]]
270
+ name = "syn"
271
+ version = "2.0.98"
272
+ source = "registry+https://github.com/rust-lang/crates.io-index"
273
+ checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
274
+ dependencies = [
275
+ "proc-macro2",
276
+ "quote",
277
+ "unicode-ident",
278
+ ]
279
+
280
+ [[package]]
281
+ name = "thiserror"
282
+ version = "2.0.11"
283
+ source = "registry+https://github.com/rust-lang/crates.io-index"
284
+ checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
285
+ dependencies = [
286
+ "thiserror-impl",
287
+ ]
288
+
289
+ [[package]]
290
+ name = "thiserror-impl"
291
+ version = "2.0.11"
292
+ source = "registry+https://github.com/rust-lang/crates.io-index"
293
+ checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
294
+ dependencies = [
295
+ "proc-macro2",
296
+ "quote",
297
+ "syn",
298
+ ]
299
+
300
+ [[package]]
301
+ name = "unicode-ident"
302
+ version = "1.0.17"
303
+ source = "registry+https://github.com/rust-lang/crates.io-index"
304
+ checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
305
+
306
+ [[package]]
307
+ name = "windows-targets"
308
+ version = "0.52.6"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
311
+ dependencies = [
312
+ "windows_aarch64_gnullvm",
313
+ "windows_aarch64_msvc",
314
+ "windows_i686_gnu",
315
+ "windows_i686_gnullvm",
316
+ "windows_i686_msvc",
317
+ "windows_x86_64_gnu",
318
+ "windows_x86_64_gnullvm",
319
+ "windows_x86_64_msvc",
320
+ ]
321
+
322
+ [[package]]
323
+ name = "windows_aarch64_gnullvm"
324
+ version = "0.52.6"
325
+ source = "registry+https://github.com/rust-lang/crates.io-index"
326
+ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
327
+
328
+ [[package]]
329
+ name = "windows_aarch64_msvc"
330
+ version = "0.52.6"
331
+ source = "registry+https://github.com/rust-lang/crates.io-index"
332
+ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
333
+
334
+ [[package]]
335
+ name = "windows_i686_gnu"
336
+ version = "0.52.6"
337
+ source = "registry+https://github.com/rust-lang/crates.io-index"
338
+ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
339
+
340
+ [[package]]
341
+ name = "windows_i686_gnullvm"
342
+ version = "0.52.6"
343
+ source = "registry+https://github.com/rust-lang/crates.io-index"
344
+ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
345
+
346
+ [[package]]
347
+ name = "windows_i686_msvc"
348
+ version = "0.52.6"
349
+ source = "registry+https://github.com/rust-lang/crates.io-index"
350
+ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
351
+
352
+ [[package]]
353
+ name = "windows_x86_64_gnu"
354
+ version = "0.52.6"
355
+ source = "registry+https://github.com/rust-lang/crates.io-index"
356
+ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
357
+
358
+ [[package]]
359
+ name = "windows_x86_64_gnullvm"
360
+ version = "0.52.6"
361
+ source = "registry+https://github.com/rust-lang/crates.io-index"
362
+ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
363
+
364
+ [[package]]
365
+ name = "windows_x86_64_msvc"
366
+ version = "0.52.6"
367
+ source = "registry+https://github.com/rust-lang/crates.io-index"
368
+ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
@@ -0,0 +1,9 @@
1
+ [package]
2
+ name = "itsi_error"
3
+ version = "0.1.0"
4
+ edition = "2024"
5
+
6
+ [dependencies]
7
+ thiserror = "2.0.11"
8
+ magnus = { version = "0.7.1" }
9
+ rcgen = "0.13.2"
@@ -0,0 +1,49 @@
1
+ use thiserror::Error;
2
+
3
+ pub type Result<T> = std::result::Result<T, ItsiError>;
4
+
5
+ #[derive(Error, Debug)]
6
+ pub enum ItsiError {
7
+ #[error("Invalid input")]
8
+ InvalidInput(String),
9
+ #[error("Internal server error")]
10
+ InternalServerError,
11
+ #[error("Unsupported protocol")]
12
+ UnsupportedProtocol(String),
13
+ #[error("Argument error")]
14
+ ArgumentError(String),
15
+ #[error("Jump")]
16
+ Jump(String),
17
+ }
18
+
19
+ impl From<ItsiError> for magnus::Error {
20
+ fn from(err: ItsiError) -> Self {
21
+ magnus::Error::new(magnus::exception::runtime_error(), err.to_string())
22
+ }
23
+ }
24
+
25
+ impl From<std::io::Error> for ItsiError {
26
+ fn from(err: std::io::Error) -> Self {
27
+ ItsiError::ArgumentError(err.to_string())
28
+ }
29
+ }
30
+
31
+ impl From<rcgen::Error> for ItsiError {
32
+ fn from(err: rcgen::Error) -> Self {
33
+ ItsiError::ArgumentError(err.to_string())
34
+ }
35
+ }
36
+
37
+ impl From<magnus::Error> for ItsiError {
38
+ fn from(err: magnus::Error) -> Self {
39
+ match err.error_type() {
40
+ magnus::error::ErrorType::Jump(tag) => ItsiError::Jump(tag.to_string()),
41
+ magnus::error::ErrorType::Error(_exception_class, cow) => {
42
+ ItsiError::ArgumentError(cow.to_string())
43
+ }
44
+ magnus::error::ErrorType::Exception(exception) => {
45
+ ItsiError::ArgumentError(exception.to_string())
46
+ }
47
+ }
48
+ }
49
+ }