Giter Club home page Giter Club logo

cdn_dpi's Introduction

CDN_DPI

Deep Packet Inspection

DPI, Deep Packet Inspection

深度封包檢測技術 一種以應用層為基礎的網路流量控管技術,可以對經過的封包進行重建,進而改變原有流量模型。在封包的分析上,比傳統的路由器、交換機、防火牆來的更加深入,不僅僅只是檢查標頭檔和中繼續資料。

除了 Header 和 Metadata,尚能改變其 HTTP 方法中攜帶的 URL、Timestamp 欄位。此技術可以改變使用者造訪請求資料中的 URL 和 主機位址,將源網站的存取請求 redirect 指向 CDN。

視訊請求示意圖

              源網址 119.147.157.135 video.google.com/  
              
                                   \
                                    \
                                     \
                                 (Cache Max Age Expires)
                                        \
                                         \
                                          \
                                      
                                DPI --(3)--+---  (4) CDN  Node  f.google.com/  
                                         
                                 |        /
                                 |       /
                                (2)     /
                                 |     /
                                 |    /
                                     
                                User  <-----(1)----->   DNS 解析源網址網域的 IP 位址
 
 DPI 監聽到 http 請求有某特定 MP4 檔案檔案,並且將擷取來的封包資訊發送給 CDN 體系。
 CDN 節點在快取中確定是否存在該檔案,如果使用者第一次發出此類檔案之請求,則 CDN 並未快取過該檔案,
 並將未快取的結果回傳 DPI,DPI 方才通知源網站。

視訊存取流程

(1) 使用者開啟網頁網址,取得網頁內容。

Http Request

  +-----------------+-----------------------------------------+
  | Accept          | text/html, application/xhtml+xml, */*   | 可接受的格式
  +-----------------+-----------------------------------------+
  | Ref             | http://video.google.com/id_123.html?f=0 | 發出請求的載體參考位址
  +-----------------+-----------------------------------------+
  | Accept-Encoding | gzip, deflate                           | 編碼格式
  +-----------------+-----------------------------------------+
  | Host            | video.google.com/                       | 提供服務的伺服器名稱
  +-----------------+-----------------------------------------+
  | Cookie          | vsuid=1234567890123                     |
  +-----------------+-----------------------------------------+

(2) google 網頁 embeded 的 flash 播放器 向 f.google.com 發出 http 請求, 取得視訊內容的真實 URL 位址。

  +-----------------+-----------------------------------------+
  | Accept          |  */*                                    | 可接受的格式
  +-----------------+-----------------------------------------+
  | Ref             | http://static.google.com/v1/player.swf  | 發出請求的載體參考位址
  +-----------------+-----------------------------------------+
  | Accept-Encoding | gzip, deflate                           | 編碼格式
  +-----------------+-----------------------------------------+
  | Host            | f.google.com/                           | 提供服務的伺服器名稱
  +-----------------+-----------------------------------------+
  | Cookie          | vsuid=1234567890123                     |
  +-----------------+-----------------------------------------+
  | Connection      | Keep-Alive                              | 連線狀態:保持連線
  +-----------------+-----------------------------------------+

(3) 從 f.google.com/ 回應內容可以看到視訊內容的真實 URL 及其 MP4 檔案。

  +-----------------+-----------------------------------------+
  | Expires         |  -1                                     | 
  +-----------------+-----------------------------------------+
  | Cache-Control   | max-age = 0                             | 快取控制
  +-----------------+-----------------------------------------+
  | Location        | http://119.147.157.135/.......          | 視訊內容的真實 URL 及其 MP4 檔案編碼格式
  +-----------------+-----------------------------------------+
  | Date            | Sun, 4th Sep 2020 14.00.00 GMT          | 時間戳記
  +-----------------+-----------------------------------------+
  | Connection      | close                                   | 連線狀態:關閉
  +-----------------+-----------------------------------------+
  | Server          |  F_012345                               |
  +-----------------+-----------------------------------------+

(4) 播放器再次向 119.147.157.135 伺服器發起 http 請求視訊內容。

  +-----------------+-----------------------------------------+
  | Accept          |  */*                                    | 可接受的格式
  +-----------------+-----------------------------------------+
  | Ref             | 11, 4, 402, 265                         | 發出請求的載體參考位址
  +-----------------+-----------------------------------------+
  | Accept-Encoding | gzip, deflate                           | 編碼格式
  +-----------------+-----------------------------------------+
  | Host            | 119.147.157.135                         | 提供服務的伺服器名稱
  +-----------------+-----------------------------------------+
  | Cookie          | vsuid=1234567890123                     |
  +-----------------+-----------------------------------------+
  | Connection      | Keep-Alive                              | 連線狀態:保持連線
  +-----------------+-----------------------------------------+

(5) 收到伺服器回傳訊息後,開始視訊傳輸。

  +-----------------+-----------------------------------------+
  | Content-Type    | video/mp4                               | 
  +-----------------+-----------------------------------------+
  | Accept-Ranges   | bytes                                   | 
  +-----------------+-----------------------------------------+
  | ETag            |                                         | 
  +-----------------+-----------------------------------------+
  | Last-Modified   | Sat, 18th March 2020 10:00:00 GMT       |
  +-----------------+-----------------------------------------+
  | Date            | Sun, 4th Sep 2020 14.00.00 GMT          | 時間戳記
  +-----------------+-----------------------------------------+
  | Connection      | close                                   | 連線狀態:關閉
  +-----------------+-----------------------------------------+
  | Server          | GOOGLE.DG                               |
  +-----------------+-----------------------------------------+

cdn_dpi's People

Contributors

queeniecplusplus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.