optimized heartbeat detection

This commit is contained in:
kony
2025-04-03 18:24:55 +08:00
parent cec4500361
commit 871ea0c812
9 changed files with 54 additions and 17 deletions

31
FyneApp.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
_ "embed"
"log"
"github.com/BurntSushi/toml"
)
//go:embed FyneApp.toml
var FyneAppToml string
type FyneAppConfig struct {
Website string `toml:"Website"`
Details struct {
Icon string `toml:"Icon"`
Name string `toml:"Name"`
ID string `toml:"ID"`
Version string `toml:"Version"`
Build int `toml:"Build"`
} `toml:"Details"`
}
func GetVersion() string {
var config FyneAppConfig
if _, err := toml.Decode(FyneAppToml, &config); err != nil {
log.Fatal(err)
}
return config.Details.Version
}

View File

@@ -4,5 +4,5 @@ Website = "https://goodlink.kony.vip"
Icon = "assert/favicon.ico" Icon = "assert/favicon.ico"
Name = "goodlink-windows-amd64-ui" Name = "goodlink-windows-amd64-ui"
ID = "goodlink.kony.vip" ID = "goodlink.kony.vip"
Version = "2.1.2" Version = "2.1.3"
Build = 0 Build = 0

View File

@@ -12,7 +12,6 @@ GOBUILD=GO111MODULE=on \
-w -s -buildid=' -w -s -buildid='
PLATFORM_LIST = \ PLATFORM_LIST = \
windows-arm64-cmd \
linux-386-cmd \ linux-386-cmd \
linux-amd64-cmd \ linux-amd64-cmd \
linux-arm-cmd \ linux-arm-cmd \
@@ -23,12 +22,15 @@ PLATFORM_LIST = \
linux-mipsle-cmd \ linux-mipsle-cmd \
linux-mips64-cmd \ linux-mips64-cmd \
linux-riscv64-cmd \ linux-riscv64-cmd \
linux-mips64le-cmd linux-mips64le-cmd \
windows-arm64-cmd
NAC_PLATFORM_LIST = \ NAC_PLATFORM_LIST = \
windows-amd64-ui \ windows-amd64-ui \
windows-amd64-cmd \ windows-amd64-cmd \
debug: create_nac windows-amd64-ui rm_nac linux-amd64-cmd strip
all: create_nac $(NAC_PLATFORM_LIST) rm_nac $(PLATFORM_LIST) strip all: create_nac $(NAC_PLATFORM_LIST) rm_nac $(PLATFORM_LIST) strip
linux-386-cmd: linux-386-cmd:

View File

@@ -25,7 +25,7 @@ var (
Arg_conn_passive_send_time int Arg_conn_passive_send_time int
) )
func Help() { func Help(ver string) {
v := flag.Bool("v", false, "查看版本信息") v := flag.Bool("v", false, "查看版本信息")
Arg_stun_test = flag.Bool("stun_test", false, "检测STUN列表是否可用") Arg_stun_test = flag.Bool("stun_test", false, "检测STUN列表是否可用")
@@ -53,6 +53,7 @@ func Help() {
flag.Parse() flag.Parse()
if *v { if *v {
fmt.Printf("Version: %s\n", ver)
fmt.Print(gogo.BuildVersion()) fmt.Print(gogo.BuildVersion())
os.Exit(0) os.Exit(0)
} }

View File

@@ -62,7 +62,9 @@ func main() {
} }
}() }()
config.Help() pro.SetVersion(GetVersion())
config.Help(GetVersion())
if *config.Arg_stun_test { // 测试stun节点开发使用选项 if *config.Arg_stun_test { // 测试stun节点开发使用选项
stun2.TestStun() stun2.TestStun()

View File

@@ -22,11 +22,13 @@ const (
) )
func main() { func main() {
config.Help() pro.SetVersion(GetVersion())
config.Help(GetVersion())
myApp := app.New() myApp := app.New()
myApp.Settings().SetTheme(&theme.MyTheme{}) myApp.Settings().SetTheme(&theme.MyTheme{})
myWindow := myApp.NewWindow(M_APP_TITLE + " v" + pro.GetVersion()) //myApp.Metadata().Version) myWindow := myApp.NewWindow(M_APP_TITLE + " v" + GetVersion()) //myApp.Metadata().Version)
if desk, ok := myApp.(desktop.App); ok { if desk, ok := myApp.(desktop.App); ok {
m := fyne.NewMenu(M_APP_TITLE, m := fyne.NewMenu(M_APP_TITLE,

View File

@@ -1,5 +1,5 @@
make clean make clean
make make all
cd bin cd bin
zip goodlink-linux-amd64-cmd.zip goodlink-linux-amd64-cmd zip goodlink-linux-amd64-cmd.zip goodlink-linux-amd64-cmd
zip goodlink-linux-arm64-cmd.zip goodlink-linux-arm64-cmd zip goodlink-linux-arm64-cmd.zip goodlink-linux-arm64-cmd

View File

@@ -21,10 +21,15 @@ var (
m_redis_db *redis.Client m_redis_db *redis.Client
m_tun_key string m_tun_key string
m_md5_tun_key string m_md5_tun_key string
m_version string
) )
func SetVersion(v string) {
m_version = v
}
func GetVersion() string { func GetVersion() string {
return "2.1.2" return m_version
} }
func Init() error { func Init() error {

View File

@@ -219,7 +219,7 @@ func RunRemote(tun_key string) error {
for m_remote_stats == 1 { for m_remote_stats == 1 {
udp_conn, tun_active, tun_passive, quic_conn, health := GetRemoteQuicConn() udp_conn, tun_active, tun_passive, quic_conn, _ := GetRemoteQuicConn()
if quic_conn == nil { if quic_conn == nil {
Release(tun_active, tun_passive) Release(tun_active, tun_passive)
continue continue
@@ -244,13 +244,7 @@ func RunRemote(tun_key string) error {
wg.Done() wg.Done()
}() }()
wg.Add(1) proxy.ProcessProxyServer(quic_conn2)
go func() {
defer wg.Done()
proxy.ProcessProxyServer(quic_conn2)
}()
tun.ProcessHealth(health)
utils.Log().DebugF("释放连接: %v", quic_conn2.LocalAddr()) utils.Log().DebugF("释放连接: %v", quic_conn2.LocalAddr())
}(tun_active, tun_passive, quic_conn) }(tun_active, tun_passive, quic_conn)
} }