support ipv6

This commit is contained in:
TenderIronh
2022-05-15 13:08:56 +08:00
parent b2d35c6f97
commit 532d3667ce
13 changed files with 131 additions and 78 deletions
+11 -1
View File
@@ -38,6 +38,7 @@ type AppConfig struct {
shareBandwidth int
errMsg string
connectTime time.Time
fromToken uint64
}
// TODO: add loglevel, maxlogfilesize
@@ -148,7 +149,6 @@ type NetworkConfig struct {
Node string
User string
localIP string
ipv6 string
mac string
os string
publicIP string
@@ -253,3 +253,13 @@ func parseParams(subCommand string) {
// gConf.mtx.Unlock()
gConf.save()
}
func (conf *AppConfig) isSupportTCP(pnConf NetworkConfig) bool {
if conf.peerVersion == "" || compareVersion(conf.peerVersion, LeastSupportTCPVersion) == LESS {
return false
}
if pnConf.hasIPv4 == 1 || pnConf.hasUPNPorNATPMP == 1 || conf.hasIPv4 == 1 || conf.hasUPNPorNATPMP == 1 || (IsIPv6(pnConf.IPv6) && IsIPv6(conf.IPv6)) {
return true
}
return false
}