返回 DeepSeek-Reasonix
remote_cli_download.go
根目录 / desktop / remote_cli_download.go
1 package main
2
3 import (
4 "context"
5 "time"
6
7 "reasonix/internal/config"
8 "reasonix/internal/netclient"
9 "reasonix/internal/releaseasset"
10 )
11
12 const remoteCLIDownloadTimeout = 2 * time.Minute
13
14 func downloadRemoteCLIBinary(ctx context.Context, version, goos, goarch string) ([]byte, error) {
15 cfg, err := config.Load()
16 if err != nil {
17 return nil, err
18 }
19 client, err := netclient.NewHTTPClient(cfg.NetworkProxySpec(), netclient.TransportOptions{
20 ResponseHeaderTimeout: 30 * time.Second,
21 })
22 if err != nil {
23 return nil, err
24 }
25 client.Timeout = remoteCLIDownloadTimeout
26 return releaseasset.DownloadCLI(ctx, client, version, goos, goarch)
27 }
28
28 lines GO