Skip to content

Commit 88e74ff

Browse files
authored
Merge pull request #3300 from fatedier/dev
sync
2 parents 534dc99 + 18ab58e commit 88e74ff

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pkg/config/proxy.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,10 @@ func (cfg *BaseProxyConf) marshalToMsg(pMsg *msg.NewProxy) {
396396
pMsg.UseEncryption = cfg.UseEncryption
397397
pMsg.UseCompression = cfg.UseCompression
398398
pMsg.BandwidthLimit = cfg.BandwidthLimit.String()
399-
pMsg.BandwidthLimitMode = cfg.BandwidthLimitMode
399+
// leave it empty for default value to reduce traffic
400+
if cfg.BandwidthLimitMode != "client" {
401+
pMsg.BandwidthLimitMode = cfg.BandwidthLimitMode
402+
}
400403
pMsg.Group = cfg.Group
401404
pMsg.GroupKey = cfg.GroupKey
402405
pMsg.Metas = cfg.Metas
@@ -407,8 +410,12 @@ func (cfg *BaseProxyConf) unmarshalFromMsg(pMsg *msg.NewProxy) {
407410
cfg.ProxyType = pMsg.ProxyType
408411
cfg.UseEncryption = pMsg.UseEncryption
409412
cfg.UseCompression = pMsg.UseCompression
410-
cfg.BandwidthLimit, _ = NewBandwidthQuantity(pMsg.BandwidthLimit)
411-
cfg.BandwidthLimitMode = pMsg.BandwidthLimitMode
413+
if pMsg.BandwidthLimit != "" {
414+
cfg.BandwidthLimit, _ = NewBandwidthQuantity(pMsg.BandwidthLimit)
415+
}
416+
if pMsg.BandwidthLimitMode != "" {
417+
cfg.BandwidthLimitMode = pMsg.BandwidthLimitMode
418+
}
412419
cfg.Group = pMsg.Group
413420
cfg.GroupKey = pMsg.GroupKey
414421
cfg.Metas = pMsg.Metas

0 commit comments

Comments
 (0)