修复版本协商的问题

This commit is contained in:
kony
2025-03-30 10:40:49 +08:00
parent dddc7bbafa
commit b3e907cddd
4 changed files with 20 additions and 21 deletions

View File

@@ -4,5 +4,5 @@ Website = "https://goodlink.kony.vip"
Icon = "theme/favicon.png"
Name = "goodlink-windows-amd64-ui"
ID = "goodlink.kony.vip"
Version = "2.0.0"
Build = 2
Version = "2.0.1"
Build = 0

View File

@@ -24,7 +24,7 @@ var (
)
const (
m_version = "2.0"
m_version = "2.0.1"
)
func Init() error {

View File

@@ -68,6 +68,12 @@ func GetLocalQuicConn(conn *net.UDPConn, addr *tun.AddrType, count int) (*tun.Tu
switch redisJson.State {
case 1:
if redisJson.RemoteVersion != m_version {
utils.Log().DebugF("两端版本不兼容: %v", redisJson)
RedisDel()
return tun_active, tun_passive, nil, nil, errors.New("两端版本不兼容")
}
utils.Log().DebugF("收到对端地址: %v", redisJson.RemoteAddr)
switch conn_type {
@@ -120,10 +126,6 @@ func GetLocalQuicConn(conn *net.UDPConn, addr *tun.AddrType, count int) (*tun.Tu
return tun_active, tun_passive, nil, nil, nil
default:
if redisJson.RemoteVersion != m_version {
utils.Log().DebugF("两端版本不兼容: %v", redisJson)
return tun_active, tun_passive, nil, nil, errors.New("两端版本不兼容")
}
utils.Log().DebugF("等待对端状态: Local: %v => Remote: %v", redisJson.LocalAddr, redisJson.RemoteAddr)
}
}

View File

@@ -37,13 +37,6 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
redisJson.RemoteVersion = m_version
if redisJson.LocalVersion != m_version {
utils.Log().DebugF("两端版本不兼容: %v", redisJson)
RedisSet(redisJson.SocketTimeOut*3, &redisJson)
time.Sleep(3 * time.Second)
return udp_conn, tun_active, tun_passive, nil, nil
}
SessionID := redisJson.SessionID
log.Printf("会话ID: %s", SessionID)
@@ -84,6 +77,14 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
case 0:
utils.Log().DebugF("收到对端请求: %v", redisJson)
redisJson.State = 1
if redisJson.LocalVersion != m_version {
utils.Log().DebugF("两端版本不兼容: %v", redisJson)
RedisSet(redisJson.SocketTimeOut*3, &redisJson)
return udp_conn, tun_active, tun_passive, nil, nil
}
udp_conn, redisJson.RemoteAddr = GetUDPAddr()
switch redisJson.LocalAddr.WanPort1 {
@@ -99,10 +100,7 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
tun_active = tun.CreateTunActive([]byte(redisJson.SessionID), udp_conn, &redisJson.RemoteAddr, &redisJson.LocalAddr, time.Duration(config.Arg_conn_active_send_time)*time.Millisecond)
tun_active_chain = tun_active.GetChain()
redisJson.State = 1
redisJson.SendPortCount = 0x100
utils.Log().DebugF("发送本端地址: %v", redisJson.RemoteAddr)
RedisSet(redisJson.RedisTimeOut, &redisJson)
default:
utils.Log().DebugF("对端有发来IP: %v", redisJson.LocalAddr)
@@ -117,12 +115,11 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
tun_passive.Start()
tun_passive_chain = tun_passive.GetChain()
redisJson.State = 1
utils.Log().DebugF("发送本端地址: %v", redisJson.RemoteAddr)
RedisSet(redisJson.RedisTimeOut, &redisJson)
}
utils.Log().DebugF("发送本端地址: %v", redisJson.RemoteAddr)
RedisSet(redisJson.RedisTimeOut, &redisJson)
case 2:
switch conn_type {
case 0: