1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00

check mtu setting

This commit is contained in:
v2ray 2016-06-18 17:14:39 +02:00
parent 16f5f81fe9
commit a0d08e4961

View File

@ -4,6 +4,9 @@ package kcp
import (
"encoding/json"
"errors"
"github.com/v2ray/v2ray-core/common/log"
)
func (this *Config) UnmarshalJSON(data []byte) error {
@ -15,6 +18,11 @@ func (this *Config) UnmarshalJSON(data []byte) error {
return err
}
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
}