From e79eb71877ebce757e648e93aef68d097fdb7ce5 Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Sun, 18 Apr 2021 11:35:32 +0800 Subject: [PATCH] fix: the problem that docker has no ipv6 by default --- service/core/iptables/utils.go | 10 +++++++++- service/global/environmentConfig.go | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/service/core/iptables/utils.go b/service/core/iptables/utils.go index db11e23a..becaea59 100644 --- a/service/core/iptables/utils.go +++ b/service/core/iptables/utils.go @@ -1,7 +1,9 @@ package iptables import ( + "github.com/v2rayA/v2rayA/common" "github.com/v2rayA/v2rayA/common/cmds" + "github.com/v2rayA/v2rayA/global" "net" "os" "strconv" @@ -28,11 +30,17 @@ func GetLocalCIDR() ([]string, error) { } func IsIPv6Supported() bool { + if global.GetEnvironmentConfig().ForceIPV6On { + return true + } + if common.IsInDocker(){ + return false + } b, err := os.ReadFile("/proc/sys/net/ipv6/conf/default/disable_ipv6") if err != nil { return false } - if strings.TrimSpace(string(b)) == "1"{ + if strings.TrimSpace(string(b)) == "1" { return false } return cmds.IsCommandValid("ip6tables") diff --git a/service/global/environmentConfig.go b/service/global/environmentConfig.go index 3c3ce621..41ec5428 100644 --- a/service/global/environmentConfig.go +++ b/service/global/environmentConfig.go @@ -18,9 +18,10 @@ type Params struct { WebDir string `id:"webdir" default:"/etc/v2raya/web" desc:"v2rayA web files directory"` Mode string `id:"mode" short:"m" desc:"(deprecated) Options: systemctl, service, universal. Auto-detect if not set"` PluginListenPort int `short:"s" default:"32346" desc:"ssr, pingTunnel, etc."` + ForceIPV6On bool `id:"force_ipv6_on" desc:"force open ipv6"` PassCheckRoot bool `desc:"Skip privilege checking. Use it only when you cannot start v2raya but confirm you have root privilege"` ResetPassword bool `id:"reset-password"` - Verbose bool `id:"verbose" desc:"Mixedly print the log of v2rayA and v2ray-core"` + Verbose bool `id:"verbose" desc:"Detailed log mixing the log of v2rayA and v2ray-core"` ShowVersion bool `id:"version"` }