Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go言語で行うメール解析
Search
Kyo Sato
July 07, 2024
Technology
0
1.3k
Go言語で行うメール解析
OPTiM × every Golang Developer Night 2024/07/02
https://optim.connpass.com/event/321331/
Kyo Sato
July 07, 2024
Tweet
Share
More Decks by Kyo Sato
See All by Kyo Sato
Gopher Enablement Internship
keyl0ve
0
740
作って学ぶ GraphQL
keyl0ve
0
1.3k
Other Decks in Technology
See All in Technology
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
380
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
270
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
460
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
220
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
36
14k
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
170
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
220
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
370
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
260
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Designing for Performance
lara
604
68k
A Philosophy of Restraint
colly
203
16k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Faster Mobile Websites
deanohume
305
30k
Transcript
1 GoݴޠͰߦ͏ϝʔϧղੳ OPTiM × every Golang Developer Night 2024/07/02 גࣜձࣾΤϒϦʔ
͖ΐʔɻ
Copyright © 2015 every, Inc. All rights reserved. 2 ࣗݾհ
- ໊લ - ͖ΐʔɻ - ෦ॺ - ։ൃຊ෦ɺDELISH KITCHEN։ൃ෦ - ࠷ۙྑ͘ͳͬͨGoͷύοέʔδ - math/rand - Ωʔϫʔυ - ٶग़ - 3ͷ൧ͱຊञ - όΠΫ - Ϥʔϩούཱྀߦ - ίʔώʔ - Vtuber - ήʔϜ - Ξχϝ
Copyright © 2015 every, Inc. All rights reserved. 3 ຊͷ͓ॻ͖
- GoݴޠͰߦ͏ϝʔϧղੳ - ಋೖ - ϝʔϧϔομʔʹ͍ͭͯ - ࣮ࡍʹղੳͯ͠ΈΑ͏ - ͲͷΑ͏ͳ໘Ͱϝʔϧղੳ͍͔ͨ͠ - ·ͱΊ
Copyright © 2015 every, Inc. All rights reserved. 4 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Copyright © 2015 every, Inc. All rights reserved. 5 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Copyright © 2015 every, Inc. All rights reserved. 6
Copyright © 2015 every, Inc. All rights reserved. 7 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Telnet
Copyright © 2015 every, Inc. All rights reserved. 8 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Telnet - ϦϞʔτίϯϐϡʔλͱର͢ΔͨΊʹߏங͞ΕͨίϯϐϡʔλϓϩτίϧͷҰͭ - ଞͷϓϩτίϧͷྫ - SSH - SFTP - VNC
Copyright © 2015 every, Inc. All rights reserved. 9 $
docker run -d -p 8025:8025 -p 1025:1025 --name test_mailhog mailhog/mailhog Header - MAIL FROM: - RCPT TO: - SUBJECT: - FROM: - TO: Body - Hello, World! . Ͱғ͍ͬͯΔ෦ɿ͕ࣗೖྗͨ͠Օॴ
Copyright © 2015 every, Inc. All rights reserved. 10 $
docker run -d -p 8025:8025 -p 1025:1025 --name test_mailhog mailhog/mailhog
[email protected]
[email protected]
Copyright © 2015 every, Inc. All rights reserved. 11 $
docker run -d -p 8025:8025 -p 1025:1025 --name test_mailhog mailhog/mailhog Q. - ͳΓ͢·͠ରࡦͲ͏ͬͯΔͷʁ - ͲΜͳϝʔϧϔομʔ͕͋ͬͯɺͳΜͷͨΊʹΘΕ͍ͯΔͷʁ - GoͰϝʔϧΛղੳ͢ΔʹͲ͏͢Εྑ͍ʁ
12 ϝʔϧϔομʔʹ͍ͭͯ
Copyright © 2015 every, Inc. All rights reserved. 13 ͦͦϝʔϧϔομʔͱʁ
- ϝʔϧϔομͱɺϝʔϧͷৄࡉใ͕ॻ͔Ε͍ͯΔ෦ͷ͜ͱ - ϝʔϧ͕ૹ͞Εͨܦ࿏࣌ؒɺܦ༝ͨ͠αʔόʔͳͲ͕ه͞Ε͍ͯΔ - From: - ૹ৴ऀͷϝʔϧΞυϨε - To: - ड৴ऀͷϝʔϧΞυϨε - Subject: - ϝʔϧͷ໊݅ - Received: - ϝʔϧ͕ܦ༝ͨ͠αʔόʔͱͦͷ࣌ - Content-Type: - ϝʔϧͷຊจͷܗࣜʢྫɿtext/plain, text/htmlʣ - MIME-Version: - ϝʔϧ͕ MIMEن֨Λ༻͍ͯ͠Δ߹ͷόʔδϣϯ ϝʔϧϔομʔɺϝʔϧͷτϥϒϧγϡʔςΟϯάɺεύϜͷݕग़ɺηΩϡϦςΟੳͳͲʹ༻͞ΕΔ
Copyright © 2015 every, Inc. All rights reserved. 14
Copyright © 2015 every, Inc. All rights reserved. 15 -
RFC2822 Ͱنఆ͞Εͨϝʔϧϓϩ τίϧͰߏ͞Ε͍ͯΔ - ASCII ίʔυͰߏ͞ΕΔ͜ͱ - Ұߦ 78 จࣈҎԼ͕ਪ - Header ϑΟʔϧυɺϑΟʔϧυ ໊ͷޙʹίϩϯ(":")ɺϑΟʔϧυ ຊମ͕ଓ͖ɺCRLF Ͱऴྃ - Body ͕࢝·Δલۭߦʹ͢Δ
16 ࣮ࡍʹղੳͯ͠ΈΑ͏
Copyright © 2015 every, Inc. All rights reserved. 17 ࣮ࡍʹղੳͯ͠Έͨ
- net/mail - Go Packages - Goͷඪ४ύοέʔδͷҰͭ - ϝʔϧϝοηʔδͷղੳΛఏڙ͍ͯ͠Δ - جຊతͳ͍ํ
Copyright © 2015 every, Inc. All rights reserved. 18 ⚠
ݸਓใؚ͕·Ε͍ͯΔ෦ ɹফͯ͋͠Γ·͢
Copyright © 2015 every, Inc. All rights reserved. 19 Message.Header
Delivered-To: ϝʔϧ͕࠷ऴతʹ৴͞Εͨड৴ऀͷϝʔϧΞυϨε Received: ϝʔϧ͕ܦ༝֤ͨ͠αʔόʔʹΑͬͯՃ͞Εɺϝʔϧͷసૹܦ࿏ʢෳͷReceivedϔομʔ͕ଘࡏ͢Δ͜ͱ͕͋Δʣ ARC-Seal, ARC-Message-Signature, ARC-Authentication-Results: Authenticated Received Chain (ARC)ʹؔ࿈͢Δϔομʔʢϝʔϧ͕సૹ͞ΕΔաఔͰͷೝূ݁ՌΛอ࣋ʣ Return-Path: όϯεϝοηʔδʢ৴ෆೳ௨ʣ͕ૹΒΕΔࡍͷฦ৴ઌΞυϨε Received-SPF: Sender Policy Framework (SPF)ͷݕূ݁Ռʢϝʔϧ͕ਖ਼ͳૹ৴ݩ͔ΒૹΒΕ͔ͨͲ͏͔Λ֬ೝ͢Δʣ Authentication-Results: ϝʔϧ͕ೝূϓϩηεʢDKIMɺSPFɺDMARCͳͲʣΛ௨ա͔ͨ͠Ͳ͏͔ͷ݁Ռ DKIM-Signature: DomainKeys Identified Mail (DKIM)ͷॺ໊ʢϝʔϧͷ༰͕ૹ৴ऀʹΑͬͯॺ໊͞Εɺ్தͰվ͟Μ͞Ε͍ͯͳ͍͜ͱΛอূʣ X-Google-DKIM-Signature: Google͕Ճͨ͠DKIMॺ໊ʢGmail͕ϝʔϧΛॲཧͨ͜͠ͱΛࣔ͢ʣ X-Gm-Message-State: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷঢ়ଶʹؔ͢ΔใΛؚΉʣ X-Google-Smtp-Source: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷૹ৴ʹؔ͢ΔՃใΛؚΉʣ MIME-Version: MIME (Multipurpose Internet Mail Extensions)ͷόʔδϣϯʢϝʔϧ͕ςΩετҎ֎ͷίϯςϯπΛؚΉ͜ͱΛࣔ͢ʣ From: ϝʔϧͷૹ৴ऀͷ໊લͱϝʔϧΞυϨε Date: ϝʔϧ͕ૹ৴͞Εͨ࣌ Message-ID: ϝʔϧʹҰҙʹׂΓͯΒΕͨIDʢϝʔϧͷʹ༻͞ΕΔʣ Subject: ϝʔϧͷ໊݅ To: ϝʔϧͷѼઌΞυϨε Content-Type: ϝʔϧͷຊจఴϑΝΠϧͷܗࣜʢMIMEλΠϓʣ Content-Disposition: ఴϑΝΠϧͷදࣔํ๏ϑΝΠϧ໊ Content-Transfer-Encoding: ϝʔϧͷຊจఴϑΝΠϧ͕ͲͷΑ͏ʹΤϯίʔυ͞Ε͍ͯΔ͔ Content-ID: ఴϑΝΠϧʹؔ࿈͚ΒΕͨҰҙͷIDʢϝʔϧͰࢀর͢Δࡍʹ༻͞ΕΔʣ X-Attachment-Id: Gmail͕ఴϑΝΠϧʹׂΓͯͨIDʢϝʔϧͰͷఴϑΝΠϧͷࢀরʹ༻͞ΕΔʣ
Copyright © 2015 every, Inc. All rights reserved. 20 Message.Header
Delivered-To: ϝʔϧ͕࠷ऴతʹ৴͞Εͨड৴ऀͷϝʔϧΞυϨε Received: ϝʔϧ͕ܦ༝֤ͨ͠αʔόʔʹΑͬͯՃ͞Εɺϝʔϧͷసૹܦ࿏ʢෳͷReceivedϔομʔ͕ଘࡏ͢Δ͜ͱ͕͋Δʣ ARC-Seal, ARC-Message-Signature, ARC-Authentication-Results: Authenticated Received Chain (ARC)ʹؔ࿈͢Δϔομʔʢϝʔϧ͕సૹ͞ΕΔաఔͰͷೝূ݁ՌΛอ࣋ʣ Return-Path: όϯεϝοηʔδʢ৴ෆೳ௨ʣ͕ૹΒΕΔࡍͷฦ৴ઌΞυϨε Received-SPF: Sender Policy Framework (SPF)ͷݕূ݁Ռʢϝʔϧ͕ਖ਼ͳૹ৴ݩ͔ΒૹΒΕ͔ͨͲ͏͔Λ֬ೝ͢Δʣ Authentication-Results: ϝʔϧ͕ೝূϓϩηεʢDKIMɺSPFɺDMARCͳͲʣΛ௨ա͔ͨ͠Ͳ͏͔ͷ݁Ռ DKIM-Signature: DomainKeys Identified Mail (DKIM)ͷॺ໊ʢϝʔϧͷ༰͕ૹ৴ऀʹΑͬͯॺ໊͞Εɺ్தͰվ͟Μ͞Ε͍ͯͳ͍͜ͱΛอূʣ X-Google-DKIM-Signature: Google͕Ճͨ͠DKIMॺ໊ʢGmail͕ϝʔϧΛॲཧͨ͜͠ͱΛࣔ͢ʣ X-Gm-Message-State: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷঢ়ଶʹؔ͢ΔใΛؚΉʣ X-Google-Smtp-Source: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷૹ৴ʹؔ͢ΔՃใΛؚΉʣ MIME-Version: MIME (Multipurpose Internet Mail Extensions)ͷόʔδϣϯʢϝʔϧ͕ςΩετҎ֎ͷίϯςϯπΛؚΉ͜ͱΛࣔ͢ʣ From: ϝʔϧͷૹ৴ऀͷ໊લͱϝʔϧΞυϨε Date: ϝʔϧ͕ૹ৴͞Εͨ࣌ Message-ID: ϝʔϧʹҰҙʹׂΓͯΒΕͨIDʢϝʔϧͷʹ༻͞ΕΔʣ Subject: ϝʔϧͷ໊݅ To: ϝʔϧͷѼઌΞυϨε Content-Type: ϝʔϧͷຊจఴϑΝΠϧͷܗࣜʢMIMEλΠϓʣ Content-Disposition: ఴϑΝΠϧͷදࣔํ๏ϑΝΠϧ໊ Content-Transfer-Encoding: ϝʔϧͷຊจఴϑΝΠϧ͕ͲͷΑ͏ʹΤϯίʔυ͞Ε͍ͯΔ͔ Content-ID: ఴϑΝΠϧʹؔ࿈͚ΒΕͨҰҙͷIDʢϝʔϧͰࢀর͢Δࡍʹ༻͞ΕΔʣ X-Attachment-Id: Gmail͕ఴϑΝΠϧʹׂΓͯͨIDʢϝʔϧͰͷఴϑΝΠϧͷࢀরʹ༻͞ΕΔʣ ܦ༝ͨ͠αʔόʔɺIPΞυϨεͳͲ͔Β ෆ৹ͳαʔόʔ͔ΒૹΒΕ͍ͯͳ͍͔֬ೝͰ͖Δ ͳΓ͢·͠ରࡦ ͲͷΑ͏ͳίϯςϯπɺܗࣜͳͷ͔Θ͔Δ
Copyright © 2015 every, Inc. All rights reserved. 21
Copyright © 2015 every, Inc. All rights reserved. 22 Message.Body
Content-Type: multipart/mixed; boundary="000000000000367976061c1205d3" MIME Ϛϧνύʔτϝοηʔδ - ςΩετ htmlɺը૾ͳͲͦΕ ͧΕҟͳΔύʔτʹ͚ɺͦΕ ΒΛΈ߹Θͤߏ͞Εͨͷ - ෳͷϑΝΠϧΛిࢠϝʔϧʹ ఴ͢Δͱ͖ͳͲʹ༻͞ΕΔ
Copyright © 2015 every, Inc. All rights reserved. 23 Message.Body
Content-Type: multipart/mixed; boundary="000000000000367976061c1205d3" MIME Ϛϧνύʔτϝοηʔδ - ςΩετ htmlɺը૾ͳͲͦΕ ͧΕҟͳΔύʔτʹ͚ɺͦΕ ΒΛΈ߹Θͤߏ͞Εͨͷ - ෳͷϑΝΠϧΛిࢠϝʔϧʹ ఴ͢Δͱ͖ͳͲʹ༻͞ΕΔ
24 ͲͷΑ͏ͳ໘Ͱϝʔϧղੳ͍͔ͨ͠
Copyright © 2015 every, Inc. All rights reserved. 25 ྫ͑
- ސ٬αϙʔτͷࣗಈԽ - αϙʔτʹૹΒΕͯ͘ΔϝʔϧΛղੳɺ༰ʹج͍ͮͯαϙʔτνʔϜసૹ - https://tech.every.tv/entry/2024/06/06/192547 - Α͋͘Δ࣭ʹରͯࣗ͠ಈԠ AWSͰड͚औͬͨϝʔϧΛసૹ͢Δྫ→ - ϝʔϧαϚϦʔੜ - ͍ϝʔϧ͔ΒॏཁͳϙΠϯτ͚ͩΛநग़ https://aws.amazon.com/jp/blogs/messaging-and-targeting/forward-incoming-email-to-an-external-destination/
26 ·ͱΊ
Copyright © 2015 every, Inc. All rights reserved. 27 ·ͱΊ
- ීஈ͋·Γҙࣝͯ͜͠ͳ͔ͬͨϝʔϧͷ༰ɾߏʹ͍ͭͯΕͨྑ͍ػձʹͳͬ ͨʂ - ը૾ಈըͳͲͷఴϑΝΠϧ͕ͲͷΑ͏ʹૹΒΕ͍ͯΔͷֶ͔Μͩ - ͲͷΑ͏ʹͳΓ͢·͠ରࡦ͕ߦΘΕ͍ͯΔͷ͔Λϝʔϧϔομʔ͔ΒֶΜͩ͜ͱͰɺ ϝʔϧΛసૹฦ৴͢ΔࡍʹඞཁͳॲཧΛߟ͑Δ͖͔͚ͬʹͳͬͨ - GoΛ͍ͳ͕ΒखΛಈֶ͔ͯ͠Δͷָ͍͠ - ໘ന͔ͬͨษڧ༰ͳͲ͋Γ·ͨ͠Βڭ͍͑ͯͩ͘͞ʂ
None