This is an easy VPN server example by golang. It support Tun interface only.
+---------------+ +---------------+
| | | |
| | | |
+-------+-------+ +-------^-------+
| |
+-------v-------+ works here +-------+-------+
|Network Layer <---------------+Network Layer |
|Tun Interface +--------------->Tun Interface |
+-------+-------+ +-------^-------+
| |
+-------v-------+ +-------+-------+
|Data Link Layer| |Data Link Layer|
|Tap Interface | |Tap Interface |
+-------+-------+ +-------^-------+
| |
+-------v-------+ +-------+-------+
|Physical Layer | |Physical Layer |
| | | |
+-------+-------+ +-------^-------+
| |
+-------------------------------+
- XVPN:iOS
- XVPN-Android: Android
- macvpn:macOS
Config your vpn.json first.
Enjoy yourself!
Must open ip_forwarding = 1
iptables -t nat -A POSTROUTING -j MASQUERADE