mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-10 12:00:28 +08:00
修复HTTP传输时可能无法传递TOA的问题
This commit is contained in:
@@ -4,9 +4,11 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/goman"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
"github.com/pires/go-proxyproto"
|
||||
"golang.org/x/net/http2"
|
||||
"net"
|
||||
@@ -224,7 +226,7 @@ func (this *HTTPClientPool) handleTOA(req *HTTPRequest, ctx context.Context, net
|
||||
for i := 1; i <= retries; i++ {
|
||||
var port = int(toaConfig.RandLocalPort())
|
||||
// TODO 思考是否支持X-Real-IP/X-Forwarded-IP
|
||||
err := sharedTOAManager.SendMsg("add:" + strconv.Itoa(port) + ":" + req.requestRemoteAddr(true))
|
||||
err := sharedTOAManager.SendMsg("add:" + strconv.Itoa(port) + ":" + configutils.QuoteIP(req.requestRemoteAddr(true)) + ":" + types.String(req.RemotePort()))
|
||||
if err != nil {
|
||||
remotelogs.Error("TOA", "add failed: "+err.Error())
|
||||
} else {
|
||||
|
||||
@@ -60,14 +60,14 @@ func (this *TOAManager) Run(config *nodeconfigs.TOAConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
binPath := Tea.Root + "/edge-toa/edge-toa" // TODO 可以做成配置
|
||||
var binPath = Tea.Root + "/edge-toa/edge-toa" // TODO 可以做成配置
|
||||
_, err := os.Stat(binPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
remotelogs.Println("TOA", "starting ...")
|
||||
remotelogs.Println("TOA", "args: "+strings.Join(config.AsArgs(), " "))
|
||||
cmd := executils.NewCmd(binPath, config.AsArgs()...)
|
||||
var cmd = executils.NewCmd(binPath, config.AsArgs()...)
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user