增加代理接口

This commit is contained in:
2025-10-30 11:13:47 +08:00
parent 2f4097b697
commit 31d1b3d27e
18 changed files with 274 additions and 104 deletions

View File

@@ -3,7 +3,7 @@ package v1
import "github.com/gogf/gf/v2/frame/g"
type ConnectReq struct {
g.Meta `path:"/p2p/connect" tags:"p2p" method:"get" sm:"连接到目标主机"`
g.Meta `path:"/message/connect" tags:"message" method:"get" sm:"连接到目标主机"`
TargetID string `json:"id"`
}
type ConnectRes struct {
@@ -11,7 +11,7 @@ type ConnectRes struct {
}
type SendReq struct {
g.Meta `path:"/p2p/send" tags:"p2p" method:"get" sm:"发送消息"`
g.Meta `path:"/message/send" tags:"message" method:"get" sm:"发送消息"`
TargetID string `json:"id"`
Data string `json:"data"`
}
@@ -20,8 +20,15 @@ type SendRes struct {
}
type IpReq struct {
g.Meta `path:"/p2p/ip" tags:"p2p" method:"get" sm:"获取当前主机的IP地址"`
g.Meta `path:"/message/ip" tags:"message" method:"get" sm:"获取当前主机的IP地址"`
}
type IpRes struct {
g.Meta `mime:"text/html" example:"string"`
}
type Message struct {
Type string `json:"type" dc:"消息类型"`
//Port int `json:"port,omitempty" dc:"请求端口"`
Data []byte `json:"data" dc:"消息数据"`
From string `json:"from" dc:"发送方ID"`
}