rabbit-slide-unasuke-ruby-association-2022-grant-accomplishment-report 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d1e45907f943f90144fa6733ed6ca640cdca2248f5b8bedc3b40f87f89a9528d
4
+ data.tar.gz: b299b50dfd96ee9a7bf50688ad9878a49ac2eca01ff498aba7e29fe942b63b7c
5
+ SHA512:
6
+ metadata.gz: e4c6396b079a731647902ac86ca915f40539d398e8390553c8eb9bbd0e7152d4f53bea26a6f4d57afebae2f9cdd068029e007048d7d7813a894b633155030fcb
7
+ data.tar.gz: 7c612d15daff96e69797766220922b104f3fa006fd26c9697d2b8d29ac0a980a20d3ace9747440b72a66f90d48e23cfe45e061943af8deae2391d21d043f4428
data/.rabbit ADDED
@@ -0,0 +1,2 @@
1
+ --size 1920,1080
2
+ slide.md
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Ruby Association 2022 grant accomplishment report
2
+
3
+ https://www.ruby.or.jp/ja/news/20230710_2
4
+
5
+ ## 作者向け
6
+
7
+ ### 表示
8
+
9
+ rake
10
+
11
+ ### 公開
12
+
13
+ rake publish
14
+
15
+ ## 閲覧者向け
16
+
17
+ ### インストール
18
+
19
+ gem install rabbit-slide-unasuke-ruby-association-2022-grant-accomplishment-report
20
+
21
+ ### 表示
22
+
23
+ rabbit rabbit-slide-unasuke-ruby-association-2022-grant-accomplishment-report.gem
24
+
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require "rabbit/task/slide"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ spec = nil
6
+ Rabbit::Task::Slide.new do |task|
7
+ spec = task.spec
8
+ # spec.files += Dir.glob("doc/**/*.*")
9
+ # spec.files -= Dir.glob("private/**/*.*")
10
+ # spec.add_runtime_dependency("rabbit-theme-YOUR-THEME")
11
+ end
12
+
13
+ desc "Tag #{spec.version}"
14
+ task :tag do
15
+ sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
16
+ sh("git", "push", "--tags")
17
+ end
data/config.yaml ADDED
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: ruby-association-2022-grant-accomplishment-report
3
+ base_name: slide
4
+ tags: []
5
+ presentation_date:
6
+ presentation_start_time:
7
+ presentation_end_time:
8
+ version: 1.0.0
9
+ licenses: []
10
+ slideshare_id:
11
+ speaker_deck_id:
12
+ vimeo_id:
13
+ youtube_id:
14
+ width: 1920
15
+ height: 1080
16
+ source_code_uri: https://github.com/unasuke/ruby-association-2022-grant-accomplishment-report
17
+ author:
18
+ markup_language: :markdown
19
+ name: unasuke
20
+ email: yusuke1994525@gmail.com
21
+ rubygems_user: unasuke
22
+ slideshare_user:
23
+ speaker_deck_user:
Binary file
data/img/icon.jpg ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
data/slide.md ADDED
@@ -0,0 +1,216 @@
1
+ # RubyによるQUICプロトコルの\\n他言語からの移植ならびに\\n独自実装の作成
2
+
3
+ author
4
+ : unasuke (Yusuke Nakamura)
5
+
6
+ content-source
7
+ : Ruby Association Activity Report
8
+
9
+ date
10
+ : 2023-08-28
11
+
12
+ theme
13
+ : theme
14
+
15
+ # 自己紹介
16
+
17
+ * Name: unasuke (Yusuke Nakamura)
18
+ * Work: フリーランス
19
+ * Kaigi on Rails オーガナイザー (10/27-28 開催)
20
+ * {::tag name='x-small'}GitHub <https://github.com/unasuke>{:/tag}
21
+ * {::tag name='x-small'}ActivityPub <https://mstdn.unasuke.com/@unasuke>{:/tag}
22
+ * {::tag name='x-small'}X (Twitter) <https://twitter.com/yu_suke1994>{:/tag}
23
+ * {::tag name='x-small'}<https://unasuke.com>{:/tag}
24
+
25
+ ![](img/icon.jpg){:relative_width='24' align='right' relative_margin_right='-8' relative_margin_top='35'}
26
+
27
+
28
+ # RubyによるQUICプロトコルの他言語からの移植ならびに独自実装の作成
29
+
30
+ * 目的1: aioquicをRubyに移植する
31
+ * 目的2: 移植の知見からRubyishなQUIC実装を作成する
32
+
33
+ # QUICとは何か
34
+ * RFC 9000を含む複数のRFCによって標準化された通信プロトコル
35
+ * UDPの上にTCPのような信頼性のある通信を実現する
36
+ * TLSが組み込まれており、セキュアな通信がデフォルトとなっている
37
+
38
+ # QUICとは何か - Protocol Stack
39
+
40
+ ![](img/protocol-stack-h2-h3-improved-readability.png){:relative_width='45'}
41
+
42
+ {:.center}
43
+ {::tag name='x-small'}image from <https://github.com/rmarx/h3-protocol-stack>{:/tag}
44
+
45
+ # aioquicとは何か
46
+ * <https://github.com/aiortc/aioquic>
47
+ * PythonによるQUIC実装
48
+ * async/await構文を使用している
49
+
50
+ # 既存実装
51
+ * <https://github.com/quicwg/base-drafts/wiki/Implementations>
52
+ * IETF QUIC WG wikiにおけるQUICの実装一覧
53
+ * C, C++, Go, Rust, Haskell, Python, Java等
54
+ * no Ruby
55
+
56
+ # 移植の動機
57
+ * QUICのRuby実装が存在しない
58
+ * Ractorの大規模採用例があるとよいのではないか
59
+
60
+ # そもそも移植は可能なのか
61
+
62
+ ![](img/aioquic-loc.png){:relative_width="95"}
63
+
64
+ {:.center}
65
+ aioquicの実装言語比率
66
+
67
+ # aioquicの依存関係
68
+ * <https://pypi.org/project/certifi/> 証明書を提供する
69
+ * <https://pypi.org/project/pyOpenSSL/> OpenSSL
70
+ * <https://pypi.org/project/cryptography/>
71
+ * <https://pypi.org/project/pylsqpack/> QPACK
72
+ * <https://github.com/litespeedtech/ls-qpack/>
73
+
74
+ # aioquicの構造
75
+
76
+ ```
77
+ $ tree src
78
+ src
79
+ ├── aioquic
80
+ │ ├── about.py
81
+ │ ├── asyncio
82
+ │ │ ├── client.py
83
+ │ │ ├── __init__.py
84
+ │ │ ├── protocol.py
85
+ │ │ └── server.py
86
+ │ ├── _buffer.c
87
+ │ ├── buffer.py
88
+ │ ├── _crypto.c
89
+ │ ├── _crypto.pyi
90
+ │ ├── quic
91
+ │ │ ├── configuration.py
92
+ │ │ ├── connection.py
93
+ │ │ ├── crypto.py
94
+ │ │ ├── events.py
95
+ │ │ ├── __init__.py
96
+ │ │ ├── logger.py
97
+ │ │ ├── packet_builder.py
98
+ │ │ ├── packet.py
99
+ │ │ ├── rangeset.py
100
+ │ │ ├── recovery.py
101
+ │ │ ├── retry.py
102
+ │ │ └── stream.py
103
+ │ └── tls.py
104
+ ...
105
+ ```
106
+
107
+ # buffer.c, buffer.pyi
108
+ * C言語によるBuffer領域の実装をPython Objectにしたもの
109
+ * mallocした領域に対する操作をPythonから行える
110
+ * → StringIOをwrapするClassを作成して移植
111
+
112
+
113
+ # packet.py, packet_builder.py
114
+ * Packetそのものを表現したり構築するclass群
115
+ * → ほぼそのままClass及びStructに移植
116
+
117
+ # crypto.py, _crypto.c, _crypto.pyi
118
+ * QUICのPacketそのものを暗号化するclass群
119
+ * OpenSSLのAPIを利用するC実装も含む
120
+ * openssl gem側でのAPIを調査してPure Rubyに移植
121
+
122
+ # tls.py
123
+ * TLS 1.3の(ほぼ)Pure Python実装
124
+ * 鬼門(1800行)
125
+ * →ほぼそのまま移植した
126
+
127
+ # OpenSSL APIの差異
128
+ * PythonとRubyでOpenSSL APIをどのように抽象化するかが異なる
129
+ * Python側はほぼCと1対1
130
+ * Ruby側は扱いやすいように抽象化されている
131
+
132
+ # OpenSSL APIの差異 Python側
133
+
134
+ ![](img/key_exchange_python.png){:relative_width='95'}
135
+
136
+ # OpenSSL APIの差異 Ruby側
137
+
138
+ ![](img/key_exchange_ruby.png){:relative_width='95'}
139
+
140
+ # connection.py
141
+ * QUICのどのPacketを実際に取り扱う通信部分
142
+ * 鬼門(3200行)
143
+ * →ほぼそのまま移植した(テストケース未完走)
144
+
145
+ # 最終報告時点の成果
146
+
147
+ ![](img/raioquic-loc.png){:relative_width='95'}
148
+
149
+
150
+ # 最終報告時点の成果
151
+ * <https://github.com/unasuke/raioquic>
152
+ * 11000行
153
+ * aioquic, quic-goとの簡単な通信ができることを確認
154
+
155
+ # やらなかったこと
156
+ * connection.rbのテストケース完走
157
+ * 実際にリクエストを受け付ける部分の移植
158
+ * asyncioを使用している部分
159
+ * Rubyishな実装の作成
160
+
161
+ # 得られた知見
162
+ * PythonとRubyの言語の差
163
+ * QUIC及びTLS 1.3に対する理解
164
+
165
+ # その後の活動
166
+ * RubyKaigi 2023登壇
167
+ * <https://rubykaigi.org/2023/presentations/yu_suke1994.html>
168
+ * IETF Meetingに参加
169
+ * 116 Yokohama
170
+ * 117 San Francisco (remote)
171
+ * Rubyishな実装の作成
172
+ * RubyKaigi 2023 follow up
173
+
174
+ # Rubyishな実装の作成
175
+ * APIをRubyishにする
176
+ * Documentationをしっかりやる
177
+ * `IO::Buffer` を使用してみる
178
+
179
+ # Documentationをしっかりやる (HKDF)
180
+
181
+ ![](img/raiha-yard.png){:relative_width="75"}
182
+
183
+ # `IO::Buffer` を使用してみる
184
+
185
+ ```ruby
186
+ # Apply packet protection
187
+ # @see https://www.rfc-editor.org/rfc/rfc9001.html#section-5.4
188
+ def apply(plain_header, protected_payload)
189
+ packet_number_length = (plain_header.get_value(:U8, 0) & 0x03) + 1
190
+ packet_number_offset = plain_header.size - packet_number_length
191
+ @mask = mask(
192
+ protected_payload.slice(PACKET_NUMBER_LENGTH_MAX - packet_number_length).slice(0, SAMPLE_LENGTH)
193
+ )
194
+
195
+ buffer = IO::Buffer.for(plain_header.get_string + protected_payload.get_string).dup # make mutable
196
+ if buffer.get_value(:U8, 0) & 0x80 != 0
197
+ buffer.copy(buffer.slice(0, 1).xor!(IO::Buffer.for((@mask[0].unpack1("C*") & 0x0f).chr)))
198
+ else
199
+ buffer.set_value(:U8, 0, buffer.slice(0, 1).xor!(IO::Buffer.for((@mask[0].unpack1("C*") & 0x1f)).chr))
200
+ end
201
+ buffer.copy(
202
+ buffer.slice(
203
+ packet_number_offset, packet_number_length).xor!(IO::Buffer.for(@mask[1..packet_number_length])
204
+ ),
205
+ packet_number_offset
206
+ )
207
+ buffer
208
+ end
209
+ ```
210
+
211
+ # まとめ
212
+ * 引き続きRubyishなQUIC実装の開発を進めていく
213
+ * IETF Meetingに参加して最新動向を追っていく
214
+ * 謝辞
215
+ * Ruby Association様
216
+ * 笹田耕一様(メンター)
data/theme.rb ADDED
@@ -0,0 +1,113 @@
1
+ @default_foreground ||= @foreground
2
+ @default_background ||= @background
3
+ @default_shadow_color ||= @shadow_color
4
+
5
+ # pp font_families
6
+ font_color = '#333'
7
+ @default_font = 'BIZ UDPGothic'
8
+ @font_family = find_font_family(@default_font)
9
+ @bold_font = @default_font
10
+ @bold_font_family = find_font_family(@bold_font)
11
+ @monospace_font = 'Cica'
12
+ @monospace_font_family = find_font_family(@monospace_font)
13
+
14
+ @xxxx_large_font_size = screen_size(10 * Pango::SCALE)
15
+ @xxx_large_font_size = screen_size(8 * Pango::SCALE)
16
+ @xx_large_font_size = screen_size(6 * Pango::SCALE)
17
+ @x_large_font_size = screen_size(4.5 * Pango::SCALE)
18
+ @large_font_size = screen_size(4 * Pango::SCALE)
19
+ @normal_font_size = screen_size(3.5 * Pango::SCALE)
20
+ @small_font_size = screen_size(3.2 * Pango::SCALE)
21
+ @x_small_font_size = screen_size(3 * Pango::SCALE)
22
+ @xx_small_font_size = screen_size(2.8 * Pango::SCALE)
23
+ @xxx_small_font_size = screen_size(2.5 * Pango::SCALE)
24
+ @script_font_size = @x_small_font_size
25
+ @large_script_font_size = @small_font_size
26
+ @x_large_script_font_size = @large_font_size
27
+ @title_slide_title_font_size = @xxx_large_font_size
28
+
29
+ @block_quote_fill_color = "#f8f8f8"
30
+ @preformatted_fill_color = "#f8f8f8"
31
+ @default_headline_line_color = font_color
32
+
33
+ # @title_slide_background_image = 'img/title_bg.png'
34
+ # @slide_background_image = 'img/bg.png'
35
+
36
+ # set_foreground(@default_foreground)
37
+ # set_background(@default_background)
38
+
39
+ add_image_path("ruby-images")
40
+ include_theme("default-icon")
41
+ # include_theme("default-title-text")
42
+ include_theme("default-text")
43
+ include_theme("default-title-slide")
44
+ include_theme("default-slide")
45
+ include_theme("default-item-mark")
46
+ include_theme("default-method-list")
47
+ include_theme("default-preformatted")
48
+ include_theme("default-block-quote")
49
+ include_theme("default-foot-text")
50
+ include_theme("default-description")
51
+ include_theme("image")
52
+ include_theme("table")
53
+ include_theme("newline-in-slides")
54
+ include_theme("per-slide-background-color")
55
+ include_theme("background-image-toolkit")
56
+ include_theme("per-slide-background-image")
57
+ include_theme("body-background-image")
58
+ include_theme("tag")
59
+ include_theme("syntax-highlighting")
60
+ include_theme("default-comment")
61
+
62
+ include_theme("title-slide-background-image")
63
+ include_theme("slide-background-image")
64
+
65
+ match(TitleSlide, "*") do |elems|
66
+ elems.horizontal_centering = true
67
+ elems.prop_set("size", @large_font_size)
68
+ set_font_family(elems)
69
+ end
70
+
71
+ match(TitleSlide, Title) do |titles|
72
+ titles.prop_set("size", @title_slide_title_font_size)
73
+ titles.padding_bottom = @space * 2
74
+ titles.prop_set("weight", "SemiBold")
75
+ end
76
+
77
+ match(Slide, HeadLine) do |heads|
78
+ heads.prop_set("size", @large_font_size)
79
+ heads.prop_set("weight", "bold")
80
+ end
81
+
82
+ match(TitleSlide) do |slides|
83
+ # slides.margin_left = 900
84
+ slides.vertical_centering = true
85
+ slides.prop_set "foreground", font_color
86
+ slides.prop_set("weight", "bold")
87
+ end
88
+ match(TitleSlide, Subtitle) do |subtitle|
89
+ subtitle.margin_top = -20
90
+ subtitle.prop_set("size", @large_font_size)
91
+ end
92
+ match(TitleSlide, Author) do |author|
93
+ author.margin_top = 50
94
+ author.prop_set("size", @large_font_size)
95
+ author.prop_set("weight", "normal")
96
+ end
97
+ match(TitleSlide, Place) do |place|
98
+ place.prop_set("size", @small_font_size)
99
+ end
100
+ match(TitleSlide, "*") do |elems|
101
+ elems.horizontal_centering = true
102
+ end
103
+
104
+ match(TitleSlide, Date) do |dates|
105
+ dates.prop_set("size", @small_font_size)
106
+ # dates.prop_set("style", "italic")
107
+ end
108
+
109
+ match(TitleSlide, ContentSource) do |sources|
110
+ sources.prop_set("size", @small_font_size)
111
+ sources.margin_bottom = @space
112
+ # sources.prop_set("style", "italic")
113
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-unasuke-ruby-association-2022-grant-accomplishment-report
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - unasuke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-08-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabbit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ description: https://www.ruby.or.jp/ja/news/20230710_2
28
+ email:
29
+ - yusuke1994525@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rabbit"
35
+ - README.md
36
+ - Rakefile
37
+ - config.yaml
38
+ - img/aioquic-loc.png
39
+ - img/icon.jpg
40
+ - img/key_exchange_python.png
41
+ - img/key_exchange_ruby.png
42
+ - img/protocol-stack-h2-h3-improved-readability.png
43
+ - img/raiha-yard.png
44
+ - img/raioquic-loc.png
45
+ - pdf/ruby-association-2022-grant-accomplishment-report-slide.pdf
46
+ - slide.md
47
+ - theme.rb
48
+ homepage: https://slide.rabbit-shocker.org/authors/unasuke/ruby-association-2022-grant-accomplishment-report/
49
+ licenses: []
50
+ metadata:
51
+ source_code_uri: https://github.com/unasuke/ruby-association-2022-grant-accomplishment-report
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.4.6
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Ruby Association 2022 grant accomplishment report
71
+ test_files: []