mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-13 01:08:39 +07:00
fix: bind to multiple LAN/WAN interfaces
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/v2rayA/dae/common"
|
"github.com/v2rayA/dae/common"
|
||||||
"github.com/v2rayA/dae/pkg/config_parser"
|
"github.com/v2rayA/dae/pkg/config_parser"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parser is section items parser
|
// Parser is section items parser
|
||||||
@ -117,11 +118,14 @@ func paramParser(to reflect.Value, section *config_parser.Section, ignoreType []
|
|||||||
field.Val.Set(reflect.ValueOf(itemVal.Val))
|
field.Val.Set(reflect.ValueOf(itemVal.Val))
|
||||||
case reflect.Slice:
|
case reflect.Slice:
|
||||||
// Field is not interface{}, we can decode.
|
// Field is not interface{}, we can decode.
|
||||||
vPointerNew := reflect.New(field.Val.Type().Elem())
|
values := strings.Split(itemVal.Val, ",")
|
||||||
if !common.FuzzyDecode(vPointerNew.Interface(), itemVal.Val) {
|
for _, value := range values {
|
||||||
return fmt.Errorf("failed to parse \"%v.%v\": value \"%v\" cannot be convert to %v", section.Name, itemVal.Key, itemVal.Val, field.Val.Type().Elem().String())
|
vPointerNew := reflect.New(field.Val.Type().Elem())
|
||||||
|
if !common.FuzzyDecode(vPointerNew.Interface(), value) {
|
||||||
|
return fmt.Errorf("failed to parse \"%v.%v\": value \"%v\" cannot be convert to %v", section.Name, itemVal.Key, itemVal.Val, field.Val.Type().Elem().String())
|
||||||
|
}
|
||||||
|
field.Val.Set(reflect.Append(field.Val, vPointerNew.Elem()))
|
||||||
}
|
}
|
||||||
field.Val.Set(reflect.Append(field.Val, vPointerNew.Elem()))
|
|
||||||
default:
|
default:
|
||||||
// Field is not interface{}, we can decode.
|
// Field is not interface{}, we can decode.
|
||||||
if !common.FuzzyDecode(field.Val.Addr().Interface(), itemVal.Val) {
|
if !common.FuzzyDecode(field.Val.Addr().Interface(), itemVal.Val) {
|
||||||
|
Reference in New Issue
Block a user