Release 1.2.0 Windows amd64 with Hysteria 2

This commit is contained in:
Navis
2026-07-28 07:14:52 +03:00
parent 5d968dc0e3
commit 7eaf53f7c2
22 changed files with 801 additions and 75 deletions
+35 -9
View File
@@ -23,6 +23,7 @@ import (
"vpnclient/internal/config"
"vpnclient/internal/core"
"vpnclient/internal/netcheck"
"vpnclient/internal/protocols/hysteria2"
"vpnclient/internal/protocols/naive"
"vpnclient/internal/update"
)
@@ -93,10 +94,7 @@ func main() {
_ = os.MkdirAll(dataPath, 0o755)
go func() {
if _, err := naive.ResolveBinary(mgr.BinDir()); err == nil {
return
}
_, _ = naive.EnsureBinary(mgr.BinDir())
_, _ = mgr.EnsureAllCores()
}()
w := webview2.NewWithOptions(webview2.WebViewOptions{
@@ -160,7 +158,22 @@ func (a *app) getState() (uiState, error) {
proxy = p.Proxy
active = p.Name
}
corePath, coreErr := naive.ResolveBinary(a.mgr.BinDir())
corePath := ""
coreReady := false
if p, err := cfg.ActiveProfile(); err == nil {
switch p.Protocol {
case config.ProtocolHysteria2:
if path, err := hysteria2.ResolveBinary(a.mgr.BinDir()); err == nil {
corePath, coreReady = path, true
}
default:
if path, err := naive.ResolveBinary(a.mgr.BinDir()); err == nil {
corePath, coreReady = path, true
}
}
} else if path, err := naive.ResolveBinary(a.mgr.BinDir()); err == nil {
corePath, coreReady = path, true
}
out := uiState{
Connected: st.Connected,
Profile: st.Profile,
@@ -170,7 +183,7 @@ func (a *app) getState() (uiState, error) {
SOCKSProxy: st.SOCKSProxy,
SystemProxy: cfg.SystemProxy,
Proxy: proxy,
CoreReady: coreErr == nil,
CoreReady: coreReady,
CorePath: corePath,
ConfigPath: a.cfgPath,
Profiles: cfg.ListProfiles(),
@@ -178,6 +191,11 @@ func (a *app) getState() (uiState, error) {
Update: a.updateStatus,
Pings: append([]netcheck.Result(nil), a.pings...),
}
if out.Protocol == "" {
if p, err := cfg.ActiveProfile(); err == nil {
out.Protocol = string(p.Protocol)
}
}
if st.Connected {
out.SystemProxy = st.SystemProxy
}
@@ -228,7 +246,7 @@ func (a *app) connect() error {
return fmt.Errorf("сначала вставьте ссылку сервера")
}
if _, err := naive.EnsureBinary(a.mgr.BinDir()); err != nil {
if _, err := a.mgr.EnsureCore(""); err != nil {
return err
}
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
@@ -245,7 +263,15 @@ func (a *app) disconnect() error {
func (a *app) installCore() (string, error) {
a.mu.Lock()
defer a.mu.Unlock()
return naive.EnsureBinary(a.mgr.BinDir())
paths, err := a.mgr.EnsureAllCores()
if err != nil {
return "", err
}
parts := make([]string, 0, len(paths))
for k, v := range paths {
parts = append(parts, k+": "+v)
}
return strings.Join(parts, " | "), nil
}
func (a *app) pingServers() ([]netcheck.Result, error) {
@@ -263,7 +289,7 @@ func (a *app) pingServers() ([]netcheck.Result, error) {
out = append(out, netcheck.Result{Name: p.Name, Error: "нет ссылки сервера"})
continue
}
out = append(out, netcheck.PingProxyURI(ctx, p.Name, proxy))
out = append(out, netcheck.PingProfile(ctx, p.Name, config.Protocol(p.Protocol), proxy))
}
a.mu.Lock()