chore: 更新Makefile以支持多平台构建并优化README文档
Some checks are pending
Docker CI / build-oci-images (map[arch:linux/amd64,linux/arm/v7,linux/386,linux/s390x file:Dockerfile id:weron-linux-amd64 image:ghcr.io/pojntfx/weron runner:ubuntu-latest src:.]) (push) Waiting to run
Docker CI / build-oci-images (map[arch:linux/arm64/v8 file:Dockerfile id:weron-linux-arm64-v8 image:ghcr.io/pojntfx/weron runner:ubicloud-standard-4-arm src:.]) (push) Waiting to run
Docker CI / merge-oci-images (map[idprefix:weron-linux- image:ghcr.io/pojntfx/weron]) (push) Blocked by required conditions
hydrun CI / build-linux (map[cmd:./Hydrunfile go weron dst:out/* flags:-e '-v /tmp/ccache:/root/.cache/go-build --privileged -v /var/run/docker.sock:/var/run/docker.sock --net host' id:go.weron os:golang:bookworm runner:ubuntu-latest src:.]) (push) Waiting to run
hydrun CI / build-linux (map[cmd:GOFLAGS="-short" ./Hydrunfile test dst:out/nonexistent flags:-e '-v /tmp/ccache:/root/.cache/go-build --privileged -v /var/run/docker.sock:/var/run/docker.sock --net host' id:test os:golang:bookworm runner:ubuntu-latest src:.]) (push) Waiting to run
hydrun CI / publish-linux (push) Blocked by required conditions
Some checks are pending
Docker CI / build-oci-images (map[arch:linux/amd64,linux/arm/v7,linux/386,linux/s390x file:Dockerfile id:weron-linux-amd64 image:ghcr.io/pojntfx/weron runner:ubuntu-latest src:.]) (push) Waiting to run
Docker CI / build-oci-images (map[arch:linux/arm64/v8 file:Dockerfile id:weron-linux-arm64-v8 image:ghcr.io/pojntfx/weron runner:ubicloud-standard-4-arm src:.]) (push) Waiting to run
Docker CI / merge-oci-images (map[idprefix:weron-linux- image:ghcr.io/pojntfx/weron]) (push) Blocked by required conditions
hydrun CI / build-linux (map[cmd:./Hydrunfile go weron dst:out/* flags:-e '-v /tmp/ccache:/root/.cache/go-build --privileged -v /var/run/docker.sock:/var/run/docker.sock --net host' id:go.weron os:golang:bookworm runner:ubuntu-latest src:.]) (push) Waiting to run
hydrun CI / build-linux (map[cmd:GOFLAGS="-short" ./Hydrunfile test dst:out/nonexistent flags:-e '-v /tmp/ccache:/root/.cache/go-build --privileged -v /var/run/docker.sock:/var/run/docker.sock --net host' id:test os:golang:bookworm runner:ubuntu-latest src:.]) (push) Waiting to run
hydrun CI / publish-linux (push) Blocked by required conditions
- 在Makefile中添加了针对Linux、macOS和Windows的多架构构建目标 - 移除不再使用的Docker命令和数据库相关的清理操作 - 更新README文档,翻译并优化了内容以提高可读性 - 删除了不再需要的数据库文件weron_communities.db
This commit is contained in:
44
Makefile
44
Makefile
@@ -17,6 +17,35 @@ else
|
||||
go build -o $(OUTPUT_DIR)/$(subst build/,,$@) ./cmd/$(subst build/,,$@)
|
||||
endif
|
||||
|
||||
# 构建所有常用架构
|
||||
build-all: build-linux build-darwin build-windows
|
||||
|
||||
# Linux架构 (amd64, arm64, arm, 386)
|
||||
build-linux:
|
||||
@echo "编译Linux架构版本..."
|
||||
@mkdir -p $(OUTPUT_DIR)/linux
|
||||
GOOS=linux GOARCH=amd64 go build -o $(OUTPUT_DIR)/linux/$(obj).linux-amd64 ./cmd/$(obj)
|
||||
GOOS=linux GOARCH=arm64 go build -o $(OUTPUT_DIR)/linux/$(obj).linux-arm64 ./cmd/$(obj)
|
||||
GOOS=linux GOARCH=arm go build -o $(OUTPUT_DIR)/linux/$(obj).linux-arm ./cmd/$(obj)
|
||||
GOOS=linux GOARCH=386 go build -o $(OUTPUT_DIR)/linux/$(obj).linux-386 ./cmd/$(obj)
|
||||
@echo "Linux架构版本编译完成"
|
||||
|
||||
# macOS架构 (amd64, arm64)
|
||||
build-darwin:
|
||||
@echo "编译macOS架构版本..."
|
||||
@mkdir -p $(OUTPUT_DIR)/darwin
|
||||
GOOS=darwin GOARCH=amd64 go build -o $(OUTPUT_DIR)/darwin/$(obj).darwin-amd64 ./cmd/$(obj)
|
||||
GOOS=darwin GOARCH=arm64 go build -o $(OUTPUT_DIR)/darwin/$(obj).darwin-arm64 ./cmd/$(obj)
|
||||
@echo "macOS架构版本编译完成"
|
||||
|
||||
# Windows架构 (amd64, 386)
|
||||
build-windows:
|
||||
@echo "编译Windows架构版本..."
|
||||
@mkdir -p $(OUTPUT_DIR)/windows
|
||||
GOOS=windows GOARCH=amd64 go build -o $(OUTPUT_DIR)/windows/$(obj).windows-amd64.exe ./cmd/$(obj)
|
||||
GOOS=windows GOARCH=386 go build -o $(OUTPUT_DIR)/windows/$(obj).windows-386.exe ./cmd/$(obj)
|
||||
@echo "Windows架构版本编译完成"
|
||||
|
||||
# Install
|
||||
install: $(addprefix install/,$(obj))
|
||||
$(addprefix install/,$(obj)):
|
||||
@@ -41,20 +70,15 @@ benchmark:
|
||||
|
||||
# Clean
|
||||
clean:
|
||||
rm -rf out internal/db
|
||||
docker rm -f weron-postgres weron-redis
|
||||
rm -rf out
|
||||
|
||||
# 列出所有构建的二进制文件
|
||||
list-binaries:
|
||||
@find $(OUTPUT_DIR) -type f -name "$(obj).*" | sort
|
||||
|
||||
# Dependencies
|
||||
depend:
|
||||
docker rm -f weron-postgres || true
|
||||
docker run -d --name weron-postgres -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=weron_communities postgres
|
||||
docker exec weron-postgres bash -c 'until pg_isready; do sleep 1; done'
|
||||
go install github.com/rubenv/sql-migrate/sql-migrate@latest
|
||||
go install github.com/volatiletech/sqlboiler/v4@latest
|
||||
go install github.com/jteeuwen/go-bindata/go-bindata@latest
|
||||
go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest
|
||||
sql-migrate up -env="psql" -config configs/sql-migrate/communities.yaml
|
||||
go generate ./internal/persisters/psql/...
|
||||
|
||||
docker-down: ## Stop database for tests
|
||||
docker rm -f weron-postgres || true
|
||||
|
430
README.md
430
README.md
@@ -1,8 +1,6 @@
|
||||
<img alt="Project icon" style="vertical-align: middle;" src="./docs/icon.svg" width="128" height="128" align="left">
|
||||
|
||||
# weron
|
||||
|
||||
Overlay networks based on WebRTC.
|
||||
基于WebRTC的覆盖网络。
|
||||
|
||||
<br/>
|
||||
|
||||
@@ -13,77 +11,77 @@ Overlay networks based on WebRTC.
|
||||
[](https://pojntfx.github.io/weron)
|
||||
[](https://matrix.to/#/#weron:matrix.org?via=matrix.org)
|
||||
|
||||
## Overview
|
||||
## 概述
|
||||
|
||||
weron provides lean, fast & secure overlay networks based on WebRTC.
|
||||
weron提供基于WebRTC的精简、快速且安全的覆盖网络。
|
||||
|
||||
It enables you to:
|
||||
它使您能够:
|
||||
|
||||
- **Access nodes behind NAT**: Because weron uses WebRTC to establish connections between nodes, it can easily traverse corporate firewalls and NATs using STUN, or even use a TURN server to tunnel traffic. This can be very useful to for example SSH into your homelab without forwarding any ports on your router.
|
||||
- **Secure your home network**: Due to the relatively low overhead of WebRTC in low-latency networks, weron can be used to secure traffic between nodes in a LAN without a significant performance hit.
|
||||
- **Join local nodes into a cloud network**: If you run for example a Kubernetes cluster with nodes based on cloud instances but also want to join your on-prem nodes into it, you can use weron to create a trusted network.
|
||||
- **Bypass censorship**: The underlying WebRTC suite, which is what popular videoconferencing tools such as Zoom, Teams and Meet are built on, is hard to block on a network level, making it a valuable addition to your toolbox for bypassing state or corporate censorship.
|
||||
- **Write your own peer-to-peer protocols**: The simple API makes writing distributed applications with automatic reconnects, multiple datachannels etc. easy.
|
||||
- **访问NAT后面的节点**:由于weron使用WebRTC建立节点之间的连接,它可以通过STUN轻松穿越企业防火墙和NAT,甚至可以使用TURN服务器隧道传输流量。这对于例如无需在路由器上转发任何端口就能SSH进入家庭实验室非常有用。
|
||||
- **保护您的家庭网络**:由于WebRTC在低延迟网络中的相对较低开销,weron可用于保护LAN中节点之间的流量,而不会显著影响性能。
|
||||
- **将本地节点加入云网络**:如果您运行的例如Kubernetes集群的节点基于云实例,但同时也想将您的本地节点加入其中,您可以使用weron创建一个可信网络。
|
||||
- **绕过审查**:底层的WebRTC套件,即流行的视频会议工具如Zoom、Teams和Meet所基于的技术,在网络层面很难被阻止,使其成为绕过国家或企业审查的有价值工具。
|
||||
- **编写您自己的点对点协议**:简单的API使编写具有自动重连、多数据通道等功能的分布式应用变得容易。
|
||||
|
||||
## Installation
|
||||
## 安装
|
||||
|
||||
### Library
|
||||
### 库
|
||||
|
||||
You can add weron to your Go project by running the following:
|
||||
您可以通过运行以下命令将weron添加到您的Go项目中:
|
||||
|
||||
```shell
|
||||
$ go get github.com/pojntfx/weron/...@latest
|
||||
```
|
||||
|
||||
### Containerized
|
||||
### 容器化
|
||||
|
||||
You can get the OCI image like so:
|
||||
您可以按照以下方式获取OCI镜像:
|
||||
|
||||
```shell
|
||||
$ podman pull ghcr.io/pojntfx/weron
|
||||
```
|
||||
|
||||
### Natively
|
||||
### 本机安装
|
||||
|
||||
Static binaries are available on [GitHub releases](https://github.com/pojntfx/weron/releases).
|
||||
静态二进制文件可在[GitHub发布页](https://github.com/pojntfx/weron/releases)获取。
|
||||
|
||||
On Linux, you can install them like so:
|
||||
在Linux上,您可以按照如下方式安装:
|
||||
|
||||
```shell
|
||||
$ curl -L -o /tmp/weron "https://github.com/pojntfx/weron/releases/latest/download/weron.linux-$(uname -m)"
|
||||
$ sudo install /tmp/weron /usr/local/bin
|
||||
$ sudo setcap cap_net_admin+ep /usr/local/bin/weron # This allows rootless execution
|
||||
$ sudo setcap cap_net_admin+ep /usr/local/bin/weron # 这允许无需root权限执行
|
||||
```
|
||||
|
||||
On macOS, you can use the following:
|
||||
在macOS上,您可以使用以下命令:
|
||||
|
||||
```shell
|
||||
$ curl -L -o /tmp/weron "https://github.com/pojntfx/weron/releases/latest/download/weron.darwin-$(uname -m)"
|
||||
$ sudo install /tmp/weron /usr/local/bin
|
||||
```
|
||||
|
||||
On Windows, the following should work (using PowerShell as administrator):
|
||||
在Windows上,以下命令应该可行(以管理员身份使用PowerShell):
|
||||
|
||||
```shell
|
||||
PS> Invoke-WebRequest https://github.com/pojntfx/weron/releases/latest/download/weron.windows-x86_64.exe -OutFile \Windows\System32\weron.exe
|
||||
```
|
||||
|
||||
You can find binaries for more operating systems and architectures on [GitHub releases](https://github.com/pojntfx/weron/releases).
|
||||
您可以在[GitHub发布页](https://github.com/pojntfx/weron/releases)找到更多操作系统和架构的二进制文件。
|
||||
|
||||
## Tutorial
|
||||
## 教程
|
||||
|
||||
> TL;DR: Join a layer 3 (IP) overlay network on the hosted signaling server with `sudo weron vpn ip --community mycommunity --password mypassword --key mykey --ips 2001:db8::1/32,192.0.2.1/24` and a layer 2 (Ethernet) overlay network with `sudo weron vpn ethernet --community mycommunity --password mypassword --key mykey`
|
||||
> 简而言之:使用 `sudo weron vpn ip --community mycommunity --password mypassword --key mykey --ips 2001:db8::1/32,192.0.2.1/24` 加入托管信令服务器上的第3层(IP)覆盖网络,使用 `sudo weron vpn ethernet --community mycommunity --password mypassword --key mykey` 加入第2层(以太网)覆盖网络
|
||||
|
||||
### 1. Start a Signaling Server with `weron signaler`
|
||||
### 1. 使用 `weron signaler` 启动信令服务器
|
||||
|
||||
The signaling server connects peers with each other by exchanging connection information between them. It also manages access to communities through the `--password` flag of clients and can maintain persistent communities even after all peers have disconnected.
|
||||
信令服务器通过在节点之间交换连接信息来将它们相互连接。它还通过客户端的 `--password` 标志管理对社区的访问,并且可以在所有节点断开连接后维护持久性社区。
|
||||
|
||||
While it is possible and reasonably private (in addition to TLS, connection information is encrypted using the `--key` flag of clients) to use the hosted signaling server at `wss://weron.up.railway.app/`, hosting it yourself has many benefits, such as lower latency and even better privacy.
|
||||
虽然使用托管信令服务器 `wss://weron.up.railway.app/` 是可行且相对私密的(除了TLS,连接信息还使用客户端的 `--key` 标志进行加密),但自行托管有许多好处,例如更低的延迟和更好的隐私。
|
||||
|
||||
The signaling server can use an in-process broker with an in-memory database or SQLite/PostgreSQL; for production use PostgreSQL is strongly recommended, as it allows you to easily scale the signaling server horizontally. This is particularly important if you want to scale horizontally.
|
||||
信令服务器可以使用具有内存数据库或SQLite/PostgreSQL的进程内代理;对于生产使用,强烈推荐PostgreSQL,因为它允许您轻松水平扩展信令服务器。如果您想水平扩展,这一点尤为重要。
|
||||
|
||||
<details>
|
||||
<summary>Expand containerized instructions</summary>
|
||||
<summary>展开容器化安装说明</summary>
|
||||
|
||||
```shell
|
||||
$ sudo podman network create weron
|
||||
@@ -106,7 +104,7 @@ $ sudo firewall-cmd --reload
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Expand native instructions</summary>
|
||||
<summary>展开本机安装说明</summary>
|
||||
|
||||
```shell
|
||||
sudo podman run -d --restart=always --label "io.containers.autoupdate=image" --name weron-postgres -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=weron_communities -p 127.0.0.1:5432:5432 postgres
|
||||
@@ -126,41 +124,41 @@ sudo firewall-cmd --reload
|
||||
|
||||
</details>
|
||||
|
||||
It should now be reachable on `ws://localhost:1337/`.
|
||||
现在应该可以在 `ws://localhost:1337/` 上访问它了。
|
||||
|
||||
To use it in production, put this signaling server behind a TLS-enabled reverse proxy such as [Caddy](https://caddyserver.com/) or [Traefik](https://traefik.io/). You may also either want to keep `API_PASSWORD` empty to disable the management API completely or use OpenID Connect to authenticate instead; for more information, see the [signaling server reference](#signaling-server). You can also embed the signaling server in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcsgl).
|
||||
要在生产环境中使用,请将此信令服务器放在启用TLS的反向代理(如[Caddy](https://caddyserver.com/)或[Traefik](https://traefik.io/))后面。您可能还希望保持 `API_PASSWORD` 为空以完全禁用管理API,或使用OpenID Connect进行身份验证;有关更多信息,请参阅[信令服务器参考](#信令服务器)。您还可以使用其[Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcsgl)将信令服务器嵌入到您自己的应用程序中。
|
||||
|
||||
### 2. Manage Communities with `weron manager`
|
||||
### 2. 使用 `weron manager` 管理社区
|
||||
|
||||
While it is possible to create ephemeral communities on a signaling server without any kind of authorization, you probably want to create a persistent community for most applications. Ephemeral communities get created and deleted automatically as clients join or leave, persistent communities will never get deleted automatically. You can manage these communities using the manager CLI.
|
||||
虽然可以在信令服务器上创建不需要任何授权的临时社区,但对于大多数应用程序,您可能希望创建一个持久性社区。临时社区会随着客户端的加入或离开而自动创建和删除,而持久性社区则永远不会自动删除。您可以使用管理器CLI管理这些社区。
|
||||
|
||||
If you want to work on your self-hosted signaling server, first set the remote address:
|
||||
如果您想在自托管的信令服务器上工作,首先设置远程地址:
|
||||
|
||||
```shell
|
||||
$ export WERON_RADDR='http://localhost:1337/'
|
||||
```
|
||||
|
||||
Next, set the API password using the `API_PASSWORD` env variable:
|
||||
接下来,使用 `API_PASSWORD` 环境变量设置API密码:
|
||||
|
||||
```shell
|
||||
$ export API_PASSWORD='myapipassword'
|
||||
```
|
||||
|
||||
If you use OIDC to authenticate, you can instead set the API password using [goit](https://github.com/pojntfx/goit) like so:
|
||||
如果您使用OIDC进行身份验证,可以使用[goit](https://github.com/pojntfx/goit)来设置API密码:
|
||||
|
||||
```shell
|
||||
$ export OIDC_CLIENT_ID='Ab7OLrQibhXUzKHGWYDFieLa2KqZmFzb' OIDC_ISSUER='https://pojntfx.eu.auth0.com/' OIDC_REDIRECT_URL='http://localhost:11337'
|
||||
$ export API_KEY="$(goit)"
|
||||
```
|
||||
|
||||
If we now list the communities, we see that none currently exist:
|
||||
如果我们现在列出社区,我们会看到当前不存在任何社区:
|
||||
|
||||
```shell
|
||||
$ weron manager list
|
||||
id,clients,persistent
|
||||
```
|
||||
|
||||
We can create a persistent community using `weron create`:
|
||||
我们可以使用 `weron create` 创建一个持久性社区:
|
||||
|
||||
```shell
|
||||
$ weron manager create --community mycommunity --password mypassword
|
||||
@@ -168,29 +166,29 @@ id,clients,persistent
|
||||
mycommunity,0,true
|
||||
```
|
||||
|
||||
It is also possible to delete communities using `weron delete`, which will also disconnect all joined peers:
|
||||
也可以使用 `weron delete` 删除社区,这也会断开所有已连接的节点:
|
||||
|
||||
```shell
|
||||
$ weron manager delete --community mycommunity
|
||||
```
|
||||
|
||||
For more information, see the [manager reference](#manager). You can also embed the manager in your own application using its [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcmgr).
|
||||
有关更多信息,请参见[管理器参考](#管理器)。您还可以使用其[Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcmgr)将管理器嵌入到您自己的应用程序中。
|
||||
|
||||
### 3. Test the System with `weron chat`
|
||||
### 3. 使用 `weron chat` 测试系统
|
||||
|
||||
If you want to work on your self-hosted signaling server, first set the remote address:
|
||||
如果您想在自托管的信令服务器上工作,首先设置远程地址:
|
||||
|
||||
```shell
|
||||
$ export WERON_RADDR='ws://localhost:1337/'
|
||||
```
|
||||
|
||||
The chat is an easy way to test if everything is working correctly. To join a chatroom, run the following:
|
||||
聊天是测试一切是否正常工作的简单方法。要加入聊天室,请运行以下命令:
|
||||
|
||||
```shell
|
||||
$ weron chat --community mycommunity --password mypassword --key mykey --names user1,user2,user3 --channels one,two,three
|
||||
```
|
||||
|
||||
On another peer, run the following (if your signaling server is public, you can run this anywhere on the planet):
|
||||
在另一个节点上,运行以下命令(如果您的信令服务器是公开的,您可以在地球上的任何地方运行此命令):
|
||||
|
||||
```shell
|
||||
$ weron chat --community mycommunity --password mypassword --key mykey --names user1,user2,user3 --channels one,two,three
|
||||
@@ -202,19 +200,19 @@ user2!
|
||||
user2>
|
||||
```
|
||||
|
||||
You can now start sending and receiving messages or add new peers to your chatroom to test the network.
|
||||
现在,您可以开始发送和接收消息,或者向聊天室添加新的节点来测试网络。
|
||||
|
||||
For more information, see the [chat reference](#chat). You can also embed the chat in your own application using its [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcchat).
|
||||
有关更多信息,请参见[聊天参考](#聊天)。您还可以使用其[Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcchat)将聊天嵌入到您自己的应用程序中。
|
||||
|
||||
### 4. Measure Latency with `weron utility latency`
|
||||
### 4. 使用 `weron utility latency` 测量延迟
|
||||
|
||||
An insightful metric of your network is its latency, which you can measure with this utility; think of this as `ping`, but for WebRTC. First, start the latency measurement server like so:
|
||||
网络的一个重要指标是其延迟,您可以使用此实用工具测量它;把它看作是WebRTC版的`ping`。首先,像这样启动延迟测量服务器:
|
||||
|
||||
```shell
|
||||
$ weron utility latency --community mycommunity --password mypassword --key mykey --server
|
||||
```
|
||||
|
||||
On another peer, launch the client, which should start measuring the latency immediately; press <kbd>CTRL</kbd> <kbd>C</kbd> to stop it and get the total statistics:
|
||||
在另一个节点上,启动客户端,它应该立即开始测量延迟;按<kbd>CTRL</kbd> <kbd>C</kbd>停止它并获取总体统计信息:
|
||||
|
||||
```shell
|
||||
$ weron utility latency --community mycommunity --password mypassword --key mykey
|
||||
@@ -227,17 +225,17 @@ $ weron utility latency --community mycommunity --password mypassword --key myke
|
||||
^CAverage latency: 281.235µs (5 packets written) Min: 110.111µs Max: 386.12µs
|
||||
```
|
||||
|
||||
For more information, see the [latency measurement utility reference](#latency-measurement-utility). You can also embed the utility in your own application using its [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcltc).
|
||||
有关更多信息,请参见[延迟测量实用工具参考](#延迟测量实用工具)。您还可以使用其[Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcltc)将该实用工具嵌入到您自己的应用程序中。
|
||||
|
||||
### 5. Measure Throughput with `weron utility throughput`
|
||||
### 5. 使用 `weron utility throughput` 测量吞吐量
|
||||
|
||||
If you want to transfer large amounts of data, your network's throughput is a key characteristic. This utility allows you to measure this metric between two nodes; think of it as `iperf`, but for WebRTC. First, start the throughput measurement server like so:
|
||||
如果您想传输大量数据,网络的吞吐量是一个关键特性。此实用工具允许您测量两个节点之间的这一指标;把它看作是WebRTC版的`iperf`。首先,像这样启动吞吐量测量服务器:
|
||||
|
||||
```shell
|
||||
$ weron utility throughput --community mycommunity --password mypassword --key mykey --server
|
||||
```
|
||||
|
||||
On another peer, launch the client, which should start measuring the throughput immediately; press <kbd>CTRL</kbd> <kbd>C</kbd> to stop it and get the total statistics:
|
||||
在另一个节点上,启动客户端,它应该立即开始测量吞吐量;按<kbd>CTRL</kbd> <kbd>C</kbd>停止它并获取总体统计信息:
|
||||
|
||||
```shell
|
||||
$ weron utility throughput --community mycommunity --password mypassword --key mykey
|
||||
@@ -250,11 +248,11 @@ $ weron utility throughput --community mycommunity --password mypassword --key m
|
||||
^CAverage throughput: 74.295 MB/s (594.359 Mb/s) (250 MB written in 3.364971672s) Min: 64.844 MB/s Max: 103.360 MB/s
|
||||
```
|
||||
|
||||
For more information, see the [throughput measurement utility reference](#throughput-measurement-utility). You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcthr).
|
||||
有关更多信息,请参见[吞吐量测量实用工具参考](#吞吐量测量实用工具)。您还可以使用其[Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcthr)将该实用工具嵌入到您自己的应用程序中。
|
||||
|
||||
### 6. Create a Layer 3 (IP) Overlay Network with `weron vpn ip`
|
||||
### 6. 使用 `weron vpn ip` 创建第3层(IP)覆盖网络
|
||||
|
||||
If you want to join multiple nodes into an overlay network, the IP VPN is the best choice. It works similarly to i.e. Tailscale/WireGuard and can either dynamically allocate an IP address from a CIDR notation or statically assign one for you. On Windows, make sure to install [TAP-Windows](https://build.openvpn.net/downloads/releases/) first. Also note that due to technical limitations, only one IPv4 or IPv6 network and only one VPN instance at a time is supported on Windows; on macOS, only IPv6 networks are supported and IPv4 networks are ignored. To get started, launch the VPN on the first peer:
|
||||
如果您想将多个节点加入到覆盖网络中,IP VPN是最佳选择。它的工作方式类似于例如Tailscale/WireGuard,可以从CIDR表示法中动态分配IP地址或为您静态分配一个。在Windows上,请确保先安装[TAP-Windows](https://build.openvpn.net/downloads/releases/)。另请注意,由于技术限制,Windows上一次只支持一个IPv4或IPv6网络和一个VPN实例;在macOS上,只支持IPv6网络,IPv4网络会被忽略。要开始,请在第一个节点上启动VPN:
|
||||
|
||||
```shell
|
||||
$ sudo weron vpn ip --community mycommunity --password mypassword --key mykey --ips 2001:db8::1/64,192.0.2.1/24
|
||||
@@ -262,7 +260,7 @@ $ sudo weron vpn ip --community mycommunity --password mypassword --key mykey --
|
||||
{"level":"info","id":"[\"2001:db8::6a/64\",\"192.0.2.107/24\"]","time":"2022-05-06T22:20:56+02:00","message":"Connected to signaler"}
|
||||
```
|
||||
|
||||
On another peer, launch the VPN as well:
|
||||
在另一个节点上,也启动VPN:
|
||||
|
||||
```shell
|
||||
$ sudo weron vpn ip --community mycommunity --password mypassword --key mykey --ips 2001:db8::1/64,192.0.2.1/24
|
||||
@@ -271,7 +269,7 @@ $ sudo weron vpn ip --community mycommunity --password mypassword --key mykey --
|
||||
{"level":"info","id":"[\"2001:db8::6a/64\",\"192.0.2.107/24\"]","time":"2022-05-06T22:22:36+02:00","message":"Connected to peer"}
|
||||
```
|
||||
|
||||
You can now communicate between the peers:
|
||||
现在您可以在节点之间通信:
|
||||
|
||||
```shell
|
||||
$ ping 2001:db8::b9
|
||||
@@ -286,11 +284,11 @@ PING 2001:db8::b9(2001:db8::b9) 56 data bytes
|
||||
rtt min/avg/max/mdev = 1.066/1.180/1.361/0.114 ms
|
||||
```
|
||||
|
||||
If you temporarily lose the network connection, the network topology changes etc. it will automatically reconnect. For more information and limitations on proprietary operating systems like macOS, see the [IP VPN reference](#layer-3-ip-overlay-networks). You can also embed the utility in your own application using its [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcip).
|
||||
如果您暂时失去网络连接,网络拓扑发生变化等,它将自动重新连接。有关更多信息和在macOS等专有操作系统上的限制,请参见[IP VPN参考](#第3层-ip-覆盖网络)。您还可以使用其[Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcip)将该实用工具嵌入到您自己的应用程序中。
|
||||
|
||||
### 7. Create a Layer 2 (Ethernet) Overlay Network with `weron vpn ethernet`
|
||||
### 7. 使用 `weron vpn ethernet` 创建第2层(以太网)覆盖网络
|
||||
|
||||
If you want more flexibility or work on non-IP networks, the Ethernet VPN is a good choice. It works similarly to `n2n` or ZeroTier. Due to API restrictions, this VPN type [is not available on macOS](https://support.apple.com/guide/deployment/system-and-kernel-extensions-in-macos-depa5fb8376f/web); use [Asahi Linux](https://asahilinux.org/), a computer that respects your freedoms or the layer 3 (IP) VPN instead. To get started, launch the VPN on the first peer:
|
||||
如果您想要更大的灵活性或在非IP网络上工作,以太网VPN是一个不错的选择。它的工作方式类似于`n2n`或ZeroTier。由于API限制,这种VPN类型[在macOS上不可用](https://support.apple.com/guide/deployment/system-and-kernel-extensions-in-macos-depa5fb8376f/web);请使用[Asahi Linux](https://asahilinux.org/)、尊重您自由的计算机或第3层(IP)VPN作为替代。要开始,请在第一个节点上启动VPN:
|
||||
|
||||
```shell
|
||||
$ sudo weron vpn ethernet --community mycommunity --password mypassword --key mykey
|
||||
@@ -298,14 +296,14 @@ $ sudo weron vpn ethernet --community mycommunity --password mypassword --key my
|
||||
{"level":"info","id":"fe:60:a5:8b:81:36","time":"2022-05-06T22:42:11+02:00","message":"Connected to signaler"}
|
||||
```
|
||||
|
||||
If you want to add an IP address to the TAP interface, do so with `iproute2` or your OS tools:
|
||||
如果您想给TAP接口添加IP地址,请使用`iproute2`或您操作系统的工具:
|
||||
|
||||
```shell
|
||||
$ sudo ip addr add 192.0.2.1/24 dev tap0
|
||||
$ sudo ip addr add 2001:db8::1/32 dev tap0
|
||||
```
|
||||
|
||||
On another peer, launch the VPN as well:
|
||||
在另一个节点上,也启动VPN:
|
||||
|
||||
```shell
|
||||
$ sudo weron vpn ethernet --community mycommunity --password mypassword --key mykey
|
||||
@@ -314,14 +312,14 @@ $ sudo weron vpn ethernet --community mycommunity --password mypassword --key my
|
||||
{"level":"info","id":"fe:60:a5:8b:81:36","time":"2022-05-06T22:52:57+02:00","message":"Connected to peer"}
|
||||
```
|
||||
|
||||
And add the IP addresses:
|
||||
并添加IP地址:
|
||||
|
||||
```shell
|
||||
$ sudo ip addr add 192.0.2.2/24 dev tap0
|
||||
$ sudo ip addr add 2001:db8::2/32 dev tap0
|
||||
```
|
||||
|
||||
You can now communicate between the peers:
|
||||
现在您可以在节点之间通信:
|
||||
|
||||
```shell
|
||||
$ ping 2001:db8::2
|
||||
@@ -335,11 +333,11 @@ PING 2001:db8::2(2001:db8::2) 56 data bytes
|
||||
rtt min/avg/max/mdev = 1.136/1.193/1.239/0.042 ms
|
||||
```
|
||||
|
||||
If you temporarily lose the network connection, the network topology changes etc. it will automatically reconnect. You can also embed the utility in your own application using its [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtceth).
|
||||
如果您暂时失去网络连接,网络拓扑发生变化等,它将自动重新连接。您还可以使用其[Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtceth)将该实用工具嵌入到您自己的应用程序中。
|
||||
|
||||
### 8. Write your own protocol with `wrtcconn`
|
||||
### 8. 使用 `wrtcconn` 编写您自己的协议
|
||||
|
||||
It is almost trivial to build your own distributed applications with weron, similarly to how [PeerJS](https://peerjs.com/) works. Here is the core logic behind a simple echo example:
|
||||
使用weron构建您自己的分布式应用几乎是微不足道的,类似于[PeerJS](https://peerjs.com/)的工作方式。以下是简单回显示例背后的核心逻辑:
|
||||
|
||||
```go
|
||||
// ...
|
||||
@@ -374,9 +372,9 @@ for {
|
||||
}
|
||||
```
|
||||
|
||||
You can either use the [minimal adapter](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcconn#Adapter) or the [named adapter](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcconn#NamedAdapter); the latter negotiates a username between the peers, while the former does not check for duplicates. For more information, check out the [Go API](https://pkg.go.dev/github.com/pojntfx/weron) and take a look at the provided [examples](./examples), utilities and services in the package for examples.
|
||||
您可以使用[最小适配器](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcconn#Adapter)或[命名适配器](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcconn#NamedAdapter);后者在节点之间协商用户名,而前者不检查重复项。有关更多信息,请查看[Go API](https://pkg.go.dev/github.com/pojntfx/weron)并查看包中提供的[示例](./examples)、实用工具和服务以获取示例。
|
||||
|
||||
🚀 **That's it!** We hope you enjoy using weron.
|
||||
🚀 **就是这样!** 我们希望您喜欢使用weron。
|
||||
|
||||
## Reference
|
||||
|
||||
@@ -388,268 +386,268 @@ You can either use the [minimal adapter](https://pkg.go.dev/github.com/pojntfx/w
|
||||
|
||||
```shell
|
||||
$ weron --help
|
||||
Overlay networks based on WebRTC.
|
||||
基于WebRTC的覆盖网络。
|
||||
|
||||
Find more information at:
|
||||
在以下网址查找更多信息:
|
||||
https://github.com/pojntfx/weron
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron [command]
|
||||
|
||||
Available Commands:
|
||||
chat Chat over the overlay network
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
help Help about any command
|
||||
manager Manage a signaling server
|
||||
signaler Start a signaling server
|
||||
utility Utilities for overlay networks
|
||||
vpn Join virtual private networks built on overlay networks
|
||||
可用命令:
|
||||
chat 通过覆盖网络聊天
|
||||
completion 为指定的shell生成自动完成脚本
|
||||
help 关于任何命令的帮助
|
||||
manager 管理信令服务器
|
||||
signaler 启动信令服务器
|
||||
utility 覆盖网络的实用工具
|
||||
vpn 加入建立在覆盖网络上的虚拟专用网络
|
||||
|
||||
Flags:
|
||||
-h, --help help for weron
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
标志:
|
||||
-h, --help weron的帮助
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
|
||||
Use "weron [command] --help" for more information about a command.
|
||||
使用 "weron [command] --help" 获取有关命令的更多信息。
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Expand subcommand reference</summary>
|
||||
<summary>展开子命令参考</summary>
|
||||
|
||||
#### Signaling Server
|
||||
|
||||
```shell
|
||||
$ weron signaler --help
|
||||
Start a signaling server
|
||||
启动信令服务器
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron signaler [flags]
|
||||
|
||||
Aliases:
|
||||
别名:
|
||||
signaler, sgl, s
|
||||
|
||||
Flags:
|
||||
--api-password string Password for the management API (can also be set using the API_PASSWORD env variable). Ignored if any of the OIDC parameters are set.
|
||||
--api-username string Username for the management API (can also be set using the API_USERNAME env variable). Ignored if any of the OIDC parameters are set. (default "admin")
|
||||
--cleanup (Warning: Only enable this after stopping all other servers accessing the database!) Remove all ephemeral communities from database and reset client counts before starting
|
||||
--ephemeral-communities Enable the creation of ephemeral communities (default true)
|
||||
--heartbeat duration Time to wait for heartbeats (default 10s)
|
||||
-h, --help help for signaler
|
||||
--laddr string Listening address (can also be set using the PORT env variable) (default ":1337")
|
||||
--oidc-client-id string OIDC Client ID (i.e. myoidcclientid) (can also be set using the OIDC_CLIENT_ID env variable)
|
||||
--oidc-issuer string OIDC Issuer (i.e. https://pojntfx.eu.auth0.com/) (can also be set using the OIDC_ISSUER env variable)
|
||||
--postgres-url string URL of PostgreSQL database to use (i.e. postgres://myuser:mypassword@myhost:myport/mydatabase) (can also be set using the DATABASE_URL env variable). If empty, a in-memory database will be used.
|
||||
标志:
|
||||
--api-password string 管理API的密码(也可以使用API_PASSWORD环境变量设置)。如果设置了任何OIDC参数,则忽略此项。
|
||||
--api-username string 管理API的用户名(也可以使用API_USERNAME环境变量设置)。如果设置了任何OIDC参数,则忽略此项。(默认为"admin")
|
||||
--cleanup (警告:仅在停止所有其他访问数据库的服务器后启用此项!)在启动前从数据库中删除所有临时社区并重置客户端计数
|
||||
--ephemeral-communities 启用临时社区的创建(默认为true)
|
||||
--heartbeat duration 等待心跳的时间(默认为10s)
|
||||
-h, --help signaler的帮助
|
||||
--laddr string 监听地址(也可以使用PORT环境变量设置)(默认为":1337")
|
||||
--oidc-client-id string OIDC客户端ID(例如myoidcclientid)(也可以使用OIDC_CLIENT_ID环境变量设置)
|
||||
--oidc-issuer string OIDC颁发者(例如https://pojntfx.eu.auth0.com/)(也可以使用OIDC_ISSUER环境变量设置)
|
||||
--postgres-url string 要使用的PostgreSQL数据库的URL(例如postgres://myuser:mypassword@myhost:myport/mydatabase)(也可以使用DATABASE_URL环境变量设置)。如果为空,将使用内存数据库。
|
||||
|
||||
Global Flags:
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
全局标志:
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
```
|
||||
|
||||
#### Manager
|
||||
|
||||
```shell
|
||||
$ weron manager --help
|
||||
Manage a signaling server
|
||||
管理信令服务器
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron manager [command]
|
||||
|
||||
Aliases:
|
||||
别名:
|
||||
manager, mgr, m
|
||||
|
||||
Available Commands:
|
||||
create Create a persistent community
|
||||
delete Delete a persistent or ephemeral community
|
||||
list List persistent and ephemeral communities
|
||||
可用命令:
|
||||
create 创建持久性社区
|
||||
delete 删除持久性或临时社区
|
||||
list 列出持久性和临时社区
|
||||
|
||||
Flags:
|
||||
-h, --help help for manager
|
||||
标志:
|
||||
-h, --help manager的帮助
|
||||
|
||||
Global Flags:
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
全局标志:
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
|
||||
Use "weron manager [command] --help" for more information about a command.
|
||||
使用 "weron manager [command] --help" 获取有关命令的更多信息。
|
||||
```
|
||||
|
||||
#### Chat
|
||||
|
||||
```shell
|
||||
$ weron chat --help
|
||||
Chat over the overlay network
|
||||
通过覆盖网络聊天
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron chat [flags]
|
||||
|
||||
Aliases:
|
||||
别名:
|
||||
chat, cht, c
|
||||
|
||||
Flags:
|
||||
--channels strings Comma-separated list of channels in community to join (default [weron/chat/primary])
|
||||
--community string ID of community to join
|
||||
--force-relay Force usage of TURN servers
|
||||
-h, --help help for chat
|
||||
--ice strings Comma-separated list of STUN servers (in format stun:host:port) and TURN servers to use (in format username:credential@turn:host:port) (i.e. username:credential@turn:global.turn.twilio.com:3478?transport=tcp) (default [stun:stun.l.google.com:19302])
|
||||
--id-channel string Channel to use to negotiate names (default "weron/chat/id")
|
||||
--key string Encryption key for community
|
||||
--kicks duration Time to wait for kicks (default 5s)
|
||||
--names strings Comma-separated list of names to try and claim one from
|
||||
--password string Password for community
|
||||
--raddr string Remote address (default "wss://weron.up.railway.app/")
|
||||
--timeout duration Time to wait for connections (default 10s)
|
||||
标志:
|
||||
--channels strings 要加入的社区中的频道的逗号分隔列表(默认为[weron/chat/primary])
|
||||
--community string 要加入的社区的ID
|
||||
--force-relay 强制使用TURN服务器
|
||||
-h, --help chat的帮助
|
||||
--ice strings STUN服务器(格式为stun:host:port)和TURN服务器(格式为username:credential@turn:host:port,例如username:credential@turn:global.turn.twilio.com:3478?transport=tcp)的逗号分隔列表(默认为[stun:stun.l.google.com:19302])
|
||||
--id-channel string 用于协商名称的频道(默认为"weron/chat/id")
|
||||
--key string 社区的加密密钥
|
||||
--kicks duration 等待踢出的时间(默认为5s)
|
||||
--names strings 尝试并从中声明一个名称的逗号分隔列表
|
||||
--password string 社区的密码
|
||||
--raddr string 远程地址(默认为"wss://weron.up.railway.app/")
|
||||
--timeout duration 等待连接的时间(默认为10s)
|
||||
|
||||
Global Flags:
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
全局标志:
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
```
|
||||
|
||||
#### Latency Measurement Utility
|
||||
|
||||
```shell
|
||||
$ weron utility latency --help
|
||||
Measure the latency of the overlay network
|
||||
测量覆盖网络的延迟
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron utility latency [flags]
|
||||
|
||||
Aliases:
|
||||
别名:
|
||||
latency, ltc, l
|
||||
|
||||
Flags:
|
||||
--community string ID of community to join
|
||||
--force-relay Force usage of TURN servers
|
||||
-h, --help help for latency
|
||||
--ice strings Comma-separated list of STUN servers (in format stun:host:port) and TURN servers to use (in format username:credential@turn:host:port) (i.e. username:credential@turn:global.turn.twilio.com:3478?transport=tcp) (default [stun:stun.l.google.com:19302])
|
||||
--key string Encryption key for community
|
||||
--packet-length int Size of packet to send and acknowledge (default 128)
|
||||
--password string Password for community
|
||||
--pause duration Time to wait before sending next packet (default 1s)
|
||||
--raddr string Remote address (default "wss://weron.up.railway.app/")
|
||||
--server Act as a server
|
||||
--timeout duration Time to wait for connections (default 10s)
|
||||
标志:
|
||||
--community string 要加入的社区的ID
|
||||
--force-relay 强制使用TURN服务器
|
||||
-h, --help latency的帮助
|
||||
--ice strings STUN服务器(格式为stun:host:port)和TURN服务器(格式为username:credential@turn:host:port,例如username:credential@turn:global.turn.twilio.com:3478?transport=tcp)的逗号分隔列表(默认为[stun:stun.l.google.com:19302])
|
||||
--key string 社区的加密密钥
|
||||
--packet-length int 要发送和确认的数据包大小(默认为128)
|
||||
--password string 社区的密码
|
||||
--pause duration 发送下一个数据包前等待的时间(默认为1s)
|
||||
--raddr string 远程地址(默认为"wss://weron.up.railway.app/")
|
||||
--server 作为服务器
|
||||
--timeout duration 等待连接的时间(默认为10s)
|
||||
|
||||
Global Flags:
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
全局标志:
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
```
|
||||
|
||||
#### Throughput Measurement Utility
|
||||
|
||||
```shell
|
||||
$ weron utility throughput --help
|
||||
Measure the throughput of the overlay network
|
||||
测量覆盖网络的吞吐量
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron utility throughput [flags]
|
||||
|
||||
Aliases:
|
||||
别名:
|
||||
throughput, thr, t
|
||||
|
||||
Flags:
|
||||
--community string ID of community to join
|
||||
--force-relay Force usage of TURN servers
|
||||
-h, --help help for throughput
|
||||
--ice strings Comma-separated list of STUN servers (in format stun:host:port) and TURN servers to use (in format username:credential@turn:host:port) (i.e. username:credential@turn:global.turn.twilio.com:3478?transport=tcp) (default [stun:stun.l.google.com:19302])
|
||||
--key string Encryption key for community
|
||||
--packet-count int Amount of packets to send before waiting for acknowledgement (default 1000)
|
||||
--packet-length int Size of packet to send (default 50000)
|
||||
--password string Password for community
|
||||
--raddr string Remote address (default "wss://weron.up.railway.app/")
|
||||
--server Act as a server
|
||||
--timeout duration Time to wait for connections (default 10s)
|
||||
标志:
|
||||
--community string 要加入的社区的ID
|
||||
--force-relay 强制使用TURN服务器
|
||||
-h, --help throughput的帮助
|
||||
--ice strings STUN服务器(格式为stun:host:port)和TURN服务器(格式为username:credential@turn:host:port,例如username:credential@turn:global.turn.twilio.com:3478?transport=tcp)的逗号分隔列表(默认为[stun:stun.l.google.com:19302])
|
||||
--key string 社区的加密密钥
|
||||
--packet-count int 在等待确认前发送的数据包数量(默认为1000)
|
||||
--packet-length int 要发送的数据包大小(默认为50000)
|
||||
--password string 社区的密码
|
||||
--raddr string 远程地址(默认为"wss://weron.up.railway.app/")
|
||||
--server 作为服务器
|
||||
--timeout duration 等待连接的时间(默认为10s)
|
||||
|
||||
Global Flags:
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
全局标志:
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
```
|
||||
|
||||
#### Layer 3 (IP) Overlay Networks
|
||||
|
||||
```shell
|
||||
$ weron vpn ip --help
|
||||
Join a layer 3 overlay network
|
||||
加入第3层覆盖网络
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron vpn ip [flags]
|
||||
|
||||
Aliases:
|
||||
别名:
|
||||
ip, i
|
||||
|
||||
Flags:
|
||||
--community string ID of community to join
|
||||
--dev string Name to give to the TUN device (i.e. weron0) (default is auto-generated; only supported on Linux)
|
||||
--force-relay Force usage of TURN servers
|
||||
-h, --help help for ip
|
||||
--ice strings Comma-separated list of STUN servers (in format stun:host:port) and TURN servers to use (in format username:credential@turn:host:port) (i.e. username:credential@turn:global.turn.twilio.com:3478?transport=tcp) (default [stun:stun.l.google.com:19302])
|
||||
--id-channel string Channel to use to negotiate names (default "weron/ip/id")
|
||||
--ips strings Comma-separated list of IP networks to claim an IP address from and and give to the TUN device (i.e. 2001:db8::1/32,192.0.2.1/24) (on Windows, only one IP network (either IPv4 or IPv6) is supported; on macOS, IPv4 networks are ignored)
|
||||
--key string Encryption key for community
|
||||
--kicks duration Time to wait for kicks (default 5s)
|
||||
--max-retries int Maximum amount of times to try and claim an IP address (default 200)
|
||||
--parallel int Amount of threads to use to decode frames (default 20)
|
||||
--password string Password for community
|
||||
--raddr string Remote address (default "wss://weron.up.railway.app/")
|
||||
--static Try to claim the exact IPs specified in the --ips flag statically instead of selecting a random one from the specified network
|
||||
--timeout duration Time to wait for connections (default 10s)
|
||||
标志:
|
||||
--community string 要加入的社区的ID
|
||||
--dev string 给TUN设备的名称(例如weron0)(默认自动生成;仅在Linux上支持)
|
||||
--force-relay 强制使用TURN服务器
|
||||
-h, --help ip的帮助
|
||||
--ice strings STUN服务器(格式为stun:host:port)和TURN服务器(格式为username:credential@turn:host:port,例如username:credential@turn:global.turn.twilio.com:3478?transport=tcp)的逗号分隔列表(默认为[stun:stun.l.google.com:19302])
|
||||
--id-channel string 用于协商名称的频道(默认为"weron/ip/id")
|
||||
--ips strings 要从中声明IP地址并给TUN设备的IP网络的逗号分隔列表(例如2001:db8::1/32,192.0.2.1/24)(在Windows上,只支持一个IP网络(IPv4或IPv6);在macOS上,IPv4网络被忽略)
|
||||
--key string 社区的加密密钥
|
||||
--kicks duration 等待踢出的时间(默认为5s)
|
||||
--max-retries int 尝试声明IP地址的最大次数(默认为200)
|
||||
--parallel int 用于解码帧的线程数量(默认为20)
|
||||
--password string 社区的密码
|
||||
--raddr string 远程地址(默认为"wss://weron.up.railway.app/")
|
||||
--static 尝试静态地声明--ips标志中指定的确切IP,而不是从指定网络中选择随机IP
|
||||
--timeout duration 等待连接的时间(默认为10s)
|
||||
|
||||
Global Flags:
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
全局标志:
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
```
|
||||
|
||||
#### Layer 2 (Ethernet) Overlay Networks
|
||||
|
||||
```shell
|
||||
$ weron vpn ethernet --help
|
||||
Join a layer 2 overlay network
|
||||
加入第2层覆盖网络
|
||||
|
||||
Usage:
|
||||
用法:
|
||||
weron vpn ethernet [flags]
|
||||
|
||||
Aliases:
|
||||
别名:
|
||||
ethernet, eth, e
|
||||
|
||||
Flags:
|
||||
--community string ID of community to join
|
||||
--dev string Name to give to the TAP device (i.e. weron0) (default is auto-generated; only supported on Linux and macOS)
|
||||
--force-relay Force usage of TURN servers
|
||||
-h, --help help for ethernet
|
||||
--ice strings Comma-separated list of STUN servers (in format stun:host:port) and TURN servers to use (in format username:credential@turn:host:port) (i.e. username:credential@turn:global.turn.twilio.com:3478?transport=tcp) (default [stun:stun.l.google.com:19302])
|
||||
--key string Encryption key for community
|
||||
--mac string MAC address to give to the TAP device (i.e. 3a:f8:de:7b:ef:52) (default is auto-generated; only supported on Linux)
|
||||
--parallel int Amount of threads to use to decode frames (default 20)
|
||||
--password string Password for community
|
||||
--raddr string Remote address (default "wss://weron.up.railway.app/")
|
||||
--timeout duration Time to wait for connections (default 10s)
|
||||
标志:
|
||||
--community string 要加入的社区的ID
|
||||
--dev string 给TAP设备的名称(例如weron0)(默认自动生成;仅在Linux和macOS上支持)
|
||||
--force-relay 强制使用TURN服务器
|
||||
-h, --help ethernet的帮助
|
||||
--ice strings STUN服务器(格式为stun:host:port)和TURN服务器(格式为username:credential@turn:host:port,例如username:credential@turn:global.turn.twilio.com:3478?transport=tcp)的逗号分隔列表(默认为[stun:stun.l.google.com:19302])
|
||||
--key string 社区的加密密钥
|
||||
--mac string 给TAP设备的MAC地址(例如3a:f8:de:7b:ef:52)(默认自动生成;仅在Linux上支持)
|
||||
--parallel int 用于解码帧的线程数量(默认为20)
|
||||
--password string 社区的密码
|
||||
--raddr string 远程地址(默认为"wss://weron.up.railway.app/")
|
||||
--timeout duration 等待连接的时间(默认为10s)
|
||||
|
||||
Global Flags:
|
||||
-v, --verbose int Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)
|
||||
全局标志:
|
||||
-v, --verbose int 详细程度级别(0为禁用,默认为info,7为trace)(默认为5)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Environment Variables
|
||||
|
||||
All command line arguments described above can also be set using environment variables; for example, to set `--max-retries` to `300` with an environment variable, use `WERON_MAX_RETRIES=300`.
|
||||
上面描述的所有命令行参数也可以使用环境变量设置;例如,要使用环境变量将`--max-retries`设置为`300`,使用`WERON_MAX_RETRIES=300`。
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
- [Font Awesome](https://fontawesome.com/) provides the assets used for the icon and logo.
|
||||
- [songgao/water](https://github.com/songgao/water) provides the TUN/TAP device library for weron.
|
||||
- [pion/webrtc](https://github.com/pion/webrtc) provides the WebRTC functionality.
|
||||
- [Font Awesome](https://fontawesome.com/)提供了用于图标和徽标的资产。
|
||||
- [songgao/water](https://github.com/songgao/water)为weron提供了TUN/TAP设备库。
|
||||
- [pion/webrtc](https://github.com/pion/webrtc)提供了WebRTC功能。
|
||||
|
||||
## Contributing
|
||||
|
||||
To contribute, please use the [GitHub flow](https://guides.github.com/introduction/flow/) and follow our [Code of Conduct](./CODE_OF_CONDUCT.md).
|
||||
要贡献,请使用[GitHub流](https://guides.github.com/introduction/flow/)并遵循我们的[行为准则](./CODE_OF_CONDUCT.md)。
|
||||
|
||||
To build and start a development version of weron locally, run the following:
|
||||
要在本地构建和启动weron的开发版本,请运行以下命令:
|
||||
|
||||
```shell
|
||||
$ git clone https://github.com/pojntfx/weron.git
|
||||
$ cd weron
|
||||
$ make depend
|
||||
$ make && sudo make install
|
||||
$ weron signaler # Starts the signaling server
|
||||
# In another terminal
|
||||
$ weron signaler # 启动信令服务器
|
||||
# 在另一个终端
|
||||
$ weron chat --raddr ws://localhost:1337 --community mycommunity --password mypassword --key mykey --names user1,user2,user3 --channels one,two,three
|
||||
# In another terminal
|
||||
# 在另一个终端
|
||||
$ weron chat --raddr ws://localhost:1337 --community mycommunity --password mypassword --key mykey --names user1,user2,user3 --channels one,two,three
|
||||
```
|
||||
|
||||
Have any questions or need help? Chat with us [on Matrix](https://matrix.to/#/#weron:matrix.org?via=matrix.org)!
|
||||
有任何问题或需要帮助?[在Matrix上](https://matrix.to/#/#weron:matrix.org?via=matrix.org)与我们聊天!
|
||||
|
||||
## License
|
||||
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user