mirror of
https://github.com/ayflying/p2p.git
synced 2026-03-04 17:29:22 +00:00
修复依赖
This commit is contained in:
@@ -9,15 +9,21 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
)
|
||||
|
||||
type (
|
||||
IP2P interface {
|
||||
Start(ctx context.Context, wsStr string) (err error)
|
||||
// 创建libp2p主机
|
||||
CreateLibp2pHost(ctx context.Context, port int) (host.Host, error)
|
||||
// 发现并连接目标节点
|
||||
DiscoverAndConnect(targetID string) error
|
||||
// 发送数据到目标节点
|
||||
SendData(targetID string, data []byte) error
|
||||
// 初始化无服务器DHT(作为节点加入DHT网络)
|
||||
DHTStart(ctx context.Context, h host.Host) (*dht.IpfsDHT, error)
|
||||
GatewayStart(ctx context.Context, group *ghttp.RouterGroup) (err error)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user