|  | @@ -4,13 +4,14 @@ import (
 | 
											
												
													
														|  |  	"encoding/json"
 |  |  	"encoding/json"
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	"github.com/v2ray/v2ray-core/common/log"
 |  |  	"github.com/v2ray/v2ray-core/common/log"
 | 
											
												
													
														|  | -	"github.com/v2ray/v2ray-core/config"
 |  | 
 | 
											
												
													
														|  | 
 |  | +	proxyconfig "github.com/v2ray/v2ray-core/proxy/common/config"
 | 
											
												
													
														|  | 
 |  | +	proxyjson "github.com/v2ray/v2ray-core/proxy/common/config/json"
 | 
											
												
													
														|  |  )
 |  |  )
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  type ConnectionConfig struct {
 |  |  type ConnectionConfig struct {
 | 
											
												
													
														|  | -	ProtocolString  string          `json:"protocol"`
 |  | 
 | 
											
												
													
														|  | -	SettingsMessage json.RawMessage `json:"settings"`
 |  | 
 | 
											
												
													
														|  | -	Type            config.Type     `json:"-"`
 |  | 
 | 
											
												
													
														|  | 
 |  | +	ProtocolString  string           `json:"protocol"`
 | 
											
												
													
														|  | 
 |  | +	SettingsMessage json.RawMessage  `json:"settings"`
 | 
											
												
													
														|  | 
 |  | +	Type            proxyconfig.Type `json:"-"`
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func (c *ConnectionConfig) Protocol() string {
 |  |  func (c *ConnectionConfig) Protocol() string {
 | 
											
										
											
												
													
														|  | @@ -18,11 +19,10 @@ func (c *ConnectionConfig) Protocol() string {
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func (c *ConnectionConfig) Settings() interface{} {
 |  |  func (c *ConnectionConfig) Settings() interface{} {
 | 
											
												
													
														|  | -	creator, found := configCache[getConfigKey(c.Protocol(), c.Type)]
 |  | 
 | 
											
												
													
														|  | -	if !found {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	configObj := proxyjson.CreateConfig(c.Protocol(), c.Type)
 | 
											
												
													
														|  | 
 |  | +	if configObj == nil {
 | 
											
												
													
														|  |  		panic("Unknown protocol " + c.Protocol())
 |  |  		panic("Unknown protocol " + c.Protocol())
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  | -	configObj := creator()
 |  | 
 | 
											
												
													
														|  |  	err := json.Unmarshal(c.SettingsMessage, configObj)
 |  |  	err := json.Unmarshal(c.SettingsMessage, configObj)
 | 
											
												
													
														|  |  	if err != nil {
 |  |  	if err != nil {
 | 
											
												
													
														|  |  		log.Error("Unable to parse connection config: %v", err)
 |  |  		log.Error("Unable to parse connection config: %v", err)
 |