Skip to content

Add SSH keepalive, fix SOCKS5 format bug, implement web GUI#23

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-git-remote-issue
Draft

Add SSH keepalive, fix SOCKS5 format bug, implement web GUI#23
Copilot wants to merge 2 commits intomainfrom
copilot/fix-git-remote-issue

Conversation

Copy link

Copilot AI commented Mar 13, 2026

Git SSH operations (e.g. git remote show origin) fail with "Connection closed by port 22" because HTTP proxy doesn't intercept SSH traffic, and idle SSH tunnels get dropped by firewalls. Adds keepalive to fix tunnel stability and a web GUI to surface SOCKS5 SSH proxy configuration.

Changes

internal/proxy/ssh.go — SSH keepalive

  • Added keepAlive() goroutine sending keepalive@openssh.com every 30s via ssh.Client.SendRequest
  • On timeout (15s), closes the connection and exits cleanly — no goroutine accumulation
  • stopChan chan struct{} added to SSHClient for coordinated shutdown; Close() signals the goroutine before tearing down connections

internal/proxy/socks5.go — Format verb typo

  • Fixed %S%s in Warnf call ([%SOCKS5] was emitting a literal bad verb)

gui/app.go + cmd/gotun-gui/main.go — Web-based control panel

Implements the planned "Tray/GUI frontend" roadmap item. No external dependencies — pure stdlib HTTP server serving a single-page UI.

  • REST API: GET /api/status, POST /api/start, POST /api/stop
  • When SOCKS5 is active, the UI surfaces the ~/.ssh/config snippet required to route git SSH through the proxy:
Host github.com
    ProxyCommand nc -x :1080 %h %p
    ServerAliveInterval 30
    ServerAliveCountMax 3

Alternative commands (ncat, connect-proxy) are also shown for environments where nc lacks SOCKS5 (-x) support.

Makefile

  • build target now produces both gotun and gotun-gui binaries
Original prompt

解释:❯ git remote show origin 🐍 base  11:49:51
Connection closed by 20.205.243.166 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The user has attached the following file paths as relevant context:

  • gui/app.go

创建自 VS Code


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Sesame2 <103378588+Sesame2@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix git remote connection error Add SSH keepalive, fix SOCKS5 format bug, implement web GUI Mar 13, 2026
Copilot AI requested a review from Sesame2 March 13, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants