mirror of
https://github.com/openp2p-cn/openp2p.git
synced 2026-05-07 13:52:14 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a528441342 | ||
|
|
2d6521be43 | ||
|
|
2223634c83 |
32
README-ZH.md
32
README-ZH.md
@@ -5,18 +5,26 @@
|
||||
我们的目标是:充分利用带宽,利用共享节点转发数据,建设一个远程连接的通用基础设施。
|
||||
|
||||
## 为什么选择OpenP2P
|
||||
### 免费
|
||||
### 1. 免费
|
||||
完全免费,满足大部分用户的核心白票需求。不像其它类似的产品,OpenP2P不需要有公网IP的服务器,不需要花钱买服务。了解它原理即可理解为什么能做到免费。
|
||||
### 安全
|
||||
代码开源,接受各位大佬检验。下面详细展开
|
||||
### 轻量
|
||||
### 2. 共享
|
||||
你的设备会形成一个私有P2P网络,它们之间共享带宽,提供网络数据转发服务。
|
||||
当你的私有P2P网络下没有可以提供转发服务的节点时,会尝试在公共P2P网络寻找转发节点。
|
||||
默认会开启共享限速10mbps,只有你用户下提供了共享节点才能使用别人的共享节点。这非常公平,也是这个项目的初衷。
|
||||
我们建议你在带宽足够的地方(比如办公室,家里的百兆光纤)加入共享网络。
|
||||
如果你不想共享任何节点,或设置共享带宽,请查看[详细使用说明](/USAGE-ZH.md)
|
||||
### 3. 安全
|
||||
代码开源,P2P隧道使用TLS1.3+AES双重加密,共享节点临时授权使用TOTP一次性密码
|
||||
|
||||
[查看详细](#安全性)
|
||||
### 4. 轻量
|
||||
文件大小2MB+,运行内存2MB+;全部在应用层实现,没有虚拟网卡,没有内核程序
|
||||
### 跨平台
|
||||
### 5. 跨平台
|
||||
因为轻量,所以很容易支持各个平台。支持主流的操作系统:Windows,Linux,MacOS;和主流的cpu架构:386、amd64、arm、arm64、mipsle、mipsle64、mips、mips64
|
||||
### 高效
|
||||
### 6. 高效
|
||||
P2P直连可以让你的设备跑满带宽。不论你的设备在任何网络环境,无论NAT1-4(Cone或Symmetric),都支持。依靠Quic协议优秀的拥塞算法,能在糟糕的网络环境获得高带宽低延时。
|
||||
|
||||
### 二次开发
|
||||
### 7. 二次开发
|
||||
基于OpenP2P只需数行代码,就能让原来只能局域网通信的程序,变成任何内网都能通信
|
||||
|
||||
## 快速入门
|
||||
@@ -70,18 +78,14 @@ P2P直连可以让你的设备跑满带宽。不论你的设备在任何网络
|
||||
### P2PApp
|
||||
它是项目里最重要的概念,一个P2PApp就是把远程的一个服务(mstsc/ssh等)通过P2P网络映射到本地监听。二次开发或者我们提供的Restful API,主要工作就是管理P2PApp
|
||||

|
||||
## 共享
|
||||
默认会开启共享限速10mbps,只有你用户下提供了共享节点才能使用别人的共享节点。这非常公平,也是这个项目的初衷。
|
||||
我们建议你在带宽足够的地方(比如办公室,家里的百兆光纤)加入共享网络。
|
||||
如果你仍然不想共享任何节点,请查看[详细使用说明](/USAGE-ZH.md)
|
||||
## 安全性
|
||||
加入OpenP2P共享网络的节点,只能凭授权访问。共享节点只会中转数据,别人无法访问内网任何资源。
|
||||
### TLS1.3+AES
|
||||
### 1. TLS1.3+AES
|
||||
两个节点间通信数据走业界最安全的TLS1.3通道。通信内容还会使用AES加密,双重安全,密钥是通过服务端作换。有效阻止中间人攻击
|
||||
### 共享的中转节点是否会获得我的数据
|
||||
### 2. 共享的中转节点是否会获得我的数据
|
||||
没错,中转节点天然就是一个中间人,所以才加上AES加密通信内容保证安全。中转节点是无法获取明文的
|
||||
|
||||
### 中转节点是如何校验权限的
|
||||
### 3. 中转节点是如何校验权限的
|
||||
服务端有个调度模型,根据带宽、ping值、稳定性、服务时长,尽可能地使共享节点均匀地提供服务。连接共享节点使用TOTP密码,hmac-sha256算法校验,它是一次性密码,和我们平时使用的手机验证码或银行密码器一样的原理。
|
||||
|
||||
## 编译
|
||||
|
||||
34
README.md
34
README.md
@@ -4,22 +4,29 @@ Website: [openp2p.cn](https://openp2p.cn)
|
||||
It is an open source, free, and lightweight P2P sharing network. As long as any device joins in, you can access them anywhere. Compared with the BT network used to share files, the OpenP2P network is used to share bandwidth.
|
||||
Our goal is to make full use of bandwidth, use shared nodes to relay data, and build a common infrastructure for remote connections.
|
||||
## Why OpenP2P
|
||||
### Free
|
||||
### 1. Free
|
||||
Totaly free, fullfills most of users(especially free-rider). Unlike other similar products, OpenP2p doesn't need a server with public IP, and doesn't need to pay for services.By understanding its principle, you can understand why it can be done for free.
|
||||
### 2. Share
|
||||
Your devices will form a private P2P network, share bandwidth between them, and provide network data forwarding services.
|
||||
When there is no node that can provide forwarding services in your private P2P network, you will try to find forwarding nodes in the public P2P network.
|
||||
10mbps is its default setting of share speed limit. Only when you have shared their nodes, you are allowed to use others' shared nodes. This is very fair, and it is also the original intention of this project.
|
||||
We recommend that you join a shared network in a place with sufficient bandwidth (such as an office or home with 100M optical fiber).
|
||||
If you are not willing to contribute any node to the OpenP2P share network, please refer to the [usage](/USAGE.md) for your own setting.
|
||||
### 3. Safe
|
||||
The code is open source, the P2P tunnel uses TLS1.3+AES double encryption, and the shared node temporarily authorizes the use of the TOTP one-time password
|
||||
|
||||
[details](#Safety)
|
||||
|
||||
### Safe
|
||||
Open source, trustable(see details below)
|
||||
|
||||
### Lightweight
|
||||
### 4. Lightweight
|
||||
2MB+ filesize, 2MB+ memory. It runs at appllication layer, no vitrual NIC, no kernel driver.
|
||||
|
||||
### Cross-platform
|
||||
### 5. Cross-platform
|
||||
Benefit from lightweight, it easily supports most of major OS, like Windows, Linux, MacOS, also most of CPU architecture, like 386、amd64、arm、arm64、mipsle、mipsle64、mips、mips64.
|
||||
|
||||
### Efficient
|
||||
### 6. Efficient
|
||||
P2P direct connection lets your devices make good use of bandwidth. Your device can be connected in any network environments, even supports NAT1-4 (Cone or Symmetric). Relying on the excellent congestion algorithm of the Quic protocol, high bandwidth and low latency can be obtained in a bad network environment.
|
||||
|
||||
### Integration
|
||||
### 7. Integration
|
||||
Your applicaiton can call OpenP2P with a few code to make any internal networks communicate with each other.
|
||||
|
||||
## Get Started
|
||||
@@ -88,19 +95,16 @@ Especially suitable for large traffic intranet access.
|
||||
P2PAPP is the most import concept in this project, one P2PApp is able to map the remote service(mstsc/ssh) to the local listening. The main job of re-development or restful API we provide is to manage P2PApp.
|
||||
|
||||

|
||||
## Share
|
||||
10mbps is its default setting of share speed limit. Only when your users have shared their nodes, they are allowed to use others' shared nodes. This is very fair, and it is also the original intention of this project.
|
||||
We recommend that you join a shared network in a place with sufficient bandwidth (such as an office or home with 100M optical fiber).
|
||||
If you are still not willing to contribute any node to the OpenP2P share network, please refer to the [usage](/USAGE.md) for your own setting.
|
||||
|
||||
## Safety
|
||||
The nodes which have joined the OpenP2P share network can vist each other by authentications. Shared nodes will only relay data, and others cannot access any resources in the intranet.
|
||||
|
||||
### TLS1.3+AES
|
||||
### 1. TLS1.3+AES
|
||||
The communication data between the two nodes uses the industry's most secure TLS1.3 channel. The communication content will also use AES encryption, double security, the key is exchanged through the server. Effectively prevent man-in-the-middle attacks.
|
||||
|
||||
### Will the shared node capture my data?
|
||||
### 2. Will the shared node capture my data?
|
||||
That's right, the relay node is naturally an man-in-middle, so AES encryption is added to ensure the security of the communication content. The relay node cannot obtain the plaintext.
|
||||
### How does the shared relay node verify the authority?
|
||||
### 3. How does the shared relay node verify the authority?
|
||||
The server side has a scheduling model, which calculate bandwith, ping value,stability and service duration to provide a well-proportioned service to every share node. It uses TOTP(Time-based One-time Password) with hmac-sha256 algorithem, its theory as same as the cellphone validation code or bank cipher coder.
|
||||
|
||||
## Build
|
||||
|
||||
@@ -48,7 +48,10 @@ func (c *Config) add(app AppConfig) {
|
||||
|
||||
func (c *Config) save() {
|
||||
data, _ := json.MarshalIndent(c, "", "")
|
||||
ioutil.WriteFile("config.json", data, 0644)
|
||||
err := ioutil.WriteFile("config.json", data, 0644)
|
||||
if err != nil {
|
||||
gLog.Println(LevelERROR, "save config.json error:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Config) load() error {
|
||||
|
||||
10
daemon.go
10
daemon.go
@@ -148,11 +148,15 @@ func install() {
|
||||
config.SrcPort = *srcPort
|
||||
config.Protocol = *protocol
|
||||
gConf.add(config)
|
||||
os.Chdir(defaultInstallPath)
|
||||
os.MkdirAll(defaultInstallPath, 0775)
|
||||
err := os.Chdir(defaultInstallPath)
|
||||
if err != nil {
|
||||
gLog.Println(LevelERROR, "cd error:", err)
|
||||
}
|
||||
gConf.save()
|
||||
|
||||
// copy files
|
||||
os.MkdirAll(defaultInstallPath, 0775)
|
||||
|
||||
targetPath := filepath.Join(defaultInstallPath, defaultBinName)
|
||||
binPath, _ := os.Executable()
|
||||
src, errFiles := os.Open(binPath) // can not use args[0], on Windows call openp2p is ok(=openp2p.exe)
|
||||
@@ -180,7 +184,7 @@ func install() {
|
||||
|
||||
// args := []string{""}
|
||||
gLog.Println(LevelINFO, "targetPath:", targetPath)
|
||||
err := d.Control("install", targetPath, []string{"-d", "-f"})
|
||||
err = d.Control("install", targetPath, []string{"-d", "-f"})
|
||||
if err != nil {
|
||||
gLog.Println(LevelERROR, "install system service error:", err)
|
||||
} else {
|
||||
|
||||
13
errorcode.go
Normal file
13
errorcode.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// error message
|
||||
var (
|
||||
// ErrorS2S string = "s2s is not supported"
|
||||
// ErrorHandshake string = "handshake error"
|
||||
ErrorS2S = errors.New("s2s is not supported")
|
||||
ErrorHandshake = errors.New("handshake error")
|
||||
)
|
||||
11
protocol.go
11
protocol.go
@@ -4,14 +4,13 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"hash/crc64"
|
||||
"math/big"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
const OpenP2PVersion = "0.97.0"
|
||||
const OpenP2PVersion = "0.97.1"
|
||||
const ProducnName string = "openp2p"
|
||||
|
||||
type openP2PHeader struct {
|
||||
@@ -131,14 +130,6 @@ const (
|
||||
NatTestTimeout = time.Second * 10
|
||||
)
|
||||
|
||||
// error message
|
||||
var (
|
||||
// ErrorS2S string = "s2s is not supported"
|
||||
// ErrorHandshake string = "handshake error"
|
||||
ErrorS2S = errors.New("s2s is not supported")
|
||||
ErrorHandshake = errors.New("handshake error")
|
||||
)
|
||||
|
||||
// NATNone has public ip
|
||||
const (
|
||||
NATNone = 0
|
||||
|
||||
Reference in New Issue
Block a user