mirror of
https://github.com/lwch/natpass.git
synced 2026-10-21 04:20:55 +00:00
增加改写from的处理逻辑
This commit is contained in:
@@ -26,7 +26,7 @@ func (p *Pool) handleConnectReq(conn *network.Conn, from, to string, req *networ
|
||||
port, _ := strconv.ParseUint(pt, 10, 16)
|
||||
tn := tunnel.New(global.Tunnel{
|
||||
Name: req.GetName(),
|
||||
Target: to,
|
||||
Target: from,
|
||||
Type: dial,
|
||||
LocalAddr: host,
|
||||
LocalPort: uint16(port),
|
||||
|
||||
@@ -108,6 +108,14 @@ func (p *Pool) connect(cfg *global.Configure, idx int) {
|
||||
logging.Error("read message: %v", err)
|
||||
return
|
||||
}
|
||||
from := msg.GetFrom()
|
||||
if len(from) > 0 {
|
||||
n := strings.LastIndex(from, "-")
|
||||
if n != -1 {
|
||||
from = from[:n]
|
||||
}
|
||||
msg.From = from
|
||||
}
|
||||
switch msg.GetXType() {
|
||||
case network.Msg_connect_req:
|
||||
p.handleConnectReq(c, msg.GetFrom(), msg.GetTo(), msg.GetCreq())
|
||||
|
||||
Reference in New Issue
Block a user