mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-12 16:59:38 +07:00
feat: support independent tcp4, tcp6, udp4, udp6 connectivity check
This commit is contained in:
@ -10,7 +10,6 @@ import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/v2rayA/dae/config"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
@ -22,6 +21,11 @@ var (
|
||||
ErrOverlayHierarchicalKey = fmt.Errorf("overlay hierarchical key")
|
||||
)
|
||||
|
||||
type UrlOrEmpty struct {
|
||||
Url *url.URL
|
||||
Empty bool
|
||||
}
|
||||
|
||||
func CloneStrings(slice []string) []string {
|
||||
c := make([]string, len(slice))
|
||||
copy(c, slice)
|
||||
@ -279,9 +283,9 @@ func FuzzyDecode(to interface{}, val string) bool {
|
||||
v.SetString(val)
|
||||
case reflect.Struct:
|
||||
switch v.Interface().(type) {
|
||||
case config.UrlOrEmpty:
|
||||
case UrlOrEmpty:
|
||||
if val == "" {
|
||||
v.Set(reflect.ValueOf(config.UrlOrEmpty{
|
||||
v.Set(reflect.ValueOf(UrlOrEmpty{
|
||||
Url: nil,
|
||||
Empty: true,
|
||||
}))
|
||||
@ -290,7 +294,7 @@ func FuzzyDecode(to interface{}, val string) bool {
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
v.Set(reflect.ValueOf(config.UrlOrEmpty{
|
||||
v.Set(reflect.ValueOf(UrlOrEmpty{
|
||||
Url: u,
|
||||
Empty: false,
|
||||
}))
|
||||
|
Reference in New Issue
Block a user