mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
Merge branch 'master' of https://github.com/v2ray/v2ray-core
This commit is contained in:
commit
666dff02b0
@ -1,9 +1,11 @@
|
|||||||
package transport
|
package transport
|
||||||
|
|
||||||
|
// Config for V2Ray transport layer.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ConnectionReuse bool
|
ConnectionReuse bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply applies this Config.
|
||||||
func (this *Config) Apply() error {
|
func (this *Config) Apply() error {
|
||||||
if this.ConnectionReuse {
|
if this.ConnectionReuse {
|
||||||
connectionReuse = true
|
connectionReuse = true
|
||||||
|
@ -8,7 +8,9 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
type JsonConfig struct {
|
type JsonConfig struct {
|
||||||
ConnectionReuse bool `json:"connectionReuse"`
|
ConnectionReuse bool `json:"connectionReuse"`
|
||||||
}
|
}
|
||||||
jsonConfig := new(JsonConfig)
|
jsonConfig := &JsonConfig{
|
||||||
|
ConnectionReuse: true,
|
||||||
|
}
|
||||||
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package transport
|
package transport
|
||||||
|
|
||||||
var (
|
var (
|
||||||
connectionReuse = false
|
connectionReuse = true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// IsConnectionReusable returns true if V2Ray is trying to reuse TCP connections.
|
||||||
func IsConnectionReusable() bool {
|
func IsConnectionReusable() bool {
|
||||||
return connectionReuse
|
return connectionReuse
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user