Skip to content

Commit

Permalink
Combine WAN+WWAN for throughput (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
seud0nym committed Jan 11, 2023
1 parent 420d8b6 commit ccb8bd3
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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>&uarr;</b><br>%.2f Mb/s <b>&darr;</b></span>",tx_mbps,rx_mbps),
Expand Down

0 comments on commit ccb8bd3

Please sign in to comment.