Skip to content

Commit 7f3c61f

Browse files
committed
fix compile, update readme
1 parent 886f4e8 commit 7f3c61f

3 files changed

Lines changed: 150 additions & 7 deletions

File tree

.github/workflows/subspace-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040
msvc_arch: amd64_arm64
4141
bin: subspace.exe
4242
- platform: linux-x86_64
43-
runner: ubuntu-22.04
43+
runner: ubuntu-24.04
4444
triplet: x64-linux
4545
bin: subspace
4646
- platform: linux-aarch64
47-
runner: ubuntu-22.04
47+
runner: ubuntu-24.04
4848
triplet: arm64-linux
4949
cross_linux_aarch64: true
5050
bin: subspace

README.md

Lines changed: 147 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
- [ ] 针对流体方块的处理
2727
- [ ] 模拟绝对响度
2828
- 转发:
29-
- [ ] 独立的转发程序
29+
- [x] 独立的转发程序
30+
- [x] TCP
31+
- [ ] UDP
32+
- [ ] GRPC
3033
- 游戏内:
3134
- [ ] 话筒和音响方块
3235
- [ ] 对讲机物品
@@ -37,7 +40,10 @@
3740
- [ ] Handling of fluid blocks
3841
- [ ] Absolute loudness simulation
3942
- Forwarding:
40-
- [ ] Standalone forwarding application
43+
- [x] Standalone forwarding application
44+
- [x] TCP
45+
- [ ] UDP
46+
- [ ] GRPC
4147
- In-game:
4248
- [ ] Microphone and Speaker blocks
4349
- [ ] Walkie-talkie items
@@ -57,6 +63,145 @@ Since the Nvidia AFX SDK client only supports Windows, smart mode of noise-cance
5763

5864
Due to limited resources, only partial support is provided for Linux. MacOS is not actively supported.
5965

