feat: add outbound proxy support (socks5/http) for restricted networks

This commit is contained in:
Quorinex
2026-05-11 21:40:45 +08:00
parent 221348b975
commit 404e2425fa
9 changed files with 205 additions and 42 deletions

View File

@@ -108,6 +108,12 @@ type Config struct {
// Endpoint configuration: "auto", "codewhisperer", or "amazonq"
PreferredEndpoint string `json:"preferredEndpoint,omitempty"`
// Proxy configuration: optional outbound proxy for Kiro API requests
// Format: "socks5://host:port", "socks5://user:pass@host:port",
// "http://host:port", "http://user:pass@host:port"
// Leave empty to connect directly.
ProxyURL string `json:"proxyURL,omitempty"`
// Global statistics (persisted across restarts)
TotalRequests int `json:"totalRequests,omitempty"` // Total API requests received
SuccessRequests int `json:"successRequests,omitempty"` // Successful requests count
@@ -445,6 +451,21 @@ func UpdatePreferredEndpoint(endpoint string) error {
return Save()
}
// GetProxyURL 获取出站代理地址
func GetProxyURL() string {
cfgLock.RLock()
defer cfgLock.RUnlock()
return cfg.ProxyURL
}
// UpdateProxySettings 更新出站代理配置
func UpdateProxySettings(proxyURL string) error {
cfgLock.Lock()
defer cfgLock.Unlock()
cfg.ProxyURL = proxyURL
return Save()
}
type KiroClientConfig struct {
KiroVersion string
SystemVersion string