fix: the problem that docker has no ipv6 by default

This commit is contained in:
mzz2017 committed 2021-04-18 11:35:32 +08:00
1 parent bfccb07158
commit e79eb71877
2 files changed
+11 -2

No files matched your search

+9 -1
View File
@@ -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")
+2 -1
View File
@@ -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"`
}