del: 将go版本的内容删除,只保留处理日志功能
This commit is contained in:
102
README.md
102
README.md
@@ -1,94 +1,88 @@
|
||||
# OmniSocketGo
|
||||
# OmniSocketC
|
||||
|
||||
Linux only. Go 1.22.
|
||||
Linux-only C11 implementation of the UDP/KCP transport stack from `OmniSocketGo`.
|
||||
|
||||
如果目标机器只运行 `server`,只需要编译并拷贝 `server` 二进制。
|
||||
如果目标机器只运行 `peer`,只需要编译并拷贝 `peer` 二进制。
|
||||
|
||||
`go build ./cmd/server` 和 `go build ./cmd/peer` 会把各自依赖到的功能一起编译进最终二进制,不需要再单独编译 `cmd/internal/...` 包。
|
||||
|
||||
- `server` 二进制会包含它依赖到的转发、协议、传输等代码
|
||||
- `peer` 二进制会包含它依赖到的注册、交互发送、接收落盘、协议、传输等代码
|
||||
- 只有没有被这个可执行程序引用的其他命令,才不在该二进制里,比如 `cmd/latencysummary`
|
||||
This subtree is intentionally standalone. The Go code stays in place as the behavior reference, while the C implementation builds its own binaries under `c/bin/`.
|
||||
|
||||
## Build
|
||||
|
||||
按目标架构分别编译。
|
||||
mkdir -p bin
|
||||
go build -o bin/server ./cmd/server
|
||||
go build -o bin/peer ./cmd/peer
|
||||
go build -o bin/latencysummary ./cmd/latencysummary
|
||||
|
||||
### Linux amd64
|
||||
|
||||
```bash
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/server-linux-amd64 ./cmd/server
|
||||
```
|
||||
|
||||
### Linux arm64
|
||||
|
||||
```bash
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/peer-linux-arm64 ./cmd/peer
|
||||
```
|
||||
|
||||
### Linux armv7
|
||||
|
||||
```bash
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o bin/server-linux-armv7 ./cmd/server
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o bin/peer-linux-armv7 ./cmd/peer
|
||||
cd c
|
||||
make
|
||||
```
|
||||
|
||||
Build outputs:
|
||||
|
||||
- `c/bin/udpserver`
|
||||
- `c/bin/udppeer`
|
||||
- `c/bin/udpping`
|
||||
- `c/bin/udprelay`
|
||||
- `c/bin/kcpserver`
|
||||
- `c/bin/kcppeer`
|
||||
- `c/bin/kcpping`
|
||||
|
||||
## Run On Different Machines
|
||||
|
||||
`server D` 所在机器监听 `0.0.0.0:10909`。
|
||||
Server `D` runs the KCP hub on `0.0.0.0:10909`:
|
||||
|
||||
```bash
|
||||
go run cmd/kcpserver/ -listen 0.0.0.0:10909
|
||||
-kcp-ts-debug-log logs/d-kcp-ts.jsonl -kcp-session-stats-log logs/d-kcp-stats.jsonl
|
||||
./c/bin/kcpserver -listen 0.0.0.0:10909 \
|
||||
-kcp-ts-debug-log logs/d-kcp-ts.jsonl \
|
||||
-kcp-session-stats-log logs/d-kcp-stats.jsonl
|
||||
```
|
||||
|
||||
`relay server C` 所在机器
|
||||
Relay `C` runs a raw UDP forwarder to `D`:
|
||||
|
||||
```bash
|
||||
go run ./cmd/kcpserver/ -mode=relay -listen 0.0.0.0:10909 -relay-remote 172.21.32.15:10909
|
||||
|
||||
2>&1 | tee logs/c.stdout.log
|
||||
./c/bin/kcpserver -mode=relay -listen 0.0.0.0:10909 -relay-remote 172.21.32.15:10909
|
||||
```
|
||||
|
||||
### peer-a (A)
|
||||
Peer `A` dials `D` through relay `C`:
|
||||
|
||||
```bash
|
||||
go run ./cmd/kcppeer/ -id peer-a -server 172.21.32.15:10909 -relay-via 106.55.173.235:10909 -inbox-dir inbox/a
|
||||
|
||||
-latency-log logs/a-latency.jsonl -kcp-ts-debug-log logs/a-kcp-ts.jsonl -kcp-session-stats-log logs/a-kcp-stats.jsonl
|
||||
|
||||
go run ./cmd/kcpping/ -id peer-a -server 106.55.173.235:10909 -echo
|
||||
./c/bin/kcppeer -id peer-a -server 172.21.32.15:10909 -relay-via 106.55.173.235:10909 \
|
||||
-inbox-dir inbox/a \
|
||||
-latency-log logs/a-latency.jsonl \
|
||||
-kcp-ts-debug-log logs/a-kcp-ts.jsonl \
|
||||
-kcp-session-stats-log logs/a-kcp-stats.jsonl
|
||||
```
|
||||
|
||||
### peer-b (B)
|
||||
Peer `B` dials `D` directly:
|
||||
|
||||
```bash
|
||||
go run ./cmd/kcppeer/ -id peer-b -server 81.70.156.140:10909 -inbox-dir inbox/b
|
||||
./c/bin/kcppeer -id peer-b -server 81.70.156.140:10909 \
|
||||
-inbox-dir inbox/b \
|
||||
-latency-log logs/b-latency.jsonl \
|
||||
-kcp-ts-debug-log logs/b-kcp-ts.jsonl \
|
||||
-kcp-session-stats-log logs/b-kcp-stats.jsonl
|
||||
```
|
||||
|
||||
-latency-log logs/b-latency.jsonl -kcp-ts-debug-log logs/b-kcp-ts.jsonl -kcp-session-stats-log logs/b-kcp-stats.jsonl
|
||||
Optional ping / echo tools:
|
||||
|
||||
go run ./cmd/kcpping -id peer-b -server 81.70.156.140:10909 -to peer-a -count 20 -interval 100ms
|
||||
```bash
|
||||
./c/bin/kcpping -id peer-a -server 106.55.173.235:10909 -echo
|
||||
./c/bin/kcpping -id peer-b -server 81.70.156.140:10909 -to peer-a -count 20 -interval 100ms
|
||||
./c/bin/udpserver -listen 0.0.0.0:9001
|
||||
./c/bin/udppeer -id peer-a -server 127.0.0.1:9001
|
||||
./c/bin/udpping -id pinger -server 127.0.0.1:9001 -to peer-a -count 20
|
||||
```
|
||||
|
||||
## Interactive Commands
|
||||
|
||||
`peer` 启动后可以在终端里持续使用同一条长连接发送多次消息。
|
||||
`udppeer` and `kcppeer` support the same interactive shell:
|
||||
|
||||
```text
|
||||
help
|
||||
text peer-b hello
|
||||
text peer-a hi
|
||||
file peer-a /tmp/test125.bin
|
||||
file peer-a /tmp/test5.bin
|
||||
quit
|
||||
```
|
||||
### 自动化拉取更新汇总数据
|
||||
cd /home/limingjie/LMJ_Work/OmniSocketGo
|
||||
./scripts/refresh-latency-summary.sh
|
||||
|
||||
## Notes
|
||||
|
||||
- The C project targets Linux only.
|
||||
- It preserves the Go wire format for UDP datagrams and KCP stream frames.
|
||||
- It keeps runtime JSONL logging, UDP TX timestamp debug, KCP packet debug, and KCP session stats.
|
||||
- Offline `latencysummary` and HTML chart generation are intentionally not migrated.
|
||||
- No automated C tests are included in this subtree; validation is expected to happen on Linux via `make` and manual smoke tests.
|
||||
|
||||
Reference in New Issue
Block a user