ã¯ããã«
2017幎ã agar.ioã®ãããªäººæ°ã®ããWebã²ãŒã ã®ã»ãšãã©ã¯ãTCPã§WebSocketã䜿çšããŠããŒã¿ã転éããŸãã ãã©ãŠã¶ã«WebSocketã®UDPã¢ããã°ãçµã¿èŸŒãŸããŠããå Žåããããã®ã²ãŒã ã®ãããã¯ãŒã¯ã§ã®äœæ¥ãå€§å¹ ã«æ¹åãããŸãã
å ¥éæ å ±
Webãã©ãŠã¶ãŒã®åäœã¯ã HTTPãããã³ã« ïŒã¹ããŒãã¬ã¹èŠæ±ããã³å¿çãããã³ã«ïŒã«åºã¥ããŠããŸã ã ããšããšéçãªWebããŒãžãæäŸããããã«èšèšãããŸããã HTTPã¯ãä¿¡é Œæ§ã®é«ãé ä¿¡ãšã€ã³ã¿ãŒãããçµç±ã§éä¿¡ãããããŒã¿ã®æ£ããé åºãä¿èšŒããäœã¬ãã«ã®ãããã³ã«ã§ããTCPã®äžã§å®è¡ãããŸãã
ãããã¯ãã¹ãŠé·å¹Žã«ããã£ãŠããŸãæ©èœããŠããŸããããæè¿ã§ã¯Webãµã€ããããã€ã³ã¿ã©ã¯ãã£ãã«ãªããHTTPèŠæ±/å¿çãã©ãã€ã ãžã®å¿çãåæ¢ããŸããã ãã®åé¡ã解決ããããã«ãWebSocketãWebRTCãHTTP 2.0ãQUICãªã©ã®ææ°ã®Webãããã³ã«ãçºæãããŸããããããã¯ããããã¯ãŒã¯ã®å¯Ÿè©±æ§ãå€§å¹ ã«æ¹åããå¯èœæ§ããããŸãã
æ®å¿µãªãããæ°ããäžé£ã®Webéçºæšæºã¯ããã«ããã¬ã€ã€ãŒã²ãŒã ã®ããŒãºãæºãããŠããªãããå®è£ ããã«ã¯è€éãããŸãã
ãã©ãŠã¶ãä»ããŠUDPãã±ãããéåä¿¡ãããã ããªã®ã§ãããã¯ã²ãŒã éçºè ã«ãšã£ãŠã¯æ®å¿µã§ãã
åé¡
Webã¯ããã±ããä¿åãããã³ã«ã§ããTCPã®äžã«æ§ç¯ãããŠããŸãã ãã±ããæ倱ã®ç¶æ³ã§æ£ããé åºã§ä¿¡é Œæ§ã®é«ãããŒã¿é ä¿¡ãè¡ãã«ã¯ãTCPã¯ææ°ã®ããŒã¿ããã¥ãŒã«ä¿åãã倱ããããã±ããã®åéä¿¡ãåŸ æ©ããå¿ èŠããããŸãã ããã§ãªãå ŽåãããŒã¿ã¯ééã£ãé åºã§é ä¿¡ãããŸãã
ãã®ååã¯ããã¥ãŒã®éå§ããããã¯ãããšåŒã°ããŸã ã ããã¯è¿·æãªéçºè ãšã»ãšãã©æ²åçãªç¶æ³ãäœãåºããŸãã 圌ããå¿ èŠãšããææ°ã®ããŒã¿ã¯ãå€ãããŒã¿ã®åéä¿¡ãåŸ ã£ãŠããŸããã転éãããããŒã¿ã®åä¿¡æã«ã¯ããããã¯ãã§ã«å€ããªã£ãŠããŠäœ¿ãç©ã«ãªããŸããã
æ®å¿µãªããããã®ããã»ã¹ã¯TCPã®ãã¬ãŒã ã¯ãŒã¯å ã§ä¿®æ£ããããšã¯ã§ããŸããããã¹ãŠã®ããŒã¿ã確å®ã«æ£ããé åºã§åä¿¡ããå¿ èŠããããŸãã ãããã£ãŠãéå»20幎éã®ã²ãŒã æ¥çã®æšæºãœãªã¥ãŒã·ã§ã³ã¯ãUDPãä»ããããŒã¿è»¢éã§ãã
å®éã«ã¯ãããã¯åã²ãŒã ãUDPãä»ããŠç¬èªã®ãããã³ã«ãéçºããå¿ èŠãªæ©èœããã¹ãŠå®è£ ããé åºãç¶æããã«ã»ãšãã©ã®ããŒã¿ãä¿¡é Œã§ããªãæ¹æ³ã§éä¿¡ããããšãæå³ããŸããã ããã«ããã倱ããããã±ããã®åéä¿¡ãåŸ ããã«ãå¯èœãªéãé«éã§äžæããŒã¿ãé ä¿¡ã§ããŸãã
ããããWebã²ãŒã ã®å Žåã¯äœãããå¿ èŠããããŸããïŒ
ä»æ¥ã®Webã²ãŒã ã®äž»ãªåé¡ã¯ãã²ãŒã éçºè ãã²ãŒã æ¥çãéžæãããã©ãŠã¶ã§æé©ãªãœãªã¥ãŒã·ã§ã³ã䜿çšã§ããªãããšã§ãã 代ããã«ãWebã²ãŒã ã¯TCPãä»ããŠã²ãŒã ããŒã¿ãéä¿¡ãããããå¿çæ§ãäœäžããŸãã
TCPã®äœ¿çšã¯å®å šã«ãªãã·ã§ã³ã§ãããWebã²ãŒã ã«UDPãã±ãããéåä¿¡ããæ©äŒãããã°ããæã§ã¯ãªãã¯ããã ããã§ãã®åé¡ã解決ã§ããŸãã
WebSocketãšã¯äœã§ããïŒ
WebSocketsã¯ãHTTPãããã³ã«ãæ¡åŒµãããã®ã§ãHTTPæ¥ç¶ãå€æŽããŠãããŒã¿ãåæ¹åã«è»¢éã§ããããã«ããŸãã ãã®å Žåãæšæºã®èŠæ±/å¿çãã¿ãŒã³ã¯äœ¿çšãããŸããã
ãã®ææ³ã«ãããåçã«å€åããã³ã³ãã³ãã衚瀺ããå¿ èŠãããWebãµã€ãã®åé¡ããšã¬ã¬ã³ãã«è§£æ±ºã§ããŸããããã¯ãWebãœã±ããæ¥ç¶ã確ç«ãããåŸããµãŒããŒã察å¿ãããªã¯ãšã¹ããªãã§ãã©ãŠã¶ãŒã«ããŒã¿ãéä¿¡ã§ããããã§ãã
æ®å¿µãªãããWebSocketã¯TCPã®äžã«å®è£ ãããŠãããããããŒã¿ã¯äŸç¶ãšããŠãã¥ãŒã®éå§ããããã¯ããåŸåããããŸãã
QUICãšã¯äœã§ããïŒ
QUICã¯UDPäžã«æ§ç¯ãããå®éšãããã³ã«ã§ãããHTTPã®ä»£æ¿ãã©ã³ã¹ããŒãã¬ã€ã€ãŒãšããŠéçºãããŸããã çŸåšãGoogle Chromeã§ã®ã¿ãµããŒããããŠããŸãã
QUICã®æãéèŠãªæ©èœã¯ãè€æ°ã®ããŒã¿ã¹ããªãŒã ã®ãµããŒãã§ãã ã¯ã©ã€ã¢ã³ããŸãã¯ãµãŒããŒã¯ããã£ãã«IDãå¢ããããšã§æé»çã«æ°ãããã£ãã«ãäœæã§ããŸãã
ãã£ãã«ã®æŠå¿µã«ã¯ã2ã€ã®å€§ããªå©ç¹ããããŸãã
- æ°ããèŠæ±ãäœæããããã³ã«æ¥ç¶ã®ç¢ºèªèŠæ±ãéä¿¡ããããšãé¿ããŸãã
- ç¡é¢ä¿ãªããŒã¿ã¹ããªãŒã éã®ãã¥ãŒã®å é ã®ãããã¯ãæé€ããŸãã
æ®å¿µãªãããåã ã®ã¹ã¬ããã®ãã¥ãŒã®å é ããããã¯ããåé¡ãæé€ããŠããŸãããåã¹ã¬ããå ã«ã¯äŸç¶ãšããŠååšããŠããŸãã
WebRTCãšã¯äœã§ããïŒ
WebRTCã¯ãã¹ããªãŒãã³ã°ãªãŒãã£ãªããããªãªã©ã®ã¢ããªã±ãŒã·ã§ã³ã®ãã©ãŠã¶éã§ãã¢ããŒãã¢æ¥ç¶ãæäŸãããããã³ã«ã®ã»ããã§ãã
WebRTCã¯ããä¿¡é Œæ§ã®äœããã¢ãŒãã«èšå®ã§ããããŒã¿ãã£ãã«ããµããŒãããŠãããããé åºãç¶æããã«ãã©ãŠã¶ãä»ããä¿¡é Œæ§ã®äœãããŒã¿éä¿¡ãå¯èœã§ãã
ã§ã¯ããªãWebSocketsã¯çŸä»£ã®2017ãã©ãŠã¶ãŒã²ãŒã ã§ãŸã 䜿çšãããŠããã®ã§ããããïŒ
ãã®çç±ã¯ããã«ããã¬ã€ã€ãŒã²ãŒã ã§ã¯ããã¢ããŒãã¢è»¢éããã¯ã©ã€ã¢ã³ããµãŒããŒã¢ãã«ã«ç§»è¡ããåŸåãããããã§ãã WebRTCã䜿çšãããšãä¿¡é Œæ§ã®ãªããäžå®å®ãªãããŒã¿ããã©ãŠã¶ãããã©ãŠã¶ã«ç°¡åã«éä¿¡ã§ããŸããããã©ãŠã¶ãšå°çšãµãŒããŒéã®ããŒã¿è»¢éãå¿ èŠã«ãªããšã¯ã©ãã·ã¥ããŸãã
ãã®åé¡ã¯ã WebRTCã®æ¥µç«¯ãªè€éãã«ãããã®ã§ãã ãã®è€éãã®çç±ã¯ç解ã§ããïŒWebRTCã¯äž»ã«ãã©ãŠã¶ãŒéã®ãã¢ããŒãã¢ããŒã¿äº€æã®ããã«èšèšããããããææªã®å Žåã®ã·ããªãªã§ã¯ãNATããã€ãã¹ããŠãã±ãããéä¿¡ããããã«STUNãICEãããã³TURNã®ãµããŒããå¿ èŠã§ãã
ããããã²ãŒã éçºè ã®èŠ³ç¹ããèŠããšããããªãã¯IPã¢ãã¬ã¹ãæã€å°çšãµãŒããŒãšããŒã¿ã亀æããããã«STUNãICEãããã³TURNã¯çµ¶å¯Ÿã«å¿ èŠãªãããããã®è€éãã¯ãã¹ãŠåœŒãã«ãšã£ãŠéè·ã§ãã
ãWebSocketã®UDPããŒãžã§ã³ãå¿ èŠã ãšæããŸããã ãããç§ãã¡ã倢èŠãŠããå¯äžã®ããšã§ãããèŠããã«ãã²ãŒã éçºè ã¯ã·ã³ãã«ãã倧奜ãã§ãããWebSockets for UDPãœãªã¥ãŒã·ã§ã³ã¯WebRTCã®è€éããããã¯ããã«é åçã§ãã
agar.ioã®äœæè ã§ããMatheus Valadares
UDPã®éä¿¡ãèš±å¯ããªãã®ã¯ãªãã§ããïŒ
ãã®åé¡ã®æçµçãªè§£æ±ºçã¯ããŠãŒã¶ãŒããã©ãŠã¶ãŒãä»ããŠUDPãã±ãããçŽæ¥éåä¿¡ã§ããããã«ããããšã§ãã ãã¡ãããããã¯çµ¶å¯Ÿã«æãããèãã§ãããããã決ããŠèš±ãããã¹ãã§ã¯ãªããšããååãªçç±ããããŸãã
- Webãµã€ãã¯ããã©ãŠã¶ããã®UDPãã±ããã®å€§éé ä¿¡ã調æŽããããšã«ãããDDoSæ»æãéå§ããå¯èœæ§ããããŸãã
- WebããŒãžã§å®è¡ãããŠããJavaScriptãæªæã®ããUDPãã±ãããäœæããŠäŒæ¥ãããã¯ãŒã¯ã®å éšã·ã¹ãã ããããŒãããHTTPSãä»ããŠã¬ããŒããéä¿¡ããå¯èœæ§ããããããæ°ããã»ãã¥ãªãã£ããŒã«ãååšããŸãã
- UDPãã±ããã¯æå·åãããŠããªããããæ»æè ããããã®ãã±ããã§éä¿¡ããããã¹ãŠã®ããŒã¿ã®ã¹ãããã£ã³ã°ãšèªã¿åããæŽçããããéä¿¡äžã«ããŒã¿ãå€æŽãããããããšã¯éåžžã«ç°¡åã§ãã ãã©ãŠã¶ãŒãæå·åãããŠããªããã±ãããéä¿¡ã§ããããã«ããããšã¯ããããã¯ãŒã¯ã»ãã¥ãªãã£ã®å€§ããªåŸéã§ãã
- UDPã«ã¯èªèšŒããããŸããããã®ããããã©ãŠã¶ããéä¿¡ããããã±ãããèªã¿åãå°çšãµãŒããŒã¯ãããã«æ¥ç¶ãããŠãŒã¶ãŒã®æå¹æ§ã®ç¬èªã®æ¹æ³ã䜿çšããå¿ èŠããããŸãã ãã®ãããªäººä»¶è²»ã¯ãã²ãŒã éçºè ããã®åé¡ã®è§£æ±ºã«åãã§æè³ããåªåãããã¯ããã«é«ããªããŸãã
ãã®ãããJavaScriptããã©ãŠã¶ã§UDPãã±ãããäœæããã¹ãã§ã¯ãªãããšã¯éåžžã«æ確ã§ãã
解決çã¯äœã§ããïŒ
ããããããäžæ¹ã®ç«¯ããæ¥ãå Žåã¯ã©ããªããŸããïŒ Webã®äžçããã²ãŒã ãžã®æ¶ãæ©ãäœã代ããã«ãã²ãŒã ã«å¿ èŠãªæè¡ããå§ããŠãããããWebäžã§ããŸãæ©èœãããœãªã¥ãŒã·ã§ã³ã«æ¹è¯ããããšãã§ããŸãã
ç§ã®ååã¯ã°ã¬ã³ãã£ãŒãã©ãŒã§ã ãç§ã¯éå»15幎éã²ãŒã ãéçºããŠããŸãã ãã®æéã®ã»ãšãã©ã¯ããããã¯ãŒã¯ããã°ã©ãã³ã°ãå°éãšããŠããŸããã ç§ã¯ãã€ãããã¯ã¢ã¯ã·ã§ã³ã²ãŒã ã§ã®çŽ æŽãããçµéšãç©ãã§ããŸãã ç§ãåãçµãã æåŸã®ã²ãŒã ã¯Titanfall 2ã§ããã
çŽ1ãæéãHacker NewsïŒ WebRTCïŒthe future of web gamesã§ãã®èšäºãèªã¿ãŸããã
ãã®äžã§ã agar.ioã®äœæè ã§ããMateus Valadaresã¯ã WebRTCã¯åœŒã«ãšã£ãŠè€éããããšèšãã圌ã¯ã²ãŒã ã§WebSocketã䜿ãç¶ããŠããŸãã
ç§ã¯æã£ãïŒç¢ºãã«WebRTCãããç°¡åãªè§£æ±ºçãããã¯ãã§ããïŒ
ç§ã¯ãã®ãããªè§£æ±ºçãã©ã®ããã«èŠããããšæã£ãŠããŸãããïŒ
ç§ã®æèŠã§ã¯ããœãªã¥ãŒã·ã§ã³ã«ã¯æ¬¡ã®ããããã£ãå¿ èŠã§ãã
- æ¥ç¶ã確ç«ã㊠ãDDoSæ»æã§äœ¿çšããããã»ãã¥ãªãã£ããŒã«ãæ€çŽ¢ãããã§ããªãããã«ããå¿ èŠããããŸãã
- æå·å ã2017幎ã«ã¯ãã²ãŒã ãã¢ããªã±ãŒã·ã§ã³ãæå·åãããŠããªããã±ãããéä¿¡ããŠã¯ãªããªãããã§ãã
- èªèšŒ ãå°çšãµãŒããŒã¯ãããã¯ãšã³ãã§æ¿èªãããã¯ã©ã€ã¢ã³ãããã®æ¥ç¶ã®ã¿ãåãå ¥ããå¿ èŠãããããã§ãã
ç§ã®ãœãªã¥ãŒã·ã§ã³ã玹ä»ããããšæããŸãã ç§ã¯ããããã©ãŠã¶ã®æšæºãšããŠå®å šã«åãå ¥ãããããšããå¹»æ³ã«æããããŠããŸãããç§ã¯ãŠã§ãããã°ã©ãã§ã¯ãªããã²ãŒã ãæžããŠããŸãã ããããå°ãªããšããã©ãŠã¶ã¡ãŒã«ãŒãšWebéçºè ããã¯ã©ã€ã¢ã³ããµãŒããŒã²ãŒã ãæ¬åœã«å¿ èŠãšãããã®ãç解ããã®ã«åœ¹ç«ã€ããšãé¡ã£ãŠããŸãã ç§ãææ¡ãããœãªã¥ãŒã·ã§ã³ã¯ãã²ãŒã ãšWebã®æ©æž¡ããå°ãªããšãéšåçã«æ¯æŽããã®ã«åœ¹ç«ã¡ãŸãã
ãã®çµæãè¿ãå°æ¥ãããåªãããã«ããŠãŒã¶ãŒãã©ãŠã¶ãŒã²ãŒã ãæäŸãããããšãé¡ã£ãŠããŸãã
netcode.io
ç§ãæ¥ã解決çã¯netcode.ioã§ã
netcode.ioã¯ãã¯ã©ã€ã¢ã³ããå°çšãµãŒããŒã«å®å šã«æ¥ç¶ããUDPãä»ããŠããŒã¿ã亀æã§ããããã«ããã·ã³ãã«ãªãããã¯ãŒã¯ãããã³ã«ã§ãã æ¥ç¶æåã§ããããã±ãããæå·åããã³çœ²åããèªèšŒãµããŒããæäŸãããããèš±å¯ãããã¯ã©ã€ã¢ã³ãã®ã¿ãå°çšãµãŒããŒã«æ¥ç¶ã§ããŸãã
agar.ioãªã©ã®ã²ãŒã çšã«èšèšãããŠãããã¡ã€ã³Webãµã€ãããå°çšãµãŒããŒã€ã³ã¹ã¿ã³ã¹ã«ãã¬ã€ã€ãŒããã¹ãããå¿ èŠããããŸãã åãµãŒããŒã«ã¯ããã¬ãŒã€ãŒã®æ倧æ°ã«å¶éããããŸãïŒåºæ¬å®è£ ã§ã¯ããµãŒããŒã€ã³ã¹ã¿ã³ã¹ããšã«æ倧256ãã¬ãŒã€ãŒïŒã
åºæ¬çãªèãæ¹ã¯ãWebããã¯ãšã³ããèªèšŒãå®è¡ããããšã§ãã ãã¬ãŒã€ãŒããã¬ã€ãããå Žåãããã¯ãšã³ãã¯RESTåŒã³åºããè¡ã£ãŠæ¥ç¶ããŒã¯ã³ãååŸããŸããæ¥ç¶ããŒã¯ã³ã¯ãUDPæ¥ç¶ç¢ºèªèŠæ±ã®äžéšãšããŠå°çšãµãŒããŒã«éä¿¡ãããŸãã
æ¥ç¶ããŒã¯ã³ã®æå¹æéã¯çããWebããã¯ãšã³ããšå°çšãµãŒããŒã€ã³ã¹ã¿ã³ã¹éã®å ±æç§å¯ããŒã«äŸåããŠããŸãã ãã®ã¢ãããŒãã®å©ç¹ã¯ãèš±å¯ããããŠãŒã¶ãŒã®ã¿ãå°çšãµãŒããŒã«æ¥ç¶ã§ããããšã§ãã
netcode.ioã¯ãWebRTCãããç°¡åã«åªããŠããŸãã å°çšãµãŒããŒã䜿çšããã¹ããŒã ã®ã¿ã䜿çšãããããICEãSTUNãããã³TURNã¯äžèŠã§ãã libsodiumã«ããæå·åã眲åãèªèšŒã®å®è£ ã«ãããåãã¬ãã«ã®ã»ãã¥ãªãã£ãæäŸããªãããDTLSã®å®å šãªå®è£ ã®è€éããåé¿ããŸãã
éå»1ãæã«ããã£ãŠãC 㧠netcode.ioã®åºæ¬çãªå®è£ ãäœæããŸãããããã¯ã3ãã€ã³ãBSDã©ã€ã»ã³ã¹ã®äžã§ãªãªãŒã¹ãããŠããŸãã æ°ãæ以å ã«ããã®å®è£ ãæ¹åããä»æ§ãæžããä»ã®éçºè ãšååããŠnetcode.ioãããŸããŸãªèšèªã«ç§»æ€ããããšèããŠããŸãã
ä»çµã¿
ã¯ã©ã€ã¢ã³ãã¯ãæšæºã®èªèšŒææ³ïŒããšãã°ãOAuthã䜿çšïŒã䜿çšããŠWebããã¯ãšã³ãã«ãã°ã€ã³ããŸãã ã¯ã©ã€ã¢ã³ããæ¿èªããåŸã圌ã¯ã²ãŒã ãéå§ãããªã¯ãšã¹ããéä¿¡ããRESTåŒã³åºããè¡ããŸãã RESTåŒã³åºãã¯ãHTTPSãä»ããŠã¯ã©ã€ã¢ã³ãã«base64ãšã³ã³ãŒãæ¥ç¶ããŒã¯ã³ãè¿ããŸãã
æ¥ç¶ããŒã¯ã³ã¯2ã€ã®éšåã§æ§æãããŸãã
- libsodiumã®AEADããªããã£ãã䜿çšããŠãå ±æç§å¯ããŒã§æå·åããã³çœ²åããããã©ã€ããŒãéšåã ã¯ã©ã€ã¢ã³ãã§èæ ®ãå€æŽããŸãã¯åœé ããããšã¯ã§ããŸããã
- ã¯ã©ã€ã¢ã³ããæ¥ç¶ããããã«å¿ èŠãªæ å ±ãæäŸããå ¬ééšåã ããšãã°ãUDADãã±ããã®æå·åããŒãæ¥ç¶å¯èœãªãµãŒããŒã¢ãã¬ã¹ã®ãªã¹ããããã³AEADã®ãé¢é£ããŒã¿ãéšåã«é¢é£ãããã®ä»ã®æ å ±ã
ã¯ã©ã€ã¢ã³ãã¯æ¥ç¶ããŒã¯ã³ãèªã¿åããæ¥ç¶å¯èœãªNåã®IPã¢ãã¬ã¹ã®ãªã¹ããæã£ãŠããŸãã Nã¯1ã«çãããªãå¯èœæ§ããããããã¯ã©ã€ã¢ã³ããæ¥ç¶ãããŸã§ã«æåã®ãµãŒããŒããã§ã«ãã£ã±ãã«ãªã£ãŠããå Žåã¯ãããã€ãã®ãµãŒããŒã®ã¢ãã¬ã¹ãã¯ã©ã€ã¢ã³ãã«æž¡ãã®ãæåã§ãã
å°çšãµãŒããŒã«æ¥ç¶ãããšããã¯ã©ã€ã¢ã³ãã¯å®æçã«æ¥ç¶èŠæ±ãã±ãããUDPçµç±ã§éä¿¡ããŸãã ãã®ããã±ãŒãžã«ã¯ãæ¥ç¶ããŒã¯ã³ã®ãã©ã€ããŒãããŒã¿ãšãAEADã®è¿œå ããŒã¿ïŒnetcode.ioã®ããŒãžã§ã³æ å ±ããããã³ã«èå¥åïŒç¹å®ã®åã²ãŒã ã«åºæã®64ãããçªå·ïŒãæ¥ç¶ããŒã¯ã³ã®æå¹æéã®ã¿ã€ã ã¹ã¿ã³ããAEADããªããã£ãã·ãªã¢ã«çªå·ïŒãå«ãŸããŸãã
å°çšãµãŒããŒãUDPçµç±ã§æ¥ç¶èŠæ±ãåä¿¡ãããšããŸãAEADããªããã£ãã䜿çšããŠãã±ããã³ã³ãã³ãã®æå¹æ§ãæ€èšŒããŸãã æ¥ç¶èŠæ±ãã±ããå ã®ãããªãã¯ããŒã¿ãå€æŽãããŠããå Žåã眲åãã§ãã¯ã¯ãšã©ãŒãçæããŸãã ããã«ããã顧客ã¯æ¥ç¶ããŒã¯ã³ã®æå¹æ§ã®ã¿ã€ã ã¹ã¿ã³ããå€æŽã§ããªããªããæéåãã®ããŒã¯ã³ããã°ããæåŠããããšãã§ããŸãã
æ¥ç¶ããŒã¯ã³ãæå¹ãªå Žåã埩å·åãããŸãã å éšã«ã¯ãæå¹ãªå°çšãµãŒããŒã®ã¢ãã¬ã¹ã®ãªã¹ããå«ãŸããŠããŸãã ããã«ãããæªæã®ããã¯ã©ã€ã¢ã³ããåäžã®ããŒã¯ã³ã䜿çšããŠå©çšå¯èœãªãã¹ãŠã®ãµãŒããŒã«æ¥ç¶ããããšãé²ããŸãã
ãµãŒããŒã¯ã HMACããŒã¯ã³ã®ç°¡åãªå±¥æŽãæ€çŽ¢ããããšã«ãããæ¥ç¶ããŒã¯ã³ãæ¢ã«äœ¿çšãããŠãããã©ããã確èªããŸãã äžèŽãèŠã€ãã£ãå Žåãæ¥ç¶èŠæ±ã¯ç¡èŠãããŸãã ãã®ããã1ã€ã®ããŒã¯ã³ã䜿çšããŠè€æ°ã®ã¯ã©ã€ã¢ã³ããæ¥ç¶ããããšã¯ã§ããŸããã
ããã«ããµãŒããŒã§ã¯ãåžžã«1ã€ã®ã¯ã©ã€ã¢ã³ãã®ã¿ã1ã€ã®IPã¢ãã¬ã¹ãšããŒãã«æ¥ç¶ã§ããŸãã ãŸããäžæã®ã¯ã©ã€ã¢ã³ãIDã䜿çšããŠãäžåºŠã«ãµãŒããŒã«æ¥ç¶ã§ããã¯ã©ã€ã¢ã³ãã¯1ã€ã ãã§ãã ã¯ã©ã€ã¢ã³ãIDã¯ãWebããã¯ãšã³ãã«ãã£ãŠæ¿èªãããã¯ã©ã€ã¢ã³ããäžæã«èå¥ãã64ãããæŽæ°ã§ãã
æ¥ç¶ããŒã¯ã³ã®æå¹æéãåããŠããªãå Žåã埩å·åãããŸãã å°çšãµãŒããŒã®ãããªãã¯IPã¢ãã¬ã¹ããµãŒããŒã¢ãã¬ã¹ã®ãªã¹ãã«ãããä»ã®ãã¹ãŠã®ãã§ãã¯ãæåããå Žåãå°çšãµãŒããŒã¯ã¯ã©ã€ã¢ã³ãIPã¢ãã¬ã¹ãšæ¥ç¶ããŒã¯ã³ã®ãã©ã€ããŒãããŒã¿ã«å«ãŸããæå·åããŒã®éã®éä¿¡ã確ç«ããŸãã
ãã以éãã¯ã©ã€ã¢ã³ããšãµãŒããŒéã§éä¿¡ããããã¹ãŠã®ãã±ããã¯ãããã®ããŒã§æå·åãããŸãã UDPãã±ãããçæéïŒããšãã°5ç§ïŒã¢ãã¬ã¹ããåä¿¡ãããªãå Žåãã¢ãã¬ã¹ãšæå·åããŒã®ãªã³ã¯ã¯ç¡å¹ã«ãªããŸãã
ãµãŒããŒã¯ããµãŒããŒäžã«ã¯ã©ã€ã¢ã³ãçšã®ã¹ããŒã¹ããããã©ããã確èªããŸãã åãµãŒããŒã¯ãç¹å®ã®æ倧æ°ã®ã¯ã©ã€ã¢ã³ãããµããŒãããŸãã ããšãã°ã64ãã¬ãŒã€ãŒã®ã²ãŒã ã§ã¯ãã¯ã©ã€ã¢ã³ããæ¥ç¶ããããã®64ã®å ŽæããããŸãã ãµãŒããŒããã£ã±ãã®å Žåã æ¥ç¶èŠæ±ã«å€±æãã±ããã§å¿çããŸãã ããã«ããã顧客ã¯ããµãŒããŒããã£ã±ãã§ããããªã¹ãå ã®æ¬¡ã®ãµãŒããŒã«ç§»åããå¿ èŠãããããšããã°ããèŠã€ããããšãã§ããŸãã
ãµãŒããŒã«ã¯ã©ã€ã¢ã³ãçšã®å Žæãããå ŽåããµãŒããŒã¯ãã®å Žæãããã«æäŸããŸããã 代ããã«ãã¯ã©ã€ã¢ã³ãæ¥ç¶ããŒã¯ã³ã®+ HMACã¢ãã¬ã¹ãæœåšçãªã¯ã©ã€ã¢ã³ããšããŠä¿åããŸã ã ãµãŒããŒã¯ã åŒã³åºãããŒã¯ã³ãå«ãæ¥ç¶åŒã³åºããã±ããã§å¿çã ãŸã ã åŒã³åºãããŒã¯ã³ã¯ãã©ã³ãã ããŒã§æå·åãããããŒã¿ã®ãããã¯ã§ãã ãµãŒããŒã®èµ·åæã«ããŒãçºè¡ãããŸãã
ããŒã®ã©ã³ãã åã«ãããåãåºæ°ã§è€æ°ã®ãµãŒããŒãåŒã³åºãããã®ããŒã¯ã³ãæå·åããéã«çºçããã»ãã¥ãªãã£äžã®åé¡ããªããªããŸãïŒãµãŒããŒã¯çžäºã«èª¿æŽãããŸããïŒã ããã«ãæ¥ç¶ã³ãŒã«ãã±ããã¯æ¥ç¶èŠæ±ãã±ãããããã¯ããã«å°ãããããã²ã€ã³ã¿ã€ãã®DDoSæ»æã«ãããã³ã«ã䜿çšããå¿ èŠããããŸããã
ã¯ã©ã€ã¢ã³ãã¯UDP çµç±ã§æ¥ç¶åŒã³åºããã±ãããåä¿¡ãããµãŒããŒã«æ¥ç¶å¿çãã±ãããéä¿¡ããç¶æ ã«åãæ¿ããŸãã æ¥ç¶å¿çãã±ããã¯ã ã³ãŒã«ããŒã¯ã³ãå°çšãµãŒããŒã«åã«è»¢éããã¯ã©ã€ã¢ã³ããå®éã«ãã±ãããéä¿¡ãããéä¿¡å IPã¢ãã¬ã¹ãžã®ãã±ãããåä¿¡ã§ããããšã確èªããŸãã ããã«ãããããã±ãŒãžã®éä¿¡å ã¢ãã¬ã¹ã®ãªãããŸããåé¿ãããŸãã
ãµãŒããŒã¯ãæ¥ç¶å¿çãã±ãããåä¿¡ãããš ãåŸ æ©äžã®ã¯ã©ã€ã¢ã³ãã«é¢ãã察å¿ããã¬ã³ãŒããæ€çŽ¢ããååšããå Žåã¯ãã¯ã©ã€ã¢ã³ããæ¥ç¶ããå Žæãå床æ€çŽ¢ããŸãã 空ããŠããåžããªãå Žåãæ¥ç¶èŠæ±ã®æåŠãã±ããã§å¿çããŸããããã¯ãæ¥ç¶èŠæ±ãæåã«åä¿¡ãããæç¹ã§ç©ºãã ã£ãå Žæããã§ã«äœ¿çšãããŠããããã§ãã
ãã以å€ã®å ŽåããµãŒããŒã¯ãµãŒããŒäžã®ã¯ã©ã€ã¢ã³ãã®ç©ºãã¹ããŒã¹ãå²ãåœãŠããµãŒããŒäžã®ã¹ããŒã¹ãå²ãåœãŠãããããšãã¯ã©ã€ã¢ã³ãã«éç¥ããæ¥ç¶ãµããŒãããã±ãŒãžã§å¿çããŸãã ãã®ãããªå Žæã¯ã顧客ã€ã³ããã¯ã¹ãšåŒã°ããŸã ã ãã«ããã¬ã€ã€ãŒã²ãŒã ã§ã¯ãéåžžããµãŒããŒã«æ¥ç¶ãããŠããã¯ã©ã€ã¢ã³ããèå¥ããããã«äœ¿çšãããŸãã ããšãã°ã4人çšã²ãŒã ã®é¡§å®¢0ã1ã2ã3ã¯ããã¬ãŒã€ãŒ1ã2ã3ãããã³4ã«å¯Ÿå¿ããŸãã
çŸåšããµãŒããŒã¯ãã¯ã©ã€ã¢ã³ããæ¥ç¶ãããŠããã ãã€ããŒããã±ãããéä¿¡ã§ãããšèŠãªããŸãã ãããã®ããã±ãŒãžã«ã¯ãã²ãŒã é¢é£ã®ããŒã¿ãå«ãŸããŠããŸãã ããã±ãŒãžã¯æ³šæãªãã§é éãããŸãã ãã®æ¹æ³ã®å¯äžã®æ¬ ç¹ã¯ãã¯ã©ã€ã¢ã³ããã¯ã©ã€ã¢ã³ãã€ã³ããã¯ã¹ãåä¿¡ããŠââå®å šã«æ¥ç¶ãããŠããããšã確èªããåã«ãæåã«æ¥ç¶ãµããŒãããã±ãŒãžãåä¿¡ããå¿ èŠãããããããµãŒããŒãåã¯ã©ã€ã¢ã³ãã®å Žæã確èªããŠã¯ã©ã€ã¢ã³ããæ€èšŒããããã©ãããç£èŠããããšã§ãã
åã¯ã©ã€ã¢ã³ãã®ç¢ºèªãã©ã°ã¯æåã¯falseã§ããµãŒããŒãã¯ã©ã€ã¢ã³ãããæ¥ç¶ãµããŒããã±ãããŸãã¯ãã€ããŒããã±ãããåä¿¡ãããštrueã«ãªããŸãã ã¯ã©ã€ã¢ã³ãã確èªããããŸã§ããã€ããŒããã±ãããéä¿¡ããããã³ã«ãæ¥ç¶ãµããŒããã±ãããäºåã«ãã®ã¯ã©ã€ã¢ã³ãã«éä¿¡ãããŸãã ããã«ãããã¯ã©ã€ã¢ã³ããã€ã³ããã¯ã¹ãèªèããæåã®ãã€ããŒããã±ãããåä¿¡ãããŸã§å®å šã«æ¥ç¶ãããçµ±èšç確çã確ä¿ãããæ¥ç¶ã»ããã¢ãããµã€ã¯ã«ã®æ°ãæå°éã«æããããŸãã
ã¯ã©ã€ã¢ã³ããšãµãŒããŒãå®å šã«æ¥ç¶ãããåŸãäž¡æ¹åã§UDPãã±ããã亀æã§ããŸãã éåžžãã²ãŒã ãããã³ã«ã¯ããã¬ãŒã€ãŒãå ¥åããæ å ±ãã¯ã©ã€ã¢ã³ããããµãŒããŒã«é«éã§ïŒããšãã°ã1ç§éã«60åïŒéä¿¡ããŸãããµãŒããŒããã¯ã©ã€ã¢ã³ããžã®äžçã®ç¶æ ã¯ãããé »åºŠãäœããªããŸãïŒããšãã°ã1ç§éã«20åïŒã ãã ããææ°ã®AAAã²ãŒã ã§ã¯ããµãŒããŒããŒã¿ã®æŽæ°é床ãåäžããŠããŸãã
ãµãŒããŒãŸãã¯ã¯ã©ã€ã¢ã³ããå®å®ãããã±ããã¹ããªãŒã ãéä¿¡ããªãå Žåãæ¥ç¶ãµããŒããã±ãããèªåçã«çæããããããæ¥ç¶ãã¿ã€ã ã¢ãŠãã«ãã£ãŠäžæããããšã¯ãããŸããã çãæéïŒããšãã°5ç§ïŒãäž¡åŽãããã±ãããåä¿¡ãããªãã£ãå Žåãæ¥ç¶ã¯ã¿ã€ã ã¢ãŠãããŸãã
ã©ã¡ããã®åŽãæ瀺çã«åæããå Žåãéšåçãªæ倱ã®å Žåã§ããã±ãããåä¿¡ããé«ãçµ±èšç確çã確ä¿ããããã«ãæ¥ç¶ãå®äºããããã«éå°ãªæ°ã®ãã±ãããéä¿¡ãããŸãã ããã«ãããçžæåŽãã¿ã€ã ã¢ãŠããåŸ ããã«æ¥ç¶ããã°ããå®äºã§ããŸãã
ãããã«
agar.ioã®ãããªäžè¬çãªWebã²ãŒã ã§ã¯ãå°çšã®WebRTCãµãŒããŒãåããã¯ã©ã€ã¢ã³ã/ãµãŒããŒæ§é ã®ã³ã³ããã¹ãã§ã¯äœ¿çšãé£ãããããããŒã¿ã¯TCPãä»ããŠWebSocketsãä»ããŠè»¢éãããŸãã
Googleã®1ã€ã®ãœãªã¥ãŒã·ã§ã³ã¯ãã²ãŒã éçºè ãWebRTCããŒã¿ãã£ãŒããµããŒããå°çšãµãŒããŒã«ç°¡åã«çµ±åã§ããããã«ããããšã§ãã
ãŸãã¯ããWebSockets for UDPãã®ãããªã¯ããã«åçŽãªãœãªã¥ãŒã·ã§ã³ã䜿çšããnetcode.ioã䜿çšã§ããŸãã æšæºåããŠãã©ãŠã¶ã«åã蟌ããšãåé¡ã解決ã§ããŸãã
ã°ã¬ã³ãã£ãŒãã©ãŒã¯The Network Protocol Companyã®åµç«è ããã³ç€Ÿé·ã§ãã ã²ãŒã ã®ãããã¯ãŒã¯éšåãèšå®ããããã®ãµãŒãã¹ãæäŸããŸãã Glennã¯èšç«åã¯Respawn Entertainmentã®ãªãŒãããã°ã©ããŒã§ãããTitanfall 1ããã³2ã«åãçµãã§ããŸããã
Glennã¯ãã²ãŒã ã®ãããã¯ãŒã¯ããŒã¿è»¢éãšç©çåŠã«é¢ããgafferongames.comã®äººæ°èšäºã®èè ã§ããããŸãã ãã£ãã©ãŒã¯ããªãŒãã³ãœãŒã¹ãããã¯ãŒã¯ã©ã€ãã©ãªlibyojimboããã³netcode.ioãäœæããŸããã