mirror of
https://github.com/sigcn/pg.git
synced 2025-09-27 01:05:51 +08:00
transfer project to SIGCN organization
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
# PeerGuard
|
||||
|
||||
Another p2p network library in Go. Committed to direct communication between devices.
|
||||
[[简体中文]](https://github.com/rkonfj/peerguard/blob/main/README_zh_CN.md)
|
||||
[[简体中文]](https://github.com/sigcn/pg/blob/main/README_zh_CN.md)
|
||||
## Features
|
||||
- Elegantly simple architecture (pgcli & pgmap & OpenID Connect)
|
||||
- NAT traversal with high success rate (STUN & UPnP & PortScan & BirthdayParadox)
|
||||
- Full support for IPv4/IPv6 dual stack
|
||||
- Easy-to-use library (net.PacketConn)
|
||||
- **Transport layer security (curve25519 & chacha20poly1305 for end-to-end encryption)**
|
||||
- [RDT](https://github.com/rkonfj/peerguard/tree/main/rdt) protocol for reliable data transfer
|
||||
- [RDT](https://github.com/sigcn/pg/tree/main/rdt) protocol for reliable data transfer
|
||||
- Cross-platform compatibility (linux/windows/macOS/iOS/android)
|
||||
|
||||
## Get Started
|
||||
@@ -58,7 +58,7 @@ $ pgcli admin secret --network "<email>" --duration 24h > psns.json
|
||||
sudo pgcli vpn -s wss://synf.in/pg -4 100.64.0.1/24 -f psns.json
|
||||
```
|
||||
## License
|
||||
[GNU General Public License v3.0](https://github.com/rkonfj/peerguard/blob/main/LICENSE)
|
||||
[GNU General Public License v3.0](https://github.com/sigcn/pg/blob/main/LICENSE)
|
||||
|
||||
## Contributing
|
||||
Contributions welcome! Have an improvement? Submit a pull request.
|
||||
|
@@ -7,7 +7,7 @@
|
||||
- 完全的 ipv4/ipv6 双栈支持
|
||||
- 很容易入手的 API (针对开发者)
|
||||
- 端到端加密
|
||||
- 用于可靠数据传输的 [RDT](https://github.com/rkonfj/peerguard/tree/main/rdt) 协议
|
||||
- 用于可靠数据传输的 [RDT](https://github.com/sigcn/pg/tree/main/rdt) 协议
|
||||
- 跨平台
|
||||
|
||||
## 快速开始
|
||||
@@ -44,7 +44,7 @@ $ pgmap -l 127.0.0.1:9987 --secret-key 5172554832d76672d1959a5ac63c5ab9 \
|
||||
--stun stun.miwifi.com:3478 --stun stunserver.stunprotocol.org:3478
|
||||
```
|
||||
>[!NOTE]
|
||||
>`pgmap`支持配置文件([查看所有配置项](https://github.com/rkonfj/peerguard/blob/main/peermap/config.go#L20))。另外,命令行参数会覆盖配置文件参数
|
||||
>`pgmap`支持配置文件([查看所有配置项](https://github.com/sigcn/pg/blob/main/peermap/config.go#L20))。另外,命令行参数会覆盖配置文件参数
|
||||
|
||||
#### 2. 上 https 更安全
|
||||
```sh
|
||||
@@ -62,7 +62,7 @@ $ pgcli admin secret --network "<email>" --duration 24h > psns.json
|
||||
sudo pgcli vpn -s wss://synf.in/pg -4 100.64.0.1/24 -f psns.json
|
||||
```
|
||||
## 许可证
|
||||
[GNU General Public License v3.0](https://github.com/rkonfj/peerguard/blob/main/LICENSE)
|
||||
[GNU General Public License v3.0](https://github.com/sigcn/pg/blob/main/LICENSE)
|
||||
|
||||
## 参与贡献
|
||||
非常欢迎参与项目的开发,如果有任何改善本项目的意图,请立即提交 PR
|
||||
|
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"reflect"
|
||||
|
||||
"github.com/rkonfj/peerguard/peermap/exporter"
|
||||
"github.com/sigcn/pg/peermap/exporter"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/rkonfj/peerguard/peermap/exporter"
|
||||
"github.com/sigcn/pg/peermap/exporter"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/rkonfj/peerguard/peermap/exporter"
|
||||
"github.com/sigcn/pg/peermap/exporter"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -5,8 +5,8 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/peermap/auth"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/peermap/auth"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -3,7 +3,7 @@ package curve25519
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rkonfj/peerguard/secure"
|
||||
"github.com/sigcn/pg/secure"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -13,8 +13,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/fileshare"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
"github.com/sigcn/pg/fileshare"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -4,11 +4,11 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/rkonfj/peerguard/cmd/pgcli/admin"
|
||||
"github.com/rkonfj/peerguard/cmd/pgcli/curve25519"
|
||||
"github.com/rkonfj/peerguard/cmd/pgcli/download"
|
||||
"github.com/rkonfj/peerguard/cmd/pgcli/share"
|
||||
"github.com/rkonfj/peerguard/cmd/pgcli/vpn"
|
||||
"github.com/sigcn/pg/cmd/pgcli/admin"
|
||||
"github.com/sigcn/pg/cmd/pgcli/curve25519"
|
||||
"github.com/sigcn/pg/cmd/pgcli/download"
|
||||
"github.com/sigcn/pg/cmd/pgcli/share"
|
||||
"github.com/sigcn/pg/cmd/pgcli/vpn"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -10,8 +10,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/fileshare"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
"github.com/sigcn/pg/fileshare"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -18,12 +18,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/mdp/qrterminal/v3"
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/disco/tp"
|
||||
"github.com/rkonfj/peerguard/p2p"
|
||||
"github.com/rkonfj/peerguard/peermap/network"
|
||||
"github.com/rkonfj/peerguard/vpn"
|
||||
"github.com/rkonfj/peerguard/vpn/iface"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/disco/tp"
|
||||
"github.com/sigcn/pg/p2p"
|
||||
"github.com/sigcn/pg/peermap/network"
|
||||
"github.com/sigcn/pg/vpn"
|
||||
"github.com/sigcn/pg/vpn/iface"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/rkonfj/peerguard/peermap"
|
||||
"github.com/sigcn/pg/peermap"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
N "github.com/rkonfj/peerguard/net"
|
||||
N "github.com/sigcn/pg/net"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@@ -11,7 +11,7 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/rkonfj/peerguard/connmux"
|
||||
"github.com/sigcn/pg/connmux"
|
||||
)
|
||||
|
||||
type rwc struct {
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
"net/url"
|
||||
"slices"
|
||||
|
||||
"github.com/rkonfj/peerguard/secure"
|
||||
"github.com/sigcn/pg/secure"
|
||||
)
|
||||
|
||||
type ControlCode uint8
|
||||
|
@@ -15,8 +15,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/upnp"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/upnp"
|
||||
"golang.org/x/time/rate"
|
||||
"tailscale.com/net/stun"
|
||||
)
|
||||
|
@@ -17,7 +17,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
|
@@ -7,8 +7,8 @@ import (
|
||||
"net"
|
||||
"net/url"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/p2p"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/p2p"
|
||||
)
|
||||
|
||||
type PublicNetwork struct {
|
||||
|
@@ -13,8 +13,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/rdt"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/rdt"
|
||||
)
|
||||
|
||||
type FileHandle struct {
|
||||
|
@@ -17,8 +17,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/rdt"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/rdt"
|
||||
)
|
||||
|
||||
type FileManager struct {
|
||||
|
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module github.com/rkonfj/peerguard
|
||||
module github.com/sigcn/pg
|
||||
|
||||
go 1.22
|
||||
|
||||
|
@@ -5,9 +5,9 @@ import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/secure"
|
||||
"github.com/rkonfj/peerguard/secure/chacha20poly1305"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/secure"
|
||||
"github.com/sigcn/pg/secure/chacha20poly1305"
|
||||
)
|
||||
|
||||
var defaultSymmAlgo func(secure.ProvideSecretKey) secure.SymmAlgo = chacha20poly1305.New
|
||||
|
10
p2p/conn.go
10
p2p/conn.go
@@ -11,11 +11,11 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/disco/tp"
|
||||
"github.com/rkonfj/peerguard/lru"
|
||||
N "github.com/rkonfj/peerguard/net"
|
||||
"github.com/rkonfj/peerguard/netlink"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/disco/tp"
|
||||
"github.com/sigcn/pg/lru"
|
||||
N "github.com/sigcn/pg/net"
|
||||
"github.com/sigcn/pg/netlink"
|
||||
"storj.io/common/base58"
|
||||
)
|
||||
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/secure/aescbc"
|
||||
"github.com/sigcn/pg/secure/aescbc"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/peermap/oidc"
|
||||
"github.com/sigcn/pg/peermap/oidc"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
|
@@ -7,8 +7,8 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/secure"
|
||||
"github.com/rkonfj/peerguard/secure/aescbc"
|
||||
"github.com/sigcn/pg/secure"
|
||||
"github.com/sigcn/pg/secure/aescbc"
|
||||
)
|
||||
|
||||
type Authenticator struct {
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/peermap/exporter/auth"
|
||||
"github.com/sigcn/pg/peermap/exporter/auth"
|
||||
)
|
||||
|
||||
type peermapTransport struct {
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"storj.io/common/base58"
|
||||
)
|
||||
|
||||
|
@@ -11,7 +11,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/sigcn/pg/disco"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@@ -20,11 +20,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/rkonfj/peerguard/disco"
|
||||
"github.com/rkonfj/peerguard/peermap/auth"
|
||||
"github.com/rkonfj/peerguard/peermap/exporter"
|
||||
exporterauth "github.com/rkonfj/peerguard/peermap/exporter/auth"
|
||||
"github.com/rkonfj/peerguard/peermap/oidc"
|
||||
"github.com/sigcn/pg/disco"
|
||||
"github.com/sigcn/pg/peermap/auth"
|
||||
"github.com/sigcn/pg/peermap/exporter"
|
||||
exporterauth "github.com/sigcn/pg/peermap/exporter/auth"
|
||||
"github.com/sigcn/pg/peermap/oidc"
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
N "github.com/rkonfj/peerguard/net"
|
||||
N "github.com/sigcn/pg/net"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@@ -10,8 +10,8 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/rkonfj/peerguard/lru"
|
||||
"github.com/rkonfj/peerguard/secure"
|
||||
"github.com/sigcn/pg/lru"
|
||||
"github.com/sigcn/pg/secure"
|
||||
)
|
||||
|
||||
func PKCS7Padding(data []byte, blockSize int) []byte {
|
||||
|
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
|
||||
"github.com/rkonfj/peerguard/lru"
|
||||
"github.com/rkonfj/peerguard/secure"
|
||||
"github.com/sigcn/pg/lru"
|
||||
"github.com/sigcn/pg/secure"
|
||||
)
|
||||
|
||||
var _ secure.SymmAlgo = (*Chacha20Poly1305)(nil)
|
||||
|
@@ -7,8 +7,8 @@ import (
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
"github.com/rkonfj/peerguard/lru"
|
||||
"github.com/rkonfj/peerguard/netlink"
|
||||
"github.com/sigcn/pg/lru"
|
||||
"github.com/sigcn/pg/netlink"
|
||||
"golang.zx2c4.com/wireguard/tun"
|
||||
)
|
||||
|
||||
|
@@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/rkonfj/peerguard/lru"
|
||||
"github.com/sigcn/pg/lru"
|
||||
"golang.org/x/sys/unix"
|
||||
"golang.zx2c4.com/wireguard/tun"
|
||||
)
|
||||
|
@@ -10,8 +10,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/rkonfj/peerguard/netlink"
|
||||
"github.com/rkonfj/peerguard/vpn/iface"
|
||||
"github.com/sigcn/pg/netlink"
|
||||
"github.com/sigcn/pg/vpn/iface"
|
||||
"golang.org/x/net/ipv4"
|
||||
"golang.org/x/net/ipv6"
|
||||
"golang.zx2c4.com/wireguard/tun"
|
||||
|
Reference in New Issue
Block a user