example

command
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

P2P 示例:本地内存信令 / tunnel gateway 全链路 / dev coturn 验证。

用法:

# 1) 本地快速验证(无需 gateway,内存信令)
go run ./core/p2p/example/main.go -mode=local

# 2) 单进程全链路(gateway + 双 agent + P2P 拨号 + stream)
go run ./core/p2p/example/main.go -mode=all

# 3) 分终端运行(模拟两台机器)
go run ./core/p2p/example/main.go -mode=gateway
go run ./core/p2p/example/main.go -mode=peer -peer-id=node-b
go run ./core/p2p/example/main.go -mode=peer -peer-id=node-a -dial-to=node-b

# 4) 经 dev coturn STUN/TURN 验证(需外网)
go run ./core/p2p/example/main.go -mode=dev

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL