mirror of
https://github.com/v2fly/v2ray-core
synced 2024-02-27 03:18:06 +00:00
configuration for connection reuse
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/transport"
|
||||
)
|
||||
|
||||
type ConnectionConfig struct {
|
||||
@@ -55,6 +56,7 @@ type Config struct {
|
||||
OutboundConfig *ConnectionConfig
|
||||
InboundDetours []*InboundDetourConfig
|
||||
OutboundDetours []*OutboundDetourConfig
|
||||
TransportConfig *transport.Config
|
||||
}
|
||||
|
||||
type ConfigLoader func(init string) (*Config, error)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/transport"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -30,6 +31,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
||||
OutboundConfig *ConnectionConfig `json:"outbound"`
|
||||
InboundDetours []*InboundDetourConfig `json:"inboundDetour"`
|
||||
OutboundDetours []*OutboundDetourConfig `json:"outboundDetour"`
|
||||
Transport *transport.Config `json:"transport"`
|
||||
}
|
||||
jsonConfig := new(JsonConfig)
|
||||
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
||||
@@ -57,6 +59,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
}
|
||||
this.DNSConfig = jsonConfig.DNSConfig
|
||||
this.TransportConfig = jsonConfig.Transport
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/v2ray/v2ray-core/common/retry"
|
||||
"github.com/v2ray/v2ray-core/proxy"
|
||||
proxyrepo "github.com/v2ray/v2ray-core/proxy/repo"
|
||||
"github.com/v2ray/v2ray-core/transport"
|
||||
)
|
||||
|
||||
// Point shell of V2Ray.
|
||||
@@ -38,6 +39,10 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
||||
vpoint.port = pConfig.Port
|
||||
vpoint.listen = pConfig.ListenOn
|
||||
|
||||
if pConfig.TransportConfig != nil {
|
||||
transport.ApplyConfig(pConfig.TransportConfig)
|
||||
}
|
||||
|
||||
if pConfig.LogConfig != nil {
|
||||
logConfig := pConfig.LogConfig
|
||||
if len(logConfig.AccessLog) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user