mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
347 B
23 lines
347 B
// +build json
|
|
|
|
package kcp
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
|
type JSONConfig struct {
|
|
Mtu *int `json:"mtu"`
|
|
}
|
|
jsonConfig := new(JSONConfig)
|
|
if err := json.Unmarshal(data, &jsonConfig); err != nil {
|
|
return err
|
|
}
|
|
if jsonConfig.Mtu != nil {
|
|
this.Mtu = *jsonConfig.Mtu
|
|
}
|
|
|
|
return nil
|
|
}
|