mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-10-31 08:18:50 -04:00
21 lines
370 B
Go
21 lines
370 B
Go
|
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
|
||
|
}
|