fix: bug fixes

This commit is contained in:
fufsob committed 2026-09-16 08:43:53 +00:00
1 parent 9cdd6dada7
commit 027dc7b1a9
31 files changed
+626 -121

No files matched your search

+18 -1
View File
@@ -23,7 +23,14 @@ def listener(**overrides):
"users": [{"name": "", "uuid": "uuid-1", "uuidFile": None, "password": None, "passwordFile": None}],
"flow": None,
"method": "2022-blake3-aes-128-gcm",
"transport": {"type": "raw", "path": "/", "host": None, "mode": None, "serviceName": ""},
"transport": {
"type": "raw",
"path": "/",
"host": None,
"mode": None,
"serviceName": "",
"trustedXForwardedFor": [],
},
"tls": {"enable": False, "certificateFile": None, "keyFile": None, "serverName": None},
"reality": {
"enable": False,
@@ -146,6 +153,16 @@ class RenderInboundTests(unittest.TestCase):
{"certificateFile": "/cert.pem", "keyFile": "/key.pem"},
)
def test_trusted_x_forwarded_for_reaches_sockopt(self):
"""Without it XRay sees the web server's loopback address and records nobody online."""
plain = {"type": "ws", "path": "/", "host": None, "serviceName": "", "trustedXForwardedFor": []}
self.assertNotIn("sockopt", render_xray_inbound(listener(transport=plain))["streamSettings"])
behind = dict(plain, trustedXForwardedFor=["X-Real-IP"])
self.assertEqual(
render_xray_inbound(listener(transport=behind))["streamSettings"]["sockopt"],
{"trustedXForwardedFor": ["X-Real-IP"]},
)
def test_grpc_transport(self):
ib = render_xray_inbound(
listener(transport={"type": "grpc", "path": "/", "host": None, "serviceName": "GunService"})