mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
550 B
27 lines
550 B
9 years ago
|
package json
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
9 years ago
|
|
||
|
"github.com/v2ray/v2ray-core/common/log"
|
||
9 years ago
|
)
|
||
|
|
||
|
type RouterConfig struct {
|
||
|
StrategyValue string `json:"strategy"`
|
||
|
SettingsValue json.RawMessage `json:"settings"`
|
||
|
}
|
||
|
|
||
|
func (this *RouterConfig) Strategy() string {
|
||
|
return this.StrategyValue
|
||
|
}
|
||
|
|
||
|
func (this *RouterConfig) Settings() interface{} {
|
||
9 years ago
|
settings := CreateRouterConfig(this.Strategy())
|
||
|
err := json.Unmarshal(this.SettingsValue, settings)
|
||
|
if err != nil {
|
||
|
log.Error("Failed to load router settings: %v", err)
|
||
|
return nil
|
||
|
}
|
||
|
return settings
|
||
9 years ago
|
}
|