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
職能を超えたモブプログラミングが品質に与えた良い影響
tonionagauzzi
2
310
知らない景色を見に行こう チャンスを掴んだら道が開けたマネジメントの旅 / Into the unknown~My management journey~
kakehashi
10
1.2k
ABEMA スマートテレビアプリケーションのパフォーマンス改善 〜業界トップクラスを目指して〜 / Performance Improvements on ABEMA Smart TV App
nodaguti
0
220
OpsJAWS32 re:Invent 2024 Ops系アップデートまとめ
takahirohori
0
110
Autonomous Database サービス・アップデート (FY25)
oracle4engineer
PRO
0
280
A/Aテストにおけるサンプルサイズ/japanr2024
nikkei_engineer_recruiting
1
630
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
140
JAWS-UG 横浜支部 #76 AWS re:Invent 2024 宇宙一早い Recap LT3Amazon EKS Auto Modeと遊び(パーティ)の話
tjotjo
0
170
PostgreSQL Conference Japan 2024 A4 Comparison of column-oriented access methods
nori_shinoda
0
160
アップデート紹介:AWS Data Transfer Terminal
stknohg
PRO
0
100
うまくいく! を実現するための質問力 / It works! The Power of Questions to Make It Happen
bitkey
PRO
1
140
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
0
15k
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Optimizing for Happiness
mojombo
376
70k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Scaling GitHub
holman
458
140k
Music & Morning Musume
bryan
46
6.2k
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