Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit efb71d2

Browse files
authored
[readme]: WIP
1 parent b1117ff commit efb71d2

File tree

3 files changed

+144
-6
lines changed

3 files changed

+144
-6
lines changed

README.md

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This [GitHub CLI](https://cli.github.com/) extension allows to bridge network be
44

55
For instance, if you are using `VPN` to connect to your enterprise network to access a database or any other remote resources on the private network, this extension allows you to get to those resources from whithin a Codespace also, so you can develop fully inside a Codespace!
66

7+
[About GitHub CLI](https://cli.github.com/)
8+
79
## Installation
810

911
```shell
@@ -41,20 +43,71 @@ There are two pannels in the connected view of the extension:
4143
- Panel on the left (`NAT`) shows the network address translation table for currently opened connections. For successful stateful protocols(e.g. `TCP`) the records are cleaned up automatically after connection is closed so teh records will come and go as connection is established and closed. For stateless protocols (e.g. `UDP` or `ICMP`) or unsuccessful `TCP` connections the records are cleaned up after some time, so those will show up in the list for some time.
4244
- Panel on the right (`DNS`) shows the resolved `DNS` records, as `hostname`, `record` and `time-to-live` (or `TTL`) values.
4345

44-
4546
Press `q` or `ctrl + c` to stop the extension.
4647

4748
## How it works
4849

49-
How it works notes.
50+
General diagram is shown below:
51+
52+
<img src="./diagrams/general.png" alt="general schema" />
53+
54+
We bind to the `default gateway` network interface inside the codespace and forward all non-routed traffic to the `SSH tunnel` that connects a Codespace with your local machine. We forward only `L3` (`IP`) traffic and there are few criterias must hold for traffic to be forwarded:
55+
56+
- it must appear on the `default gateway`
57+
- it must not be addressed tosomething that is on default gateway subnet
58+
59+
This ensures that we fallback to forwaring packets only if they were not handled by any other network interface inside a Codespace.
60+
61+
Once a packet reaches the local machine, we see if we can forward it to a meaningful distanation, for that we resolve network interface that can handle the packet destination. Such network interface must not be a default gateway interface given that the packet destination is not to the gateway subnet, otherwise the packet is addressed to internet which can be handled from whithin the codespace directly.
62+
63+
If such network interface is found, we create a local `network socket` and a `NAT` record for the connection. The NAT reord is used to map remote packet source address to the local network socket address, so it appears to the remote resource as if traffic is comming from the local machine. When a reply packet is received, we perform reverse address translation and send the packet back to the codespace (so it appears if reply came directly from the Codespace default gateway interface).
64+
65+
For `DNS` packets, we register an address that is on `default gateway` subnet which allows to catch all unresolved `DNS` queries. Once `DNS` packet received, it is passed over to the `local machine` where request to local `DNS` resolver is made and reply sent back to the Codespace.
5066

5167
## Troubleshooting
5268

5369
Troubleshooting notes.
5470

5571
## Supported platforms
5672

57-
- MacOSx AMD64
58-
- Linux AMD64
59-
60-
[About GitHub CLI](https://cli.github.com/)
73+
| Target platforms | Local | Inside Codespace |
74+
|-------------------------|-------|--------------|
75+
| Mac OSx (Intel) || 🙅 |
76+
| Mac OSx (Apple) | 🏃 | 🙅 |
77+
| Linux (Ubuntu) |||
78+
| Linux (Debian) |||
79+
| Linux (Fedora) |||
80+
| Linux (Red Hat) |||
81+
| Linux (Mint) |||
82+
| Linux (OpenSUSE) |||
83+
| Linux (Centos) |||
84+
| Linux (Kali) |||
85+
| Linux (Raspberry Pi OS) |||
86+
| Windows 10 | 🏃 | 🙅 |
87+
88+
✅ - currently supported 🏃 - support in progress 🙅 - not applicable
89+
90+
### DNS
91+
92+
| DNS Record Type | Status |
93+
|-----------------|--------|
94+
| A ||
95+
| AAAA ||
96+
| CNAME ||
97+
| NS ||
98+
| TXT ||
99+
| SOA ||
100+
| PTR ||
101+
| NULL ||
102+
| MX ||
103+
| ANY ||
104+
105+
## Other GitHub CLI extensions for Codespaces
106+
107+
- [Codespace Compose](https://github.com/github/gh-codespace-compose)
108+
- [About GitHub CLI](https://cli.github.com/)
109+
- [GitHub CLI Docs](https://cli.github.com/manual/gh)
110+
111+
## License
112+
113+
License text.

diagrams/general.drawio

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<mxfile host="65bd71144e">
2+
<diagram id="zo_TgSlkXzDTACk1qIh0" name="Page-1">
3+
<mxGraphModel dx="194" dy="438" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0"/>
6+
<mxCell id="1" parent="0"/>
7+
<mxCell id="5" value="&lt;meta charset=&quot;utf-8&quot;&gt;&lt;div style=&quot;color: rgb(191, 199, 213); background-color: rgb(41, 45, 62); font-family: menlo, monaco, &amp;quot;courier new&amp;quot;, monospace; font-weight: normal; font-size: 12px; line-height: 18px;&quot;&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
8+
<mxGeometry x="200" y="360" width="120" height="120" as="geometry"/>
9+
</mxCell>
10+
<mxCell id="6" value="Local machine" style="text;html=1;strokeColor=none;fillColor=none;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;spacingRight=4;fontStyle=1;fontSize=10;" vertex="1" parent="1">
11+
<mxGeometry x="230" y="450" width="90" height="30" as="geometry"/>
12+
</mxCell>
13+
<mxCell id="7" value="&lt;meta charset=&quot;utf-8&quot;&gt;&lt;div style=&quot;color: rgb(191, 199, 213); background-color: rgb(41, 45, 62); font-family: menlo, monaco, &amp;quot;courier new&amp;quot;, monospace; font-weight: normal; font-size: 12px; line-height: 18px;&quot;&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
14+
<mxGeometry x="500" y="360" width="120" height="120" as="geometry"/>
15+
</mxCell>
16+
<mxCell id="8" value="Codespace" style="text;html=1;strokeColor=none;fillColor=none;align=right;verticalAlign=middle;whiteSpace=wrap;rounded=0;spacingRight=4;fontSize=10;fontStyle=1" vertex="1" parent="1">
17+
<mxGeometry x="530" y="450" width="90" height="30" as="geometry"/>
18+
</mxCell>
19+
<mxCell id="9" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
20+
<mxGeometry x="520" y="400" width="80" height="40" as="geometry"/>
21+
</mxCell>
22+
<mxCell id="10" value="Default Gateway" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
23+
<mxGeometry x="530" y="405" width="60" height="30" as="geometry"/>
24+
</mxCell>
25+
<mxCell id="11" value="" style="endArrow=classic;startArrow=classic;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#F0F0F0;rounded=0;" edge="1" parent="1" source="5" target="7">
26+
<mxGeometry width="50" height="50" relative="1" as="geometry">
27+
<mxPoint x="430" y="400" as="sourcePoint"/>
28+
<mxPoint x="480" y="350" as="targetPoint"/>
29+
</mxGeometry>
30+
</mxCell>
31+
<mxCell id="12" value="SSH Tunnel" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
32+
<mxGeometry x="360" y="390" width="100" height="30" as="geometry"/>
33+
</mxCell>
34+
<mxCell id="14" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
35+
<mxGeometry x="220" y="400" width="80" height="40" as="geometry"/>
36+
</mxCell>
37+
<mxCell id="15" value="DNS Resolver" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
38+
<mxGeometry x="230" y="405" width="60" height="30" as="geometry"/>
39+
</mxCell>
40+
<mxCell id="16" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
41+
<mxGeometry x="220" y="360" width="80" height="40" as="geometry"/>
42+
</mxCell>
43+
<mxCell id="17" value="Network Router" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
44+
<mxGeometry x="230" y="365" width="60" height="30" as="geometry"/>
45+
</mxCell>
46+
<mxCell id="18" value="" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;fillColor=default;" vertex="1" parent="1">
47+
<mxGeometry x="194" y="160" width="120" height="80" as="geometry"/>
48+
</mxCell>
49+
<mxCell id="21" value="" style="endArrow=none;html=1;strokeWidth=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#858585;" edge="1" parent="1" target="7">
50+
<mxGeometry width="50" height="50" relative="1" as="geometry">
51+
<mxPoint x="520" y="420" as="sourcePoint"/>
52+
<mxPoint x="460" y="300" as="targetPoint"/>
53+
<Array as="points"/>
54+
</mxGeometry>
55+
</mxCell>
56+
<mxCell id="22" value="" style="endArrow=none;html=1;strokeWidth=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#858585;" edge="1" parent="1" source="5" target="16">
57+
<mxGeometry width="50" height="50" relative="1" as="geometry">
58+
<mxPoint x="430" y="350" as="sourcePoint"/>
59+
<mxPoint x="480" y="300" as="targetPoint"/>
60+
<Array as="points">
61+
<mxPoint x="310" y="420"/>
62+
<mxPoint x="310" y="380"/>
63+
</Array>
64+
</mxGeometry>
65+
</mxCell>
66+
<mxCell id="24" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;strokeColor=#F0F0F0;strokeWidth=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.55;entryY=0.95;entryDx=0;entryDy=0;entryPerimeter=0;fontColor=#F0F0F0;" edge="1" parent="1" source="16" target="18">
67+
<mxGeometry width="50" height="50" relative="1" as="geometry">
68+
<mxPoint x="420" y="370" as="sourcePoint"/>
69+
<mxPoint x="470" y="320" as="targetPoint"/>
70+
</mxGeometry>
71+
</mxCell>
72+
<mxCell id="25" value="" style="endArrow=none;html=1;strokeWidth=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#858585;" edge="1" parent="1" source="5" target="14">
73+
<mxGeometry width="50" height="50" relative="1" as="geometry">
74+
<mxPoint x="330" y="430" as="sourcePoint"/>
75+
<mxPoint x="310" y="390" as="targetPoint"/>
76+
<Array as="points"/>
77+
</mxGeometry>
78+
</mxCell>
79+
<mxCell id="26" value="Remote resources" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=10;fontStyle=1" vertex="1" parent="1">
80+
<mxGeometry x="227" y="187" width="60" height="30" as="geometry"/>
81+
</mxCell>
82+
</root>
83+
</mxGraphModel>
84+
</diagram>
85+
</mxfile>

diagrams/general.png

26.2 KB
Loading

0 commit comments

Comments
 (0)