台灣 5G 網路偵測「分享」的方式

Twitter 上看到 zmx 分享的 tweet:

原始文章在「[教學]讓5G網路分享不被限速 —— 更改TTL」這邊,目前已經自刪,但已經有人在 Internet Archive 上面先 archive 起來了:「[教學]讓5G網路分享不被限速 —— 更改TTL」。

技術上是偵測 TTL 的數字來決定要怎麼擋 (一般機器的預設是 64),而 TTL 在過 router (像是分享器) 時會自動減一,所以可以用這點來偵測。另外找了一下資料,看起來這個方式應該很久前就有在傳:「[問題] 5G熱點分享問題 (USB分享算不算?) (2020)」、「[問題] 5G熱點分享限制有可能破解嗎? (2021)」。

另外 Nahcoroyk 有提到要關掉 IPv6:

如果你5G是C/F/T家的記得把電腦的ipv6關掉,因為ipv6還是可以分辨你是不是有做分享,剛實測某家ipv6下載一樣會扣 但ipv4就列入行動網路了XD (我用iphone13pro分享給電腦)

在猜之前有些手機不限流,但分享只有 1GB 的海外 SIM 卡應該也是類似的方法在偵測?之後能出國的時候可以研究看看...

除了 DNS 的 TTL 外,還有瀏覽器本身的 cache time...

在看「Reviewing Fastly’s New Approach To Load Balancing In The Cloud」這篇的時候被提醒:

However, most browsers have implemented their own caching layer that can override the TTL specified by the server. In fact, some browsers cache for 5-10 minutes, which is an eternity when a region or data center fails and you need to route end users to a different location.

我印象中沒那麼長,但也記不起來多長,所以查了一下...

結果 IE 在「How Internet Explorer uses the cache for DNS host entries」直接說三十分鐘 XDDD 這篇文章是 2011 年更新的,所以至少到 IE9 都是對的?

Internet Explorer 4.x and later versions modify how DNS host entries are cached by decreasing the default time-out value to 30 minutes.

Firefox 的值可以從 Mozilla networking preferences 這邊對 network.dnsCacheExpiration 的說明看到是 60 秒。

Google Chrome 沒找到官方的說明...

不過這可以知道當你要換 IP address 時,如果可以讓新舊 IP 都提供服務的話,至少規劃半個小時會比較保險。如果有其他理由而沒辦法同時提供服務的話,至少公告步驟裡要有「重開瀏覽器」這塊。

而作業系統自己的 cache 又是另外要計算進去的事了...

DynamoDB 推出 TTL 功能

DynamoDB 推出了依照時間自動刪除的功能:「New – Manage DynamoDB Items Using Time to Live (TTL)」。

You can enable this feature on a table-by-table basis, specifying an item attribute that contains the expiration time for the item.

這個功能比較特別的是,刪除的 scan 是不收取費用的:

There is no charge for the internal scan operation or for the deletion. You will pay for storage until the item is actually deleted.

Adobe Typekit 對 PageSpeed 的妥協

Adobe Typekit 是個收費的網頁字型服務,為了讓變更可以儘快生效,用了比較短的 cache time:

We use a short cache time for the kit JavaScript so that you can update your kit (for example, adding fonts, or changing the list of allowed domains) and have your changes live in a reasonable amount of time.

但這也造成了不少人抱怨 Google PageSpeed Tools 會扣分,而實際上也的確降低效率 (因為你不需要天天改設定):

Adobe 給了妥協的方案,你可以選擇使用更長的 cache time,從本來的 10 mins 變成 1 week:「Improved caching for kits: Opt for longer cache timeout」。

這個選項使得 Google PageSpeed Tools 不會扣分,也讓效能再更好一些。