1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-06 10:20:44 -05:00
v2fly/transport/internet/tcp/config_json.go

21 lines
370 B
Go
Raw Normal View History

2016-06-14 16:54:08 -04:00
package tcp
import (
"encoding/json"
)
func (this *Config) UnmarshalJSON(data []byte) error {
type JsonConfig struct {
ConnectionReuse bool `json:"connectionReuse"`
}
jsonConfig := &JsonConfig{
ConnectionReuse: true,
}
if err := json.Unmarshal(data, jsonConfig); err != nil {
return err
}
this.ConnectionReuse = jsonConfig.ConnectionReuse
return nil
}