mirror of
https://github.com/ayflying/p2p.git
synced 2026-03-04 17:29:22 +00:00
增加代理接口
This commit is contained in:
28
internal/message/proxyAck/proxyAck.go
Normal file
28
internal/message/proxyAck/proxyAck.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package proxyAck
|
||||
|
||||
import (
|
||||
v1 "github.com/ayflying/p2p/api/p2p/v1"
|
||||
"github.com/ayflying/p2p/internal/service"
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
type ProxyAck struct {
|
||||
Ip string `json:"ip"`
|
||||
Port int `json:"port"`
|
||||
Data []byte `json:"data"`
|
||||
}
|
||||
|
||||
var New = ProxyAck{}
|
||||
|
||||
func (p ProxyAck) Message(msg *v1.Message) (err error) {
|
||||
var data *ProxyAck
|
||||
gjson.DecodeTo(msg.Data, &data)
|
||||
//g.Dump(data)
|
||||
|
||||
g.Log().Debugf(gctx.New(), "收到ACK发送到端口:%v", data.Port)
|
||||
err = service.P2P().TcpAck(data.Port).Send(data.Data)
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user