Parse X-Forward-For in HTTP requests

This commit is contained in:
世界
2022-08-23 19:44:40 +08:00
parent e750c747c6
commit 9f6ff54a76
14 changed files with 38 additions and 59 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"net"
"net/netip"
"syscall"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/common/redir"
@@ -55,7 +56,7 @@ func (t *TProxy) Start() error {
return err
}
if t.tcpListener != nil {
err = control.Conn(t.tcpListener, func(fd uintptr) error {
err = control.Conn(common.MustCast[syscall.Conn](t.tcpListener), func(fd uintptr) error {
return redir.TProxy(fd, M.SocksaddrFromNet(t.tcpListener.Addr()).Addr.Is6())
})
if err != nil {