feat: support independent tcp4, tcp6, udp4, udp6 connectivity check

This commit is contained in:
mzz2017
2023-02-08 20:15:24 +08:00
committed by mzz
parent 551e79d9e5
commit 5e7b68822a
26 changed files with 738 additions and 222 deletions

View File

@ -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,
}))