release: prepare 0.2.0 for sing-box 1.14
This commit is contained in:
+18
-12
@@ -6,7 +6,7 @@ import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from vpn_egressctl.renderer_1_13_19 import render_bytes
|
||||
from vpn_egressctl.renderer_1_14_0 import render_bytes
|
||||
from vpn_egressctl.uri import parse_hysteria2_uri
|
||||
from vpn_egressctl.version import probe_version
|
||||
|
||||
@@ -14,24 +14,30 @@ from tests.helpers import make_policy
|
||||
|
||||
|
||||
class RealSingBoxIntegrationTests(unittest.TestCase):
|
||||
@unittest.skipUnless(os.environ.get("SING_BOX_1_13_19"), "real sing-box 1.13.19 binary is not configured")
|
||||
def test_real_binary_accepts_golden_config(self) -> None:
|
||||
binary = os.environ["SING_BOX_1_13_19"]
|
||||
@unittest.skipUnless(os.environ.get("SING_BOX_1_14_0"), "real sing-box 1.14.0 binary is not configured")
|
||||
def test_real_binary_accepts_golden_configs(self) -> None:
|
||||
binary = os.environ["SING_BOX_1_14_0"]
|
||||
version = probe_version(binary)
|
||||
self.assertEqual(version.version, "1.13.19")
|
||||
self.assertEqual(version.version, "1.14.0")
|
||||
self.assertIn("with_quic", version.tags)
|
||||
self.assertIn("with_gvisor", version.tags)
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
policy = make_policy(root)
|
||||
endpoint = parse_hysteria2_uri(
|
||||
"hysteria2://auth@example.com:443?obfs=salamander&obfs-password=obfs"
|
||||
)
|
||||
config = root / "config.json"
|
||||
config.write_bytes(render_bytes(policy, endpoint))
|
||||
command = "check" if "linux/" in version.environment else "format"
|
||||
result = subprocess.run([binary, command, "-c", str(config)], capture_output=True, text=True)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
for obfs in ("gecko", "salamander"):
|
||||
with self.subTest(obfs=obfs):
|
||||
endpoint = parse_hysteria2_uri(
|
||||
f"hysteria2://auth@example.com:443?obfs={obfs}&obfs-password=obfs"
|
||||
)
|
||||
config = root / f"config-{obfs}.json"
|
||||
config.write_bytes(render_bytes(policy, endpoint))
|
||||
result = subprocess.run(
|
||||
[binary, command, "-c", str(config)],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user