@@ -105,6 +105,12 @@ func (ns *networkStatus) ReceiveSpeed() (Size, error) {
105105 diff := float64 (ns .TimeSequence .New .Receive - ns .TimeSequence .Old .Receive )
106106 return Size (diff / CheckInterval .Seconds ()), nil
107107}
108+ func (ns * networkStatus ) Transmit () Size {
109+ return ns .TimeSequence .New .Transmit
110+ }
111+ func (ns * networkStatus ) Receive () Size {
112+ return ns .TimeSequence .New .Receive
113+ }
108114
109115type AllNetworkStatus []networkStatus
110116
@@ -130,9 +136,23 @@ func (nss AllNetworkStatus) ReceiveSpeed() (Size, error) {
130136 }
131137 return Size (sum ), nil
132138}
139+ func (nss AllNetworkStatus ) Transmit () Size {
140+ var sum float64
141+ for _ , ns := range nss {
142+ sum += float64 (ns .Transmit ())
143+ }
144+ return Size (sum )
145+ }
146+ func (nss AllNetworkStatus ) Receive () Size {
147+ var sum float64
148+ for _ , ns := range nss {
149+ sum += float64 (ns .Receive ())
150+ }
151+ return Size (sum )
152+ }
133153
134154func RefreshStatus () error {
135- output , _ := sys .Execute ("bash " , res .ServerBoxShellPath )
155+ output , _ := sys .Execute ("sh " , res .ServerBoxShellPath )
136156 err := os .WriteFile (filepath .Join (res .ServerBoxDirPath , "shell_output.log" ), []byte (output ), 0644 )
137157 if err != nil {
138158 log .Warn ("[STATUS] write shell output log failed: %s" , err )
0 commit comments