Gh net
A network bridge between a Codespace and a local machine.
🧪 *The extension is currently in the Preview stage, so some hiccups are expected. Please help us to improve [by submitting feedback](https://github.com/github/gh-net#troubleshooting)!* The project is first published in 2022. Key topics include: cli, codespaces, gh-extension, network.
Codespaces Network Bridge
🧪 The extension is currently in the Preview stage, so some hiccups are expected. Please help us to improve by submitting feedback!
<img width="749" alt="image" src="https://user-images.githubusercontent.com/1478800/161617508-b65de564-60f3-46c8-8394-5b28c8ac477b.png">This GitHub CLI extension allows you to bridge the network between a Codespace and your local machine, so the Codespace can reach out to any remote resource that is reachable from your machine. In other words, it uses your local machine as a network gateway to get to those resources.
For instance, if you are using a VPN client to connect to private enterprise network to access a database or any other remote resources, this extension enables you to use those private resources from within a Codespace.
Prerequisites
-
This extension requires GitHub CLI version
v2.8.0and up. Please make sure to upgrade it. -
If using GitHub CLI < 2.13.0 only. The extension relies on
gh codespace sshcommand to establish SSH tunnel to a Codespace. If you use GitHub CLI >=2.13.0 theSSHconfig is created automatically for all your Codespaces, otherwise follow SSH setup instructions. -
If your Codespace uses a non-default image, ensure that both the GitHub CLI,
openssh-server, andsudoare installed inside the codespace. Some distros need ansshgroup too. Please see linux dependencies doc for per-distro instructions.
Installation
shellgh extension install github/gh-net
Usage
To start network forwarding from a Codespace to a local machine, run:
shellgh net
Note: on Windows, you need to use a command prompt launched with Administrator privileges.
Connection issues? Please see https://github.com/github/gh-net/issues/9 and SSH setup doc for some of the known solutions.
The command will first open a Codespace selection dialog:
<img width="749" alt="image" src="https://user-images.githubusercontent.com/1478800/161616184-4cd42419-6d97-440c-bf26-cb713baa7607.png">Select a codespace and press enter. The extension will connect to selected codespace and start forwarding network traffic:
<img width="749" alt="image" src="https://user-images.githubusercontent.com/1478800/161617508-b65de564-60f3-46c8-8394-5b28c8ac477b.png">There are two panels in the connected view of the extension:
- Panel on the left (
NAT) shows the network address translation table for currently opened connections. For stateful protocols(e.g.TCP) the records are cleaned up automatically after a connection is closed, so the records will come and go as connections are established and teardown. For stateless protocols (e.g.UDPorICMP) or unsuccessfulTCPconnections, the records are cleaned up after a delay; hence those may show up in the list for some time. - Panel on the right (
DNS) shows the resolvedDNSrecords, ashostname,record, andtime-to-live(TTL) values.
Press q or ctrl + c to stop the extension.
CLI Options
--gui(-g): Enable/disable GUI mode. [true|false] [default:true]--trace(-t): Specify tracing verbosity. [none|trace|debug|info|warn|error] [default:info]--trace-dest: Specify tracing destination file. [file name] [default:none]--dns(-d): Enable/disable DNS resolution. [true|false] [default:true]--codespace(-c): Codespace name to connect to. [codespace name] [default:none]--telemetry: Enable/disable sending diagnostics telemetry (noPIIdata is sent). [true|false] [default:true]
Run gh net -h for details.
Supported platforms
Mac OSx
| OS | Intel chip | Apple chip |
|---|---|---|
| Big Sur (v11) | <span title="supported">✅</span> | <a href="https://github.com/github/gh-net/issues/22" title="supported">✅ *</a> |
| Monterey (v12) | <span title="supported">✅</span> | <a href="https://github.com/github/gh-net/issues/22" title="supported">✅ *</a> |
Windows
| Architecture | AMD64 |
|---|---|
| Windows 10 | <span title="supported">✅</span> |
| Windows 11 | <span title="supported">✅</span> |
Linux
| Distro | Local | Inside Codespace |
|---|---|---|
| Ubuntu | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Debian | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Fedora | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Red Hat | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Mint | <span title="supported">✅</span> | <span title="supported">✅</span> |
| OpenSUSE | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Centos | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Kali | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Arch | <span title="supported">✅</span> | <span title="supported">✅</span> |
| Alpine | <span title="supported">✅</span> | <a href="https://github.com/github/gh-net/issues/12" title="supported">✅ *</a> |
Supported Linux architectures
| Architecture | Status |
|---|---|
| AMD64 | <span title="supported">✅</span> |
| ARM64 | <span title="supported">✅</span> |
| ARMv6 | <span title="supported">✅</span> |
| ARMv7 | <span title="supported">✅</span> |
Tested VPN Clients
| Name | Status |
|---|---|
| Viscocity | <span title="supported">✅</span> |
| GlobalProtect | <span title="supported">✅</span> |
| NordVPN | <span title="supported">✅</span> |
| Tailscale | <span title="supported">✅</span> |
Legend: ✅ - supported 🏃 - in progress ? - unknown / not tested
For list of supported network protocols refer to this doc.
Troubleshooting
- Something is missing? Please create a ✨ feature request.
- Something is incorrect? Please create a 🐛 bug report.
- For known issues, refer to 👉 this list.
Useful links
Contributors
Showing top 5 contributors by commit count.