66+
## 子空间中继 | Subspace
67+
68+
Subspace是一个独立于Minecraft服务端的运行程序,它可以替代Minecraft服务端进行语音数据转发操作,可以运行在完全不同的机器上,支持更多协议和端口。
69+
70+
Subspace is a standalone program that runs independently of the Minecraft server. It can take over voice data forwarding from the Minecraft server, may run on an entirely different machine, and supports more protocols and ports.
71+
72+
> ![NOTE]
73+
>
74+
> 即使使用了Subspace,你也仍然需要在服务端安装Channel并进行配置。
75+
>
76+
> 单个Subspace进程接受来自多个Minecraft服务端的连接,前提是后连接的服务端所指定的协议和安全等级与最初连接的服务端指定的相同。当没有服务端连接时,Subspace会自动重置,等待指定任意协议和安全等级。
77+
>
78+
> Even when Subspace is used, you still need to install and configure Channel on the Minecraft server.
79+
>
80+
> A single Subspace process accepts connections from multiple Minecraft servers, provided that any subsequently connected server specifies the same protocol and security level as the first one. When no server is connected, Subspace automatically resets and waits for any protocol and security level to be specified.
81+
82+
> ![WARNING]
83+
>
84+
> 多个Minecraft服务端中的相同UUID的玩家同时连接单个Subspace进程是**未定义行为**
85+
>
86+
> Connecting players that share the same UUID from multiple Minecraft servers to a single Subspace process at the same time is **undefined behavior**.
87+
88+
要将语音数据导向Channel,你需要编辑`<Minecraft服务器运行目录>/Config/ChannelServerConfig.json`:
89+
90+
To route voice data through Subspace, edit `<Minecraft server working directory>/Config/ChannelServerConfig.json`:
91+
92+
```json
93+
{
94+
"useSubspace": true,
95+
"subspaceAddress": "94.3.94.3",
96+
"subspaceServerPort": 10943,
97+
"subspaceClientPort": 10944,
98+
"subspaceFrequency": "qwerty",
99+
"subspaceProtocol": "TCP",
100+
"subspaceSecurityLevel": "LOW"
101+
}
102+
```
103+
104+
| 配置项</br>Option | 含义</br>Meaning |
105+
| --------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
106+
| useSubspace | 总开关。启用后,服务端会指示客户端连接到指定的Subspace。</br>Master switch. When enabled, the server instructs the client to connect to the specified Subspace. |
107+
| subspaceAddress | Subspace对应的地址或域名。</br>The address or domain name of the Subspace instance. |
108+
| subspaceServerPort | Subspace与Minecraft**服务端**通信的监听端口。</br>The port on which Subspace listens for the Minecraft **server**. |
109+
| subspaceClientPort | Subspace与Minecraft**客户端**通信的监听端口。</br>The port on which Subspace listens for the Minecraft **client**. |
110+
| subspaceFrequency | Subspace与Minecraft**服务端**通信的口令。可以是任意字符串。</br>The passphrase used between Subspace and the Minecraft **server**. May be any string. |
111+
| subspaceProtocol | Subspace与Minecraft**客户端**通信的协议,可以是`TCP``UDP``GRPC`。</br>The protocol used between Subspace and the Minecraft **client**. May be `TCP`, `UDP`, or `GRPC`. |
112+
| subspaceSecurityLevel | Subspace与Minecraft**客户端**通信的安全等级。<br />在TCP模式下,可以是:<br />`NONE`:握手和语音均使用明文<br />`LOW`:握手时使用AES-GCM校验,语音使用明文<br />`MID`:握手时使用AES-GCM校验,语音使用AES-CTR校验(仅加密)<br />`HIGH`:握手和语音均使用AES-GCM校验(防篡改或伪造)</br>The security level used between Subspace and the Minecraft **client**.<br />In TCP mode, may be:<br />`NONE`: both handshake and voice are sent in plaintext.<br />`LOW`: the handshake is verified with AES-GCM; voice is sent in plaintext.<br />`MID`: the handshake is verified with AES-GCM; voice uses AES-CTR (encryption only).<br />`HIGH`: both handshake and voice are verified with AES-GCM (tamper- and forgery-resistant). |
113+
114+
Subspace与Minecraft**客户端**通信的口令由Minecraft**服务端**在玩家加入服务器时随机生成。
115+
116+
Subspace与Minecraft**服务端**通信的 安全等级总是为AES-GCM。
117+
118+
The passphrase used between Subspace and the Minecraft **client** is randomly generated by the Minecraft **server** when a player joins.
119+
120+
The security level used between Subspace and the Minecraft **server** is always AES-GCM.
121+
122+
> **为什么会采用这种设计?**
123+
>
124+
> 基于“如果攻击者能物理接触到你的设备,那它就不再是你的设备了”的原则,Subspace的安全分级只关心网络中间人。
125+
>
126+
> **Why this design?**
127+
>
128+
> Following the principle that "if an attacker can physically reach your device, it is no longer your device", Subspace's security tiers concern themselves only with man-in-the-middle attackers on the network.
129+
130+
### 可执行程序 | Executable
131+
132+
你可以在[CI](https://github.com/USS-Shenzhou/Channel/actions/workflows/subspace-build.yml)直接下载编译好的可执行程序。有三种方式进行配置:
133+
134+
Pre-built executables can be downloaded directly from [CI](https://github.com/USS-Shenzhou/Channel/actions/workflows/subspace-build.yml). There are three ways to configure them:
135+
136+
#### JSON配置文件 | JSON config file
137+
138+
在你第一次运行Subspace时,会自动生成一个`SubspaceConfig.json`
139+
140+
The first time you run Subspace, a `SubspaceConfig.json` is generated automatically:
141+
142+
```json
143+
{
144+
"clientPort": 10944,
145+
"serverPort": 10943,
146+
"subspaceFrequency": "qwerty",
147+
"threads": 4
148+
}
149+
```
150+
151+
`threads`指的是用于和客户端进行连接和转发的线程数量,你可以根据预估使用人数和服务器CPU来确定。
152+
153+
填写完成之后你可以重新启动。
154+
155+
`threads` is the number of threads used to accept and forward client connections; choose a value based on the expected number of users and the server CPU.
156+
157+
Restart Subspace once the file has been filled in.
158+
159+
#### 运行参数 | Command-line arguments
160+
161+
以Linux为例:
162+
163+
Linux example:
164+
165+
`./subspace --serverPort 10943 --clientPort 10944 --frequency qwerty --threads 4 --no-json-config`
166+
167+
使用`--no-json-config`来绕过无json时的自动退出。
168+
169+
Use `--no-json-config` to bypass the automatic exit that would otherwise occur when no JSON file is present.
170+
171+
#### 环境变量 | Environment variables
172+
173+
参考下一节。
174+
175+
See the next section.
176+
177+
### Docker镜像 | Docker image
178+
179+
拉取镜像:
180+
181+
Pull the image:
182+
183+
```
184+
docker pull crpi-q744b99dm7g39ls8.cn-shanghai.personal.cr.aliyuncs.com/uss-shenzhou/subspace:latest
185+
```
186+
187+
运行:
188+
189+
Run:
190+
191+
```
192+
docker run -d --name subspace \
193+
-p 10943:10943 \
194+
-p 10944:10944 \
195+
-e SUBSPACE_SERVER_PORT=10943 \
196+
-e SUBSPACE_CLIENT_PORT=10944 \
197+
-e SUBSPACE_FREQUENCY=qwerty \
198+
-e SUBSPACE_THREADS=4 \
199+
crpi-q744b99dm7g39ls8.cn-shanghai.personal.cr.aliyuncs.com/uss-shenzhou/subspace:latest
200+
```
201+
202+
Dockerfile已内置`--no-json-config`
203+
204+
`--no-json-config` is already baked into the Dockerfile.
60205

61206
## 版权和许可 | Copyrights and Licenses
62207

subspace/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:bookworm-slim
1+
FROM debian:trixie-slim
22

33
ARG TARGETARCH
44

@@ -10,6 +10,4 @@ WORKDIR /app
1010
COPY bin/${TARGETARCH}/subspace /usr/local/bin/subspace
1111
RUN chmod +x /usr/local/bin/subspace
1212

13-
EXPOSE 10943/tcp 10944/tcp
14-
1513
ENTRYPOINT ["/usr/local/bin/subspace", "--no-json-config"]

0 commit comments

Comments
 (0)