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.
v2ray-core/transport/internet/kcp/config_json.go

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
}