mirror of https://github.com/v2ray/v2ray-core
check mtu setting
parent
16f5f81fe9
commit
a0d08e4961
|
@ -4,6 +4,9 @@ package kcp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"github.com/v2ray/v2ray-core/common/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (this *Config) UnmarshalJSON(data []byte) error {
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
||||||
|
@ -15,6 +18,11 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if jsonConfig.Mtu != nil {
|
if jsonConfig.Mtu != nil {
|
||||||
|
mtu := *jsonConfig.Mtu
|
||||||
|
if mtu < 576 || mtu > 1460 {
|
||||||
|
log.Error("KCP|Config: Invalid MTU size: ", mtu)
|
||||||
|
return errors.New("Invalid configuration")
|
||||||
|
}
|
||||||
this.Mtu = *jsonConfig.Mtu
|
this.Mtu = *jsonConfig.Mtu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue