rkonfj / peerguard

Another p2p network library in Go 🌍
GNU General Public License v3.0
203 stars 12 forks source link
arq firewall go ipv6 nat p2p vpn

PeerGuard

Another p2p network library in Go. Committed to direct communication between devices.
[简体中文]

Features

Get Started

[!NOTE] Time synchronization between nodes is crucial; the difference should not exceed 5 seconds

p2p vpn

# node1
sudo pgcli vpn -s wss://synf.in/pg --ipv4 100.64.0.1/24 --ipv6 fd00::1/64
# node2
sudo pgcli vpn -s wss://synf.in/pg --ipv4 100.64.0.2/24 --ipv6 fd00::2/64

p2p file sharing

# share
$ PG_SERVER=wss://synf.in/pg pgcli share ~/my-show.pptx
ShareURL: pg://DJX2csRurJ3DvKeh63JebVHFDqVhnFjckdVhToAAiPYf/0/my-show.pptx
# download
$ PG_SERVER=wss://synf.in/pg pgcli download pg://DJX2csRurJ3DvKeh63JebVHFDqVhnFjckdVhToAAiPYf/0/my-show.pptx

Advanced

deploy the peermap server

1. run the pgmap daemon

$ pgmap -l 127.0.0.1:9987 --secret-key 5172554832d76672d1959a5ac63c5ab9 \
    --stun stun.miwifi.com:3478 --stun stunserver.stunprotocol.org:3478

2. wrap pgmap as an https server

$ caddy reverse-proxy --from https://synf.in/pg --to 127.0.0.1:9987

uses pre-shared secret file instead of OIDC auth

first

$ export PG_SECRET_KEY=5172554832d76672d1959a5ac63c5ab9
$ export PG_SERVER=wss://synf.in/pg
$ pgcli admin secret --network "<email>" --duration 24h > psns.json

then

sudo pgcli vpn -s wss://synf.in/pg -4 100.64.0.1/24 -f psns.json

License

GNU General Public License v3.0

Contributing

Contributions welcome! Have an improvement? Submit a pull request.

[!NOTE] I also maintain a closed-source version, and contributions to the open-source project may be included in the closed-source version.