mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-19 10:56:06 -05:00
Load Configure from json
This commit is contained in:
parent
8c4a6d94f9
commit
2eced2bd6c
@ -7,12 +7,14 @@ import (
|
|||||||
|
|
||||||
"github.com/v2ray/v2ray-core/transport/internet/kcp"
|
"github.com/v2ray/v2ray-core/transport/internet/kcp"
|
||||||
"github.com/v2ray/v2ray-core/transport/internet/tcp"
|
"github.com/v2ray/v2ray-core/transport/internet/tcp"
|
||||||
|
"github.com/v2ray/v2ray-core/transport/internet/ws"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (this *Config) UnmarshalJSON(data []byte) error {
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
||||||
type JsonConfig struct {
|
type JsonConfig struct {
|
||||||
TCPConfig *tcp.Config `json:"tcpSettings"`
|
TCPConfig *tcp.Config `json:"tcpSettings"`
|
||||||
KCPConfig kcp.Config `json:"kcpSettings"`
|
KCPConfig kcp.Config `json:"kcpSettings"`
|
||||||
|
WSConfig *ws.Config `json:"wsSettings"`
|
||||||
}
|
}
|
||||||
jsonConfig := &JsonConfig{
|
jsonConfig := &JsonConfig{
|
||||||
KCPConfig: kcp.DefaultConfig(),
|
KCPConfig: kcp.DefaultConfig(),
|
||||||
@ -22,6 +24,6 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
}
|
}
|
||||||
this.tcpConfig = jsonConfig.TCPConfig
|
this.tcpConfig = jsonConfig.TCPConfig
|
||||||
this.kcpConfig = jsonConfig.KCPConfig
|
this.kcpConfig = jsonConfig.KCPConfig
|
||||||
|
this.wsConfig = jsonConfig.WSConfig
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user