-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine WAN+WWAN for throughput (#128)
- Loading branch information
Showing
1 changed file
with
1 addition
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,6 @@ local tonumber = tonumber | |
local format = string.format | ||
local TGU_MbPS = ngx.shared.TGU_MbPS | ||
|
||
local wan_intf = "wan" | ||
local wwan = { ipaddr = "[email protected]", ip6addr = "[email protected]", } | ||
content_helper.getExactContent(wwan) | ||
if wwan.ipaddr:len() ~= 0 or wwan.ip6addr:len() ~= 0 then | ||
wan_intf = "wwan" | ||
end | ||
|
||
local wan_data = { | ||
lan_rx = "[email protected]_bytes", | ||
lan_tx = "[email protected]_bytes", | ||
|
@@ -45,7 +38,7 @@ for key,value in pairs(wan_data) do | |
end | ||
end | ||
|
||
local tx_mbps,rx_mbps = TGU_MbPS:get(wan_intf.."_tx_mbps") or 0,TGU_MbPS:get(wan_intf.."_rx_mbps") or 0 | ||
local tx_mbps,rx_mbps = (TGU_MbPS:get("wan_tx_mbps") or 0) + (TGU_MbPS:get("wwan_tx_mbps") or 0),(TGU_MbPS:get("wan_rx_mbps") or 0) + (TGU_MbPS:get("wwan_rx_mbps") or 0) | ||
|
||
local data = { | ||
wan = format("%.2f Mb/s <b>↑</b><br>%.2f Mb/s <b>↓</b></span>",tx_mbps,rx_mbps), | ||
|