mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 18:41:59 -07:00
Merge pull request #2406 from syncthing/fix-non-local-local-networks
Consider 'AlwaysLocalNets' in bandwidth limiters
This commit is contained in:
commit
e725c97967
@ -600,17 +600,18 @@ func syncthingMain() {
|
|||||||
|
|
||||||
if (opts.MaxRecvKbps > 0 || opts.MaxSendKbps > 0) && !opts.LimitBandwidthInLan {
|
if (opts.MaxRecvKbps > 0 || opts.MaxSendKbps > 0) && !opts.LimitBandwidthInLan {
|
||||||
lans, _ = osutil.GetLans()
|
lans, _ = osutil.GetLans()
|
||||||
networks := make([]string, 0, len(lans))
|
|
||||||
for _, lan := range lans {
|
|
||||||
networks = append(networks, lan.String())
|
|
||||||
}
|
|
||||||
for _, lan := range opts.AlwaysLocalNets {
|
for _, lan := range opts.AlwaysLocalNets {
|
||||||
_, ipnet, err := net.ParseCIDR(lan)
|
_, ipnet, err := net.ParseCIDR(lan)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Infoln("Network", lan, "is malformed:", err)
|
l.Infoln("Network", lan, "is malformed:", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
networks = append(networks, ipnet.String())
|
lans = append(lans, ipnet)
|
||||||
|
}
|
||||||
|
|
||||||
|
networks := make([]string, len(lans))
|
||||||
|
for i, lan := range lans {
|
||||||
|
networks[i] = lan.String()
|
||||||
}
|
}
|
||||||
l.Infoln("Local networks:", strings.Join(networks, ", "))
|
l.Infoln("Local networks:", strings.Join(networks, ", "))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user