1{
2 lib,
3 stdenv,
4 aiohttp,
5 async-timeout,
6 attrs,
7 buildPythonPackage,
8 cryptography,
9 fetchFromGitHub,
10 pytest-aiohttp,
11 pytestCheckHook,
12 pythonAtLeast,
13 pythonOlder,
14 setuptools,
15}:
16
17buildPythonPackage rec {
18 pname = "snitun";
19 version = "0.40.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.10";
23
24 src = fetchFromGitHub {
25 owner = "NabuCasa";
26 repo = "snitun";
27 tag = version;
28 hash = "sha256-wit0GVuWFMl1u+VC7Aw+dPcvqLGyviSz/DVUKXvSvAs=";
29 };
30
31 build-system = [ setuptools ];
32
33 dependencies = [
34 aiohttp
35 async-timeout
36 attrs
37 cryptography
38 ];
39
40 nativeCheckInputs = [
41 pytest-aiohttp
42 pytestCheckHook
43 ];
44
45 disabledTests =
46 [
47 # AssertionError: Expected 'fileno' to not have been called. Called 1 times.
48 "test_client_stop_no_wait"
49 ]
50 ++ lib.optionals stdenv.hostPlatform.isDarwin [
51 "test_multiplexer_data_channel_abort_full" # https://github.com/NabuCasa/snitun/issues/61
52 # port binding conflicts
53 "test_snitun_single_runner_timeout"
54 "test_snitun_single_runner_throttling"
55 # ConnectionResetError: [Errno 54] Connection reset by peer
56 "test_peer_listener_timeout"
57 ]
58 ++ lib.optionals (pythonAtLeast "3.12") [
59 # blocking
60 "test_flow_client_peer"
61 "test_close_client_peer"
62 "test_init_connector"
63 "test_flow_connector"
64 "test_close_connector_remote"
65 "test_init_connector_whitelist"
66 "test_init_multiplexer_server"
67 "test_init_multiplexer_client"
68 "test_init_multiplexer_server_throttling"
69 "test_init_multiplexer_client_throttling"
70 "test_multiplexer_ping"
71 "test_multiplexer_ping_error"
72 "test_multiplexer_init_channel_full"
73 "test_multiplexer_close_channel_full"
74 "test_init_dual_peer_with_multiplexer"
75 ];
76
77 pythonImportsCheck = [ "snitun" ];
78
79 meta = with lib; {
80 description = "SNI proxy with TCP multiplexer";
81 changelog = "https://github.com/NabuCasa/snitun/releases/tag/${src.tag}";
82 homepage = "https://github.com/nabucasa/snitun";
83 license = licenses.gpl3Only;
84 maintainers = with maintainers; [ Scriptkiddi ];
85 platforms = platforms.linux;
86 };
87}