|  | @@ -2,37 +2,16 @@
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  package transport
 |  |  package transport
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -import (
 |  | 
 | 
											
												
													
														|  | -	"encoding/json"
 |  | 
 | 
											
												
													
														|  | -	"strings"
 |  | 
 | 
											
												
													
														|  | -)
 |  | 
 | 
											
												
													
														|  | 
 |  | +import "encoding/json"
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func (this *Config) UnmarshalJSON(data []byte) error {
 |  |  func (this *Config) UnmarshalJSON(data []byte) error {
 | 
											
												
													
														|  | -	type TypeConfig struct {
 |  | 
 | 
											
												
													
														|  | -		StreamType string          `json:"streamType"`
 |  | 
 | 
											
												
													
														|  | -		Settings   json.RawMessage `json:"settings"`
 |  | 
 | 
											
												
													
														|  | -	}
 |  | 
 | 
											
												
													
														|  | -	type JsonTCPConfig struct {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	type JsonConfig struct {
 | 
											
												
													
														|  |  		ConnectionReuse bool `json:"connectionReuse"`
 |  |  		ConnectionReuse bool `json:"connectionReuse"`
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -	typeConfig := new(TypeConfig)
 |  | 
 | 
											
												
													
														|  | -	if err := json.Unmarshal(data, typeConfig); err != nil {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	jsonConfig := new(JsonConfig)
 | 
											
												
													
														|  | 
 |  | +	if err := json.Unmarshal(data, jsonConfig); err != nil {
 | 
											
												
													
														|  |  		return err
 |  |  		return err
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -	this.StreamType = StreamTypeTCP
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -	streamType := strings.ToLower(typeConfig.StreamType)
 |  | 
 | 
											
												
													
														|  | -	if streamType == "tcp" {
 |  | 
 | 
											
												
													
														|  | -		jsonTCPConfig := new(JsonTCPConfig)
 |  | 
 | 
											
												
													
														|  | -		if err := json.Unmarshal(typeConfig.Settings, jsonTCPConfig); err != nil {
 |  | 
 | 
											
												
													
														|  | -			return err
 |  | 
 | 
											
												
													
														|  | -		}
 |  | 
 | 
											
												
													
														|  | -		this.TCPConfig = &TCPConfig{
 |  | 
 | 
											
												
													
														|  | -			ConnectionReuse: jsonTCPConfig.ConnectionReuse,
 |  | 
 | 
											
												
													
														|  | -		}
 |  | 
 | 
											
												
													
														|  | -	}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +	this.ConnectionReuse = jsonConfig.ConnectionReuse
 | 
											
												
													
														|  |  	return nil
 |  |  	return nil
 | 
											
												
													
														|  |  }
 |  |  }
 |