Преглед изворни кода

Merge pull request #5 from dolonet/sync-upstream-and-fix-module-path

Sync upstream + fix module path for go install
pull/434/head
dolonet пре 1 месец
родитељ
комит
9c62a60a3d
No account linked to committer's email address
100 измењених фајлова са 458 додато и 185 уклоњено
  1. 1
    1
      .codecov.yml
  2. 1
    1
      antireplay/noop.go
  3. 1
    1
      antireplay/noop_test.go
  4. 1
    1
      antireplay/stable_bloom_filter.go
  5. 2
    2
      antireplay/stable_bloom_filter_test.go
  6. 1
    1
      events/event_stream.go
  7. 2
    2
      events/event_stream_test.go
  8. 1
    1
      events/init.go
  9. 1
    1
      events/init_test.go
  10. 1
    1
      events/multi_observer.go
  11. 1
    1
      events/noop.go
  12. 2
    2
      events/noop_test.go
  13. 1
    1
      go.mod
  14. 3
    3
      internal/cli/access.go
  15. 5
    5
      internal/cli/doctor.go
  16. 1
    1
      internal/cli/generate_secret.go
  17. 1
    1
      internal/cli/run.go
  18. 11
    11
      internal/cli/run_proxy.go
  19. 1
    1
      internal/cli/simple_run.go
  20. 2
    2
      internal/cli/utils.go
  21. 5
    5
      internal/config/config.go
  22. 1
    1
      internal/config/config_test.go
  23. 4
    4
      internal/config/parse.go
  24. 1
    1
      internal/config/type_blocklist_uri_test.go
  25. 1
    1
      internal/config/type_bool_test.go
  26. 1
    1
      internal/config/type_bytes_test.go
  27. 1
    1
      internal/config/type_concurrency_test.go
  28. 1
    1
      internal/config/type_dc_test.go
  29. 1
    1
      internal/config/type_dns_uri_test.go
  30. 1
    1
      internal/config/type_duration_test.go
  31. 1
    1
      internal/config/type_error_rate_test.go
  32. 1
    1
      internal/config/type_hostport_test.go
  33. 1
    1
      internal/config/type_http_path_test.go
  34. 1
    1
      internal/config/type_https_url_test.go
  35. 1
    1
      internal/config/type_ip_test.go
  36. 1
    1
      internal/config/type_metric_prefix_test.go
  37. 1
    1
      internal/config/type_port_test.go
  38. 1
    1
      internal/config/type_prefer_ip_test.go
  39. 1
    1
      internal/config/type_proxy_url_test.go
  40. 1
    1
      internal/config/type_statsd_tag_format_test.go
  41. 1
    1
      internal/testlib/mtglib_network_mock.go
  42. 1
    1
      internal/utils/make_qr_code_url_test.go
  43. 1
    1
      internal/utils/net_listener.go
  44. 1
    1
      internal/utils/read_config.go
  45. 1
    1
      internal/utils/read_config_test.go
  46. 1
    1
      ipblocklist/files/http_test.go
  47. 1
    1
      ipblocklist/files/local_test.go
  48. 1
    1
      ipblocklist/files/mem_test.go
  49. 2
    2
      ipblocklist/firehol.go
  50. 4
    4
      ipblocklist/firehol_test.go
  51. 1
    1
      ipblocklist/noop.go
  52. 1
    1
      ipblocklist/noop_test.go
  53. 1
    1
      logger/noop.go
  54. 2
    2
      logger/noop_test.go
  55. 1
    1
      logger/zerolog.go
  56. 2
    2
      logger/zerolog_test.go
  57. 1
    1
      main.go
  58. 51
    6
      mtglib/conns.go
  59. 152
    1
      mtglib/conns_internal_test.go
  60. 1
    1
      mtglib/counting_conn.go
  61. 1
    1
      mtglib/events_test.go
  62. 1
    1
      mtglib/init.go
  63. 1
    1
      mtglib/internal/dc/addr.go
  64. 1
    1
      mtglib/internal/dc/init.go
  65. 6
    2
      mtglib/internal/dc/view.go
  66. 2
    2
      mtglib/internal/doppel/conn.go
  67. 2
    2
      mtglib/internal/doppel/conn_test.go
  68. 1
    1
      mtglib/internal/doppel/ganger.go
  69. 1
    1
      mtglib/internal/doppel/ganger_test.go
  70. 2
    2
      mtglib/internal/doppel/init.go
  71. 1
    1
      mtglib/internal/doppel/init_test.go
  72. 14
    8
      mtglib/internal/doppel/scout.go
  73. 2
    2
      mtglib/internal/doppel/scout_conn.go
  74. 20
    1
      mtglib/internal/doppel/scout_conn_collected.go
  75. 49
    5
      mtglib/internal/doppel/scout_conn_collected_test.go
  76. 1
    1
      mtglib/internal/obfuscation/conn.go
  77. 2
    2
      mtglib/internal/obfuscation/conn_test.go
  78. 1
    1
      mtglib/internal/obfuscation/obfuscator.go
  79. 3
    3
      mtglib/internal/obfuscation/obfuscator_fuzz_test.go
  80. 3
    3
      mtglib/internal/obfuscation/obfuscator_test.go
  81. 1
    1
      mtglib/internal/relay/pool_settings_constrained.go
  82. 1
    1
      mtglib/internal/relay/pool_settings_other.go
  83. 1
    1
      mtglib/internal/relay/relay.go
  84. 2
    2
      mtglib/internal/relay/relay_bench_test.go
  85. 2
    2
      mtglib/internal/relay/relay_test.go
  86. 1
    1
      mtglib/internal/relay/stack_bench_test.go
  87. 1
    1
      mtglib/internal/relay/stress_bench_test.go
  88. 1
    1
      mtglib/internal/tls/conn.go
  89. 1
    1
      mtglib/internal/tls/conn_test.go
  90. 1
    1
      mtglib/internal/tls/fake/client_side.go
  91. 3
    3
      mtglib/internal/tls/fake/client_side_fuzz_test.go
  92. 2
    2
      mtglib/internal/tls/fake/client_side_snapshot_test.go
  93. 4
    4
      mtglib/internal/tls/fake/client_side_test.go
  94. 1
    1
      mtglib/internal/tls/fake/server_side.go
  95. 3
    3
      mtglib/internal/tls/fake/server_side_test.go
  96. 15
    11
      mtglib/proxy.go
  97. 8
    8
      mtglib/proxy_test.go
  98. 1
    1
      mtglib/secret_test.go
  99. 1
    1
      mtglib/stream_context.go
  100. 0
    0
      mtglib/stream_context_internal_test.go

+ 1
- 1
.codecov.yml Прегледај датотеку

@@ -1,4 +1,4 @@
1 1
 ---
2 2
 
3 3
 fixes:
4
-  - "github.com/9seconds/mtg/v2/::"
4
+  - "github.com/dolonet/mtg-multi/::"

+ 1
- 1
antireplay/noop.go Прегледај датотеку

@@ -1,6 +1,6 @@
1 1
 package antireplay
2 2
 
3
-import "github.com/9seconds/mtg/v2/mtglib"
3
+import "github.com/dolonet/mtg-multi/mtglib"
4 4
 
5 5
 type noop struct{}
6 6
 

+ 1
- 1
antireplay/noop_test.go Прегледај датотеку

@@ -3,7 +3,7 @@ package antireplay_test
3 3
 import (
4 4
 	"testing"
5 5
 
6
-	"github.com/9seconds/mtg/v2/antireplay"
6
+	"github.com/dolonet/mtg-multi/antireplay"
7 7
 	"github.com/stretchr/testify/suite"
8 8
 )
9 9
 

+ 1
- 1
antireplay/stable_bloom_filter.go Прегледај датотеку

@@ -3,7 +3,7 @@ package antireplay
3 3
 import (
4 4
 	"sync"
5 5
 
6
-	"github.com/9seconds/mtg/v2/mtglib"
6
+	"github.com/dolonet/mtg-multi/mtglib"
7 7
 	"github.com/OneOfOne/xxhash"
8 8
 	boom "github.com/tylertreat/BoomFilters"
9 9
 )

+ 2
- 2
antireplay/stable_bloom_filter_test.go Прегледај датотеку

@@ -3,7 +3,7 @@ package antireplay_test
3 3
 import (
4 4
 	"testing"
5 5
 
6
-	"github.com/9seconds/mtg/v2/antireplay"
6
+	"github.com/dolonet/mtg-multi/antireplay"
7 7
 	"github.com/stretchr/testify/suite"
8 8
 )
9 9
 
@@ -12,7 +12,7 @@ type StableBloomFilterTestSuite struct {
12 12
 }
13 13
 
14 14
 func (suite *StableBloomFilterTestSuite) TestOp() {
15
-	filter := antireplay.NewStableBloomFilter(500, 0.001)
15
+	filter := antireplay.NewStableBloomFilter(100000, 0.001)
16 16
 
17 17
 	suite.False(filter.SeenBefore([]byte{1, 2, 3}))
18 18
 	suite.False(filter.SeenBefore([]byte{4, 5, 6}))

+ 1
- 1
events/event_stream.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"math/rand/v2"
6 6
 	"runtime"
7 7
 
8
-	"github.com/9seconds/mtg/v2/mtglib"
8
+	"github.com/dolonet/mtg-multi/mtglib"
9 9
 	"github.com/OneOfOne/xxhash"
10 10
 )
11 11
 

+ 2
- 2
events/event_stream_test.go Прегледај датотеку

@@ -6,8 +6,8 @@ import (
6 6
 	"testing"
7 7
 	"time"
8 8
 
9
-	"github.com/9seconds/mtg/v2/events"
10
-	"github.com/9seconds/mtg/v2/mtglib"
9
+	"github.com/dolonet/mtg-multi/events"
10
+	"github.com/dolonet/mtg-multi/mtglib"
11 11
 	"github.com/stretchr/testify/mock"
12 12
 	"github.com/stretchr/testify/suite"
13 13
 )

+ 1
- 1
events/init.go Прегледај датотеку

@@ -16,7 +16,7 @@
16 16
 // EventStart for that session yet.
17 17
 package events
18 18
 
19
-import "github.com/9seconds/mtg/v2/mtglib"
19
+import "github.com/dolonet/mtg-multi/mtglib"
20 20
 
21 21
 // Observer is an instance that listens for the incoming events.
22 22
 //

+ 1
- 1
events/init_test.go Прегледај датотеку

@@ -1,7 +1,7 @@
1 1
 package events_test
2 2
 
3 3
 import (
4
-	"github.com/9seconds/mtg/v2/mtglib"
4
+	"github.com/dolonet/mtg-multi/mtglib"
5 5
 	"github.com/stretchr/testify/mock"
6 6
 )
7 7
 

+ 1
- 1
events/multi_observer.go Прегледај датотеку

@@ -3,7 +3,7 @@ package events
3 3
 import (
4 4
 	"sync"
5 5
 
6
-	"github.com/9seconds/mtg/v2/mtglib"
6
+	"github.com/dolonet/mtg-multi/mtglib"
7 7
 )
8 8
 
9 9
 type multiObserver struct {

+ 1
- 1
events/noop.go Прегледај датотеку

@@ -3,7 +3,7 @@ package events
3 3
 import (
4 4
 	"context"
5 5
 
6
-	"github.com/9seconds/mtg/v2/mtglib"
6
+	"github.com/dolonet/mtg-multi/mtglib"
7 7
 )
8 8
 
9 9
 type noop struct{}

+ 2
- 2
events/noop_test.go Прегледај датотеку

@@ -5,8 +5,8 @@ import (
5 5
 	"net"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/events"
9
-	"github.com/9seconds/mtg/v2/mtglib"
8
+	"github.com/dolonet/mtg-multi/events"
9
+	"github.com/dolonet/mtg-multi/mtglib"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )
12 12
 

+ 1
- 1
go.mod Прегледај датотеку

@@ -1,4 +1,4 @@
1
-module github.com/9seconds/mtg/v2
1
+module github.com/dolonet/mtg-multi
2 2
 
3 3
 go 1.26
4 4
 

+ 3
- 3
internal/cli/access.go Прегледај датотеку

@@ -10,9 +10,9 @@ import (
10 10
 	"strconv"
11 11
 	"sync"
12 12
 
13
-	"github.com/9seconds/mtg/v2/internal/config"
14
-	"github.com/9seconds/mtg/v2/internal/utils"
15
-	"github.com/9seconds/mtg/v2/mtglib"
13
+	"github.com/dolonet/mtg-multi/internal/config"
14
+	"github.com/dolonet/mtg-multi/internal/utils"
15
+	"github.com/dolonet/mtg-multi/mtglib"
16 16
 )
17 17
 
18 18
 type accessResponseSecret struct {

+ 5
- 5
internal/cli/doctor.go Прегледај датотеку

@@ -13,11 +13,11 @@ import (
13 13
 	"text/template"
14 14
 	"time"
15 15
 
16
-	"github.com/9seconds/mtg/v2/essentials"
17
-	"github.com/9seconds/mtg/v2/internal/config"
18
-	"github.com/9seconds/mtg/v2/internal/utils"
19
-	"github.com/9seconds/mtg/v2/mtglib"
20
-	"github.com/9seconds/mtg/v2/network/v2"
16
+	"github.com/dolonet/mtg-multi/essentials"
17
+	"github.com/dolonet/mtg-multi/internal/config"
18
+	"github.com/dolonet/mtg-multi/internal/utils"
19
+	"github.com/dolonet/mtg-multi/mtglib"
20
+	"github.com/dolonet/mtg-multi/network/v2"
21 21
 	"github.com/beevik/ntp"
22 22
 )
23 23
 

+ 1
- 1
internal/cli/generate_secret.go Прегледај датотеку

@@ -3,7 +3,7 @@ package cli
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/9seconds/mtg/v2/mtglib"
6
+	"github.com/dolonet/mtg-multi/mtglib"
7 7
 )
8 8
 
9 9
 type GenerateSecret struct {

+ 1
- 1
internal/cli/run.go Прегледај датотеку

@@ -3,7 +3,7 @@ package cli
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/9seconds/mtg/v2/internal/utils"
6
+	"github.com/dolonet/mtg-multi/internal/utils"
7 7
 )
8 8
 
9 9
 type Run struct {

+ 11
- 11
internal/cli/run_proxy.go Прегледај датотеку

@@ -7,17 +7,17 @@ import (
7 7
 	"os"
8 8
 	"time"
9 9
 
10
-	"github.com/9seconds/mtg/v2/antireplay"
11
-	"github.com/9seconds/mtg/v2/events"
12
-	"github.com/9seconds/mtg/v2/internal/config"
13
-	"github.com/9seconds/mtg/v2/internal/proxyprotocol"
14
-	"github.com/9seconds/mtg/v2/internal/utils"
15
-	"github.com/9seconds/mtg/v2/ipblocklist"
16
-	"github.com/9seconds/mtg/v2/ipblocklist/files"
17
-	"github.com/9seconds/mtg/v2/logger"
18
-	"github.com/9seconds/mtg/v2/mtglib"
19
-	"github.com/9seconds/mtg/v2/network/v2"
20
-	"github.com/9seconds/mtg/v2/stats"
10
+	"github.com/dolonet/mtg-multi/antireplay"
11
+	"github.com/dolonet/mtg-multi/events"
12
+	"github.com/dolonet/mtg-multi/internal/config"
13
+	"github.com/dolonet/mtg-multi/internal/proxyprotocol"
14
+	"github.com/dolonet/mtg-multi/internal/utils"
15
+	"github.com/dolonet/mtg-multi/ipblocklist"
16
+	"github.com/dolonet/mtg-multi/ipblocklist/files"
17
+	"github.com/dolonet/mtg-multi/logger"
18
+	"github.com/dolonet/mtg-multi/mtglib"
19
+	"github.com/dolonet/mtg-multi/network/v2"
20
+	"github.com/dolonet/mtg-multi/stats"
21 21
 	"github.com/pires/go-proxyproto"
22 22
 	"github.com/rs/zerolog"
23 23
 	"github.com/yl2chen/cidranger"

+ 1
- 1
internal/cli/simple_run.go Прегледај датотеку

@@ -6,7 +6,7 @@ import (
6 6
 	"strconv"
7 7
 	"time"
8 8
 
9
-	"github.com/9seconds/mtg/v2/internal/config"
9
+	"github.com/dolonet/mtg-multi/internal/config"
10 10
 )
11 11
 
12 12
 type SimpleRun struct {

+ 2
- 2
internal/cli/utils.go Прегледај датотеку

@@ -7,8 +7,8 @@ import (
7 7
 	"net/http"
8 8
 	"strings"
9 9
 
10
-	"github.com/9seconds/mtg/v2/essentials"
11
-	"github.com/9seconds/mtg/v2/mtglib"
10
+	"github.com/dolonet/mtg-multi/essentials"
11
+	"github.com/dolonet/mtg-multi/mtglib"
12 12
 )
13 13
 
14 14
 func getIP(ntw mtglib.Network, protocol string) net.IP {

+ 5
- 5
internal/config/config.go Прегледај датотеку

@@ -7,7 +7,7 @@ import (
7 7
 	"net"
8 8
 	"net/url"
9 9
 
10
-	"github.com/9seconds/mtg/v2/mtglib"
10
+	"github.com/dolonet/mtg-multi/mtglib"
11 11
 )
12 12
 
13 13
 type Optional struct {
@@ -53,10 +53,10 @@ type Config struct {
53 53
 		Blocklist    ListConfig `json:"blocklist"`
54 54
 		Allowlist    ListConfig `json:"allowlist"`
55 55
 		Doppelganger struct {
56
-			URLs            []TypeHttpsURL  `json:"urls"`
57
-			Repeats         TypeConcurrency `json:"repeats_per_raid"`
58
-			UpdateEach      TypeDuration    `json:"raid_each"`
59
-			DRS             TypeBool        `json:"drs"`
56
+			URLs       []TypeHttpsURL  `json:"urls"`
57
+			Repeats    TypeConcurrency `json:"repeats_per_raid"`
58
+			UpdateEach TypeDuration    `json:"raid_each"`
59
+			DRS        TypeBool        `json:"drs"`
60 60
 		} `json:"doppelganger"`
61 61
 	} `json:"defense"`
62 62
 	Network struct {

+ 1
- 1
internal/config/config_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"path/filepath"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )
11 11
 

+ 4
- 4
internal/config/parse.go Прегледај датотеку

@@ -48,10 +48,10 @@ type tomlConfig struct {
48 48
 			UpdateEach          string   `toml:"update-each" json:"updateEach,omitempty"`
49 49
 		} `toml:"allowlist" json:"allowlist,omitempty"`
50 50
 		Doppelganger struct {
51
-			URLs            []string `toml:"urls" json:"urls,omitempty"`
52
-			Repeats         uint     `toml:"repeats-per-raid" json:"repeats_per_raid,omitempty"`
53
-			UpdateEach      string   `toml:"raid-each" json:"raid_each,omitempty"`
54
-			DRS             bool     `toml:"drs" json:"drs,omitempty"`
51
+			URLs       []string `toml:"urls" json:"urls,omitempty"`
52
+			Repeats    uint     `toml:"repeats-per-raid" json:"repeats_per_raid,omitempty"`
53
+			UpdateEach string   `toml:"raid-each" json:"raid_each,omitempty"`
54
+			DRS        bool     `toml:"drs" json:"drs,omitempty"`
55 55
 		} `toml:"doppelganger" json:"doppelganger,omitempty"`
56 56
 	} `toml:"defense" json:"defense,omitempty"`
57 57
 	Network struct {

+ 1
- 1
internal/config/type_blocklist_uri_test.go Прегледај датотеку

@@ -7,7 +7,7 @@ import (
7 7
 	"strings"
8 8
 	"testing"
9 9
 
10
-	"github.com/9seconds/mtg/v2/internal/config"
10
+	"github.com/dolonet/mtg-multi/internal/config"
11 11
 	"github.com/stretchr/testify/assert"
12 12
 	"github.com/stretchr/testify/suite"
13 13
 )

+ 1
- 1
internal/config/type_bool_test.go Прегледај датотеку

@@ -6,7 +6,7 @@ import (
6 6
 	"strconv"
7 7
 	"testing"
8 8
 
9
-	"github.com/9seconds/mtg/v2/internal/config"
9
+	"github.com/dolonet/mtg-multi/internal/config"
10 10
 	"github.com/stretchr/testify/assert"
11 11
 	"github.com/stretchr/testify/suite"
12 12
 )

+ 1
- 1
internal/config/type_bytes_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_concurrency_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_dc_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"strconv"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
internal/config/type_dns_uri_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_duration_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"testing"
6 6
 	"time"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
internal/config/type_error_rate_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_hostport_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_http_path_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_https_url_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"net/url"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
internal/config/type_ip_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"net"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
internal/config/type_metric_prefix_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_port_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 	"github.com/stretchr/testify/assert"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
internal/config/type_prefer_ip_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"strings"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
internal/config/type_proxy_url_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"net/url"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
internal/config/type_statsd_tag_format_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"strings"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/config"
8
+	"github.com/dolonet/mtg-multi/internal/config"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
internal/testlib/mtglib_network_mock.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"net"
6 6
 	"net/http"
7 7
 
8
-	"github.com/9seconds/mtg/v2/essentials"
8
+	"github.com/dolonet/mtg-multi/essentials"
9 9
 	"github.com/stretchr/testify/mock"
10 10
 )
11 11
 

+ 1
- 1
internal/utils/make_qr_code_url_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"strings"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/utils"
8
+	"github.com/dolonet/mtg-multi/internal/utils"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )
11 11
 

+ 1
- 1
internal/utils/net_listener.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"fmt"
5 5
 	"net"
6 6
 
7
-	"github.com/9seconds/mtg/v2/network"
7
+	"github.com/dolonet/mtg-multi/network"
8 8
 )
9 9
 
10 10
 type Listener struct {

+ 1
- 1
internal/utils/read_config.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"fmt"
5 5
 	"os"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/config"
7
+	"github.com/dolonet/mtg-multi/internal/config"
8 8
 )
9 9
 
10 10
 func ReadConfig(path string) (*config.Config, error) {

+ 1
- 1
internal/utils/read_config_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"path/filepath"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/utils"
7
+	"github.com/dolonet/mtg-multi/internal/utils"
8 8
 	"github.com/stretchr/testify/suite"
9 9
 )
10 10
 

+ 1
- 1
ipblocklist/files/http_test.go Прегледај датотеку

@@ -8,7 +8,7 @@ import (
8 8
 	"strings"
9 9
 	"testing"
10 10
 
11
-	"github.com/9seconds/mtg/v2/ipblocklist/files"
11
+	"github.com/dolonet/mtg-multi/ipblocklist/files"
12 12
 	"github.com/stretchr/testify/suite"
13 13
 )
14 14
 

+ 1
- 1
ipblocklist/files/local_test.go Прегледај датотеку

@@ -7,7 +7,7 @@ import (
7 7
 	"strings"
8 8
 	"testing"
9 9
 
10
-	"github.com/9seconds/mtg/v2/ipblocklist/files"
10
+	"github.com/dolonet/mtg-multi/ipblocklist/files"
11 11
 	"github.com/stretchr/testify/assert"
12 12
 	"github.com/stretchr/testify/suite"
13 13
 )

+ 1
- 1
ipblocklist/files/mem_test.go Прегледај датотеку

@@ -7,7 +7,7 @@ import (
7 7
 	"strings"
8 8
 	"testing"
9 9
 
10
-	"github.com/9seconds/mtg/v2/ipblocklist/files"
10
+	"github.com/dolonet/mtg-multi/ipblocklist/files"
11 11
 	"github.com/stretchr/testify/suite"
12 12
 )
13 13
 

+ 2
- 2
ipblocklist/firehol.go Прегледај датотеку

@@ -10,8 +10,8 @@ import (
10 10
 	"sync"
11 11
 	"time"
12 12
 
13
-	"github.com/9seconds/mtg/v2/ipblocklist/files"
14
-	"github.com/9seconds/mtg/v2/mtglib"
13
+	"github.com/dolonet/mtg-multi/ipblocklist/files"
14
+	"github.com/dolonet/mtg-multi/mtglib"
15 15
 	"github.com/panjf2000/ants/v2"
16 16
 	"github.com/yl2chen/cidranger"
17 17
 )

+ 4
- 4
ipblocklist/firehol_test.go Прегледај датотеку

@@ -10,10 +10,10 @@ import (
10 10
 	"testing"
11 11
 	"time"
12 12
 
13
-	"github.com/9seconds/mtg/v2/internal/testlib"
14
-	"github.com/9seconds/mtg/v2/ipblocklist"
15
-	"github.com/9seconds/mtg/v2/logger"
16
-	"github.com/9seconds/mtg/v2/network"
13
+	"github.com/dolonet/mtg-multi/internal/testlib"
14
+	"github.com/dolonet/mtg-multi/ipblocklist"
15
+	"github.com/dolonet/mtg-multi/logger"
16
+	"github.com/dolonet/mtg-multi/network"
17 17
 	"github.com/jarcoal/httpmock"
18 18
 	"github.com/stretchr/testify/mock"
19 19
 	"github.com/stretchr/testify/suite"

+ 1
- 1
ipblocklist/noop.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"net"
5 5
 	"time"
6 6
 
7
-	"github.com/9seconds/mtg/v2/mtglib"
7
+	"github.com/dolonet/mtg-multi/mtglib"
8 8
 )
9 9
 
10 10
 type noop struct{}

+ 1
- 1
ipblocklist/noop_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"net"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/ipblocklist"
7
+	"github.com/dolonet/mtg-multi/ipblocklist"
8 8
 	"github.com/stretchr/testify/suite"
9 9
 )
10 10
 

+ 1
- 1
logger/noop.go Прегледај датотеку

@@ -1,6 +1,6 @@
1 1
 package logger
2 2
 
3
-import "github.com/9seconds/mtg/v2/mtglib"
3
+import "github.com/dolonet/mtg-multi/mtglib"
4 4
 
5 5
 type noopLogger struct{}
6 6
 

+ 2
- 2
logger/noop_test.go Прегледај датотеку

@@ -4,8 +4,8 @@ import (
4 4
 	"io"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/testlib"
8
-	"github.com/9seconds/mtg/v2/logger"
7
+	"github.com/dolonet/mtg-multi/internal/testlib"
8
+	"github.com/dolonet/mtg-multi/logger"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )
11 11
 

+ 1
- 1
logger/zerolog.go Прегледај датотеку

@@ -3,7 +3,7 @@ package logger
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/9seconds/mtg/v2/mtglib"
6
+	"github.com/dolonet/mtg-multi/mtglib"
7 7
 	"github.com/rs/zerolog"
8 8
 )
9 9
 

+ 2
- 2
logger/zerolog_test.go Прегледај датотеку

@@ -8,8 +8,8 @@ import (
8 8
 	"testing"
9 9
 	"time"
10 10
 
11
-	"github.com/9seconds/mtg/v2/logger"
12
-	"github.com/9seconds/mtg/v2/mtglib"
11
+	"github.com/dolonet/mtg-multi/logger"
12
+	"github.com/dolonet/mtg-multi/mtglib"
13 13
 	"github.com/rs/zerolog"
14 14
 	"github.com/stretchr/testify/assert"
15 15
 	"github.com/stretchr/testify/suite"

+ 1
- 1
main.go Прегледај датотеку

@@ -9,7 +9,7 @@
9 9
 package main
10 10
 
11 11
 import (
12
-	"github.com/9seconds/mtg/v2/internal/cli"
12
+	"github.com/dolonet/mtg-multi/internal/cli"
13 13
 	"github.com/alecthomas/kong"
14 14
 )
15 15
 

+ 51
- 6
mtglib/conns.go Прегледај датотеку

@@ -3,12 +3,14 @@ package mtglib
3 3
 import (
4 4
 	"bytes"
5 5
 	"context"
6
+	"errors"
6 7
 	"fmt"
7 8
 	"io"
8 9
 	"net"
10
+	"sync/atomic"
9 11
 	"time"
10 12
 
11
-	"github.com/9seconds/mtg/v2/essentials"
13
+	"github.com/dolonet/mtg-multi/essentials"
12 14
 	"github.com/pires/go-proxyproto"
13 15
 )
14 16
 
@@ -97,20 +99,63 @@ func newConnProxyProtocol(source, target essentials.Conn) *connProxyProtocol {
97 99
 	}
98 100
 }
99 101
 
102
+// idleTracker is a shared idle tracker for a pair of relay connections.
103
+// Both directions update the same timestamp so that activity in one direction
104
+// prevents the other (idle) direction from timing out.
105
+type idleTracker struct {
106
+	lastActive atomic.Pointer[time.Time]
107
+	timeout    time.Duration
108
+}
109
+
110
+func newIdleTracker(timeout time.Duration) *idleTracker {
111
+	t := &idleTracker{timeout: timeout}
112
+	t.touch()
113
+
114
+	return t
115
+}
116
+
117
+func (t *idleTracker) touch() {
118
+	stamp := time.Now()
119
+	t.lastActive.Store(&stamp)
120
+}
121
+
122
+func (t *idleTracker) isIdle() bool {
123
+	return time.Since(*t.lastActive.Load()) >= t.timeout
124
+}
125
+
100 126
 type connIdleTimeout struct {
101 127
 	essentials.Conn
102 128
 
103
-	timeout time.Duration
129
+	tracker *idleTracker
104 130
 }
105 131
 
106 132
 func (c connIdleTimeout) Read(b []byte) (int, error) {
107
-	c.SetReadDeadline(time.Now().Add(c.timeout)) //nolint: errcheck
133
+	var netErr net.Error
134
+
135
+	for {
136
+		c.SetReadDeadline(time.Now().Add(c.tracker.timeout)) //nolint: errcheck
108 137
 
109
-	return c.Conn.Read(b) //nolint: wrapcheck
138
+		n, err := c.Conn.Read(b)
139
+
140
+		switch {
141
+		case err == nil:
142
+			c.tracker.touch()
143
+			return n, nil
144
+		case errors.As(err, &netErr) && netErr.Timeout() && !c.tracker.isIdle():
145
+			continue
146
+		}
147
+
148
+		return n, err
149
+	}
110 150
 }
111 151
 
112 152
 func (c connIdleTimeout) Write(b []byte) (int, error) {
113
-	c.SetWriteDeadline(time.Now().Add(c.timeout)) //nolint: errcheck
153
+	c.SetWriteDeadline(time.Now().Add(c.tracker.timeout)) //nolint: errcheck
114 154
 
115
-	return c.Conn.Write(b) //nolint: wrapcheck
155
+	n, err := c.Conn.Write(b)
156
+	if n > 0 {
157
+		c.tracker.touch()
158
+	}
159
+
160
+	return n, err //nolint: wrapcheck
116 161
 }

+ 152
- 1
mtglib/conns_internal_test.go Прегледај датотеку

@@ -10,12 +10,18 @@ import (
10 10
 	"testing"
11 11
 	"time"
12 12
 
13
-	"github.com/9seconds/mtg/v2/internal/testlib"
13
+	"github.com/dolonet/mtg-multi/internal/testlib"
14 14
 	"github.com/pires/go-proxyproto"
15 15
 	"github.com/stretchr/testify/mock"
16 16
 	"github.com/stretchr/testify/suite"
17 17
 )
18 18
 
19
+type netTimeoutError struct{}
20
+
21
+func (e netTimeoutError) Error() string   { return "i/o timeout" }
22
+func (e netTimeoutError) Timeout() bool   { return true }
23
+func (e netTimeoutError) Temporary() bool { return true }
24
+
19 25
 type ConnRewindBaseConn struct {
20 26
 	testlib.EssentialsConnMock
21 27
 
@@ -291,6 +297,141 @@ func (suite *ConnProxyProtocolTestSuite) TearDownTest() {
291 297
 	suite.targetConnMock.AssertExpectations(suite.T())
292 298
 }
293 299
 
300
+type IdleTrackerTestSuite struct {
301
+	suite.Suite
302
+}
303
+
304
+func (suite *IdleTrackerTestSuite) TestNewNotIdle() {
305
+	tracker := newIdleTracker(time.Second)
306
+	suite.False(tracker.isIdle())
307
+}
308
+
309
+func (suite *IdleTrackerTestSuite) TestIdleAfterTimeout() {
310
+	tracker := newIdleTracker(10 * time.Millisecond)
311
+	time.Sleep(20 * time.Millisecond)
312
+
313
+	suite.True(tracker.isIdle())
314
+}
315
+
316
+func (suite *IdleTrackerTestSuite) TestTouchResetsIdle() {
317
+	tracker := newIdleTracker(50 * time.Millisecond)
318
+	time.Sleep(30 * time.Millisecond)
319
+
320
+	tracker.touch()
321
+
322
+	suite.False(tracker.isIdle())
323
+}
324
+
325
+type ConnIdleTimeoutTestSuite struct {
326
+	suite.Suite
327
+
328
+	connMock *testlib.EssentialsConnMock
329
+	tracker  *idleTracker
330
+	conn     connIdleTimeout
331
+}
332
+
333
+func (suite *ConnIdleTimeoutTestSuite) SetupTest() {
334
+	suite.connMock = &testlib.EssentialsConnMock{}
335
+	suite.tracker = newIdleTracker(time.Second)
336
+	suite.conn = connIdleTimeout{
337
+		Conn:    suite.connMock,
338
+		tracker: suite.tracker,
339
+	}
340
+}
341
+
342
+func (suite *ConnIdleTimeoutTestSuite) TearDownTest() {
343
+	suite.connMock.AssertExpectations(suite.T())
344
+}
345
+
346
+func (suite *ConnIdleTimeoutTestSuite) TestReadOk() {
347
+	suite.connMock.On("SetReadDeadline", mock.Anything).Return(nil)
348
+	suite.connMock.On("Read", mock.Anything).Once().Return(5, nil)
349
+
350
+	n, err := suite.conn.Read(make([]byte, 10))
351
+	suite.NoError(err)
352
+	suite.Equal(5, n)
353
+}
354
+
355
+func (suite *ConnIdleTimeoutTestSuite) TestReadNonTimeoutErr() {
356
+	suite.connMock.On("SetReadDeadline", mock.Anything).Return(nil)
357
+	suite.connMock.On("Read", mock.Anything).Once().Return(0, io.EOF)
358
+
359
+	n, err := suite.conn.Read(make([]byte, 10))
360
+	suite.True(errors.Is(err, io.EOF))
361
+	suite.Equal(0, n)
362
+}
363
+
364
+func (suite *ConnIdleTimeoutTestSuite) TestReadTimeoutRetriesWhenNotIdle() {
365
+	suite.connMock.On("SetReadDeadline", mock.Anything).Return(nil)
366
+	suite.connMock.On("Read", mock.Anything).Once().Return(0, netTimeoutError{})
367
+	suite.connMock.On("Read", mock.Anything).Once().Return(5, nil)
368
+
369
+	n, err := suite.conn.Read(make([]byte, 10))
370
+	suite.NoError(err)
371
+	suite.Equal(5, n)
372
+}
373
+
374
+func (suite *ConnIdleTimeoutTestSuite) TestReadTimeoutClosesWhenIdle() {
375
+	suite.tracker = newIdleTracker(time.Millisecond)
376
+	suite.conn = connIdleTimeout{
377
+		Conn:    suite.connMock,
378
+		tracker: suite.tracker,
379
+	}
380
+
381
+	time.Sleep(5 * time.Millisecond)
382
+
383
+	suite.connMock.On("SetReadDeadline", mock.Anything).Return(nil)
384
+	suite.connMock.On("Read", mock.Anything).Once().Return(0, netTimeoutError{})
385
+
386
+	n, err := suite.conn.Read(make([]byte, 10))
387
+	suite.Equal(0, n)
388
+
389
+	netErr, ok := err.(net.Error) //nolint: errorlint
390
+	suite.True(ok)
391
+	suite.True(netErr.Timeout())
392
+}
393
+
394
+func (suite *ConnIdleTimeoutTestSuite) TestSharedTrackerPreventsFalseTimeout() {
395
+	connMock2 := &testlib.EssentialsConnMock{}
396
+	conn2 := connIdleTimeout{
397
+		Conn:    connMock2,
398
+		tracker: suite.tracker,
399
+	}
400
+
401
+	connMock2.On("SetWriteDeadline", mock.Anything).Return(nil)
402
+	connMock2.On("Write", mock.Anything).Once().Return(5, nil)
403
+
404
+	_, _ = conn2.Write(make([]byte, 5))
405
+
406
+	suite.connMock.On("SetReadDeadline", mock.Anything).Return(nil)
407
+	suite.connMock.On("Read", mock.Anything).Once().Return(0, netTimeoutError{})
408
+	suite.connMock.On("Read", mock.Anything).Once().Return(3, nil)
409
+
410
+	n, err := suite.conn.Read(make([]byte, 10))
411
+	suite.NoError(err)
412
+	suite.Equal(3, n)
413
+
414
+	connMock2.AssertExpectations(suite.T())
415
+}
416
+
417
+func (suite *ConnIdleTimeoutTestSuite) TestWriteOk() {
418
+	suite.connMock.On("SetWriteDeadline", mock.Anything).Return(nil)
419
+	suite.connMock.On("Write", mock.Anything).Once().Return(5, nil)
420
+
421
+	n, err := suite.conn.Write(make([]byte, 5))
422
+	suite.NoError(err)
423
+	suite.Equal(5, n)
424
+}
425
+
426
+func (suite *ConnIdleTimeoutTestSuite) TestWriteErr() {
427
+	suite.connMock.On("SetWriteDeadline", mock.Anything).Return(nil)
428
+	suite.connMock.On("Write", mock.Anything).Once().Return(0, io.EOF)
429
+
430
+	n, err := suite.conn.Write(make([]byte, 5))
431
+	suite.True(errors.Is(err, io.EOF))
432
+	suite.Equal(0, n)
433
+}
434
+
294 435
 func TestConnTraffic(t *testing.T) {
295 436
 	t.Parallel()
296 437
 	suite.Run(t, &ConnTrafficTestSuite{})
@@ -305,3 +446,13 @@ func TestConnProxyProtocol(t *testing.T) {
305 446
 	t.Parallel()
306 447
 	suite.Run(t, &ConnProxyProtocolTestSuite{})
307 448
 }
449
+
450
+func TestIdleTracker(t *testing.T) {
451
+	t.Parallel()
452
+	suite.Run(t, &IdleTrackerTestSuite{})
453
+}
454
+
455
+func TestConnIdleTimeout(t *testing.T) {
456
+	t.Parallel()
457
+	suite.Run(t, &ConnIdleTimeoutTestSuite{})
458
+}

+ 1
- 1
mtglib/counting_conn.go Прегледај датотеку

@@ -1,7 +1,7 @@
1 1
 package mtglib
2 2
 
3 3
 import (
4
-	"github.com/9seconds/mtg/v2/essentials"
4
+	"github.com/dolonet/mtg-multi/essentials"
5 5
 )
6 6
 
7 7
 // countingConn wraps essentials.Conn and counts bytes through a cached

+ 1
- 1
mtglib/events_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"testing"
6 6
 	"time"
7 7
 
8
-	"github.com/9seconds/mtg/v2/mtglib"
8
+	"github.com/dolonet/mtg-multi/mtglib"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )
11 11
 

+ 1
- 1
mtglib/init.go Прегледај датотеку

@@ -23,7 +23,7 @@ import (
23 23
 	"net/http"
24 24
 	"time"
25 25
 
26
-	"github.com/9seconds/mtg/v2/essentials"
26
+	"github.com/dolonet/mtg-multi/essentials"
27 27
 )
28 28
 
29 29
 var (

+ 1
- 1
mtglib/internal/dc/addr.go Прегледај датотеку

@@ -3,7 +3,7 @@ package dc
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/9seconds/mtg/v2/mtglib/internal/obfuscation"
6
+	"github.com/dolonet/mtg-multi/mtglib/internal/obfuscation"
7 7
 )
8 8
 
9 9
 type Addr struct {

+ 1
- 1
mtglib/internal/dc/init.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"net"
6 6
 	"time"
7 7
 
8
-	"github.com/9seconds/mtg/v2/essentials"
8
+	"github.com/dolonet/mtg-multi/essentials"
9 9
 )
10 10
 
11 11
 type preferIP uint8

+ 6
- 2
mtglib/internal/dc/view.go Прегледај датотеку

@@ -5,15 +5,19 @@ type dcView struct {
5 5
 }
6 6
 
7 7
 func (d dcView) getV4(dc int) []Addr {
8
-	addrs := d.publicConfigs.getV4(dc)
8
+	var addrs []Addr
9
+
9 10
 	addrs = append(addrs, defaultDCAddrSet.getV4(dc)...)
11
+	addrs = append(addrs, d.publicConfigs.getV4(dc)...)
10 12
 
11 13
 	return addrs
12 14
 }
13 15
 
14 16
 func (d dcView) getV6(dc int) []Addr {
15
-	addrs := d.publicConfigs.getV6(dc)
17
+	var addrs []Addr
18
+
16 19
 	addrs = append(addrs, defaultDCAddrSet.getV6(dc)...)
20
+	addrs = append(addrs, d.publicConfigs.getV6(dc)...)
17 21
 
18 22
 	return addrs
19 23
 }

+ 2
- 2
mtglib/internal/doppel/conn.go Прегледај датотеку

@@ -6,8 +6,8 @@ import (
6 6
 	"sync"
7 7
 	"time"
8 8
 
9
-	"github.com/9seconds/mtg/v2/essentials"
10
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
9
+	"github.com/dolonet/mtg-multi/essentials"
10
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
11 11
 )
12 12
 
13 13
 var doppelBufPool = sync.Pool{

+ 2
- 2
mtglib/internal/doppel/conn_test.go Прегледај датотеку

@@ -10,8 +10,8 @@ import (
10 10
 	"testing"
11 11
 	"time"
12 12
 
13
-	"github.com/9seconds/mtg/v2/internal/testlib"
14
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
13
+	"github.com/dolonet/mtg-multi/internal/testlib"
14
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
15 15
 	"github.com/stretchr/testify/mock"
16 16
 	"github.com/stretchr/testify/suite"
17 17
 )

+ 1
- 1
mtglib/internal/doppel/ganger.go Прегледај датотеку

@@ -7,7 +7,7 @@ import (
7 7
 	"sync/atomic"
8 8
 	"time"
9 9
 
10
-	"github.com/9seconds/mtg/v2/essentials"
10
+	"github.com/dolonet/mtg-multi/essentials"
11 11
 )
12 12
 
13 13
 const (

+ 1
- 1
mtglib/internal/doppel/ganger_test.go Прегледај датотеку

@@ -6,7 +6,7 @@ import (
6 6
 	"testing"
7 7
 	"time"
8 8
 
9
-	"github.com/9seconds/mtg/v2/internal/testlib"
9
+	"github.com/dolonet/mtg-multi/internal/testlib"
10 10
 	"github.com/stretchr/testify/mock"
11 11
 	"github.com/stretchr/testify/suite"
12 12
 )

+ 2
- 2
mtglib/internal/doppel/init.go Прегледај датотеку

@@ -6,8 +6,8 @@ import (
6 6
 	"net/http"
7 7
 	"time"
8 8
 
9
-	"github.com/9seconds/mtg/v2/essentials"
10
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
9
+	"github.com/dolonet/mtg-multi/essentials"
10
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
11 11
 )
12 12
 
13 13
 const (

+ 1
- 1
mtglib/internal/doppel/init_test.go Прегледај датотеку

@@ -8,7 +8,7 @@ import (
8 8
 	"net/http/httptest"
9 9
 	"time"
10 10
 
11
-	"github.com/9seconds/mtg/v2/essentials"
11
+	"github.com/dolonet/mtg-multi/essentials"
12 12
 	"github.com/stretchr/testify/mock"
13 13
 	"github.com/stretchr/testify/suite"
14 14
 )

+ 14
- 8
mtglib/internal/doppel/scout.go Прегледај датотеку

@@ -8,8 +8,8 @@ import (
8 8
 	"strings"
9 9
 	"time"
10 10
 
11
-	"github.com/9seconds/mtg/v2/essentials"
12
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
11
+	"github.com/dolonet/mtg-multi/essentials"
12
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
13 13
 )
14 14
 
15 15
 // ScoutResult holds measurements from a single scout HTTP request.
@@ -61,23 +61,29 @@ func (s Scout) learn(ctx context.Context, url string) (ScoutResult, error) {
61 61
 		client.CloseIdleConnections()
62 62
 	}
63 63
 
64
-	if err != nil || len(results.data) == 0 {
64
+	if err != nil {
65 65
 		return ScoutResult{}, err
66 66
 	}
67 67
 
68
+	data, writeIndex := results.Snapshot()
69
+
70
+	if len(data) == 0 {
71
+		return ScoutResult{}, nil
72
+	}
73
+
68 74
 	var result ScoutResult
69 75
 
70 76
 	// Compute inter-record durations (existing logic).
71 77
 	lastTimestamp := time.Time{}
72 78
 
73
-	for i, v := range results.data {
79
+	for i, v := range data {
74 80
 		if v.recordType != tls.TypeApplicationData {
75 81
 			continue
76 82
 		}
77 83
 
78 84
 		if lastTimestamp.IsZero() {
79 85
 			if i > 0 {
80
-				lastTimestamp = results.data[i-1].timestamp
86
+				lastTimestamp = data[i-1].timestamp
81 87
 			} else {
82 88
 				lastTimestamp = v.timestamp
83 89
 			}
@@ -90,12 +96,12 @@ func (s Scout) learn(ctx context.Context, url string) (ScoutResult, error) {
90 96
 	// Compute cert size: sum of ApplicationData payload between CCS and
91 97
 	// the first client Write (which marks the end of server handshake).
92 98
 	seenCCS := false
93
-	boundary := results.writeIndex
99
+	boundary := writeIndex
94 100
 	if boundary < 0 {
95
-		boundary = len(results.data)
101
+		boundary = len(data)
96 102
 	}
97 103
 
98
-	for i, v := range results.data {
104
+	for i, v := range data {
99 105
 		if i >= boundary {
100 106
 			break
101 107
 		}

+ 2
- 2
mtglib/internal/doppel/scout_conn.go Прегледај датотеку

@@ -5,8 +5,8 @@ import (
5 5
 	"encoding/binary"
6 6
 	"io"
7 7
 
8
-	"github.com/9seconds/mtg/v2/essentials"
9
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
8
+	"github.com/dolonet/mtg-multi/essentials"
9
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
10 10
 )
11 11
 
12 12
 type ScoutConn struct {

+ 20
- 1
mtglib/internal/doppel/scout_conn_collected.go Прегледај датотеку

@@ -1,6 +1,10 @@
1 1
 package doppel
2 2
 
3
-import "time"
3
+import (
4
+	"slices"
5
+	"sync"
6
+	"time"
7
+)
4 8
 
5 9
 const (
6 10
 	ScoutConnCollectedPreallocSize = 100
@@ -13,23 +17,38 @@ type ScoutConnResult struct {
13 17
 }
14 18
 
15 19
 type ScoutConnCollected struct {
20
+	mu         sync.Mutex
16 21
 	data       []ScoutConnResult
17 22
 	writeIndex int // index at which client first wrote post-handshake data; -1 if not set
18 23
 }
19 24
 
20 25
 func (s *ScoutConnCollected) Add(record byte, payloadLen int) {
26
+	s.mu.Lock()
21 27
 	s.data = append(s.data, ScoutConnResult{
22 28
 		timestamp:  time.Now(),
23 29
 		recordType: record,
24 30
 		payloadLen: payloadLen,
25 31
 	})
32
+	s.mu.Unlock()
26 33
 }
27 34
 
28 35
 // MarkWrite records the current data length as the handshake boundary.
29 36
 func (s *ScoutConnCollected) MarkWrite() {
37
+	s.mu.Lock()
30 38
 	if s.writeIndex < 0 {
31 39
 		s.writeIndex = len(s.data)
32 40
 	}
41
+	s.mu.Unlock()
42
+}
43
+
44
+// Snapshot returns a copy of the collected data and the write index.
45
+func (s *ScoutConnCollected) Snapshot() ([]ScoutConnResult, int) {
46
+	s.mu.Lock()
47
+	snapshot := slices.Clone(s.data)
48
+	writeIndex := s.writeIndex
49
+	s.mu.Unlock()
50
+
51
+	return snapshot, writeIndex
33 52
 }
34 53
 
35 54
 func NewScoutConnCollected() *ScoutConnCollected {

+ 49
- 5
mtglib/internal/doppel/scout_conn_collected_test.go Прегледај датотеку

@@ -1,10 +1,11 @@
1 1
 package doppel
2 2
 
3 3
 import (
4
+	"sync"
4 5
 	"testing"
5 6
 	"time"
6 7
 
7
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
8
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
8 9
 	"github.com/stretchr/testify/suite"
9 10
 )
10 11
 
@@ -16,8 +17,10 @@ func (suite *ScoutConnCollectedTestSuite) TestAddSingle() {
16 17
 	collected := NewScoutConnCollected()
17 18
 	collected.Add(tls.TypeApplicationData, 100)
18 19
 
19
-	suite.Len(collected.data, 1)
20
-	suite.Equal(byte(tls.TypeApplicationData), collected.data[0].recordType)
20
+	data, _ := collected.Snapshot()
21
+
22
+	suite.Len(data, 1)
23
+	suite.Equal(byte(tls.TypeApplicationData), data[0].recordType)
21 24
 }
22 25
 
23 26
 func (suite *ScoutConnCollectedTestSuite) TestAddTimestampsAreMonotonic() {
@@ -31,11 +34,52 @@ func (suite *ScoutConnCollectedTestSuite) TestAddTimestampsAreMonotonic() {
31 34
 	time.Sleep(time.Microsecond)
32 35
 	collected.Add(tls.TypeApplicationData, 100)
33 36
 
34
-	for i := 1; i < len(collected.data); i++ {
35
-		suite.True(collected.data[i].timestamp.After(collected.data[i-1].timestamp))
37
+	data, _ := collected.Snapshot()
38
+
39
+	for i := 1; i < len(data); i++ {
40
+		suite.True(data[i].timestamp.After(data[i-1].timestamp))
36 41
 	}
37 42
 }
38 43
 
44
+func (suite *ScoutConnCollectedTestSuite) TestConcurrentAddSnapshot() {
45
+	collected := NewScoutConnCollected()
46
+
47
+	var wg sync.WaitGroup
48
+
49
+	wg.Add(3)
50
+
51
+	go func() {
52
+		defer wg.Done()
53
+
54
+		for i := 0; i < 1000; i++ {
55
+			collected.Add(tls.TypeApplicationData, i)
56
+		}
57
+	}()
58
+
59
+	go func() {
60
+		defer wg.Done()
61
+
62
+		for i := 0; i < 100; i++ {
63
+			collected.MarkWrite()
64
+		}
65
+	}()
66
+
67
+	go func() {
68
+		defer wg.Done()
69
+
70
+		for i := 0; i < 1000; i++ {
71
+			// call Snapshot concurrently to exercise the lock under -race
72
+			collected.Snapshot() //nolint:errcheck
73
+		}
74
+	}()
75
+
76
+	wg.Wait()
77
+
78
+	data, writeIndex := collected.Snapshot()
79
+	suite.Len(data, 1000)
80
+	suite.GreaterOrEqual(writeIndex, 0)
81
+}
82
+
39 83
 func TestScoutConnCollected(t *testing.T) {
40 84
 	t.Parallel()
41 85
 	suite.Run(t, &ScoutConnCollectedTestSuite{})

+ 1
- 1
mtglib/internal/obfuscation/conn.go Прегледај датотеку

@@ -3,7 +3,7 @@ package obfuscation
3 3
 import (
4 4
 	"crypto/cipher"
5 5
 
6
-	"github.com/9seconds/mtg/v2/essentials"
6
+	"github.com/dolonet/mtg-multi/essentials"
7 7
 )
8 8
 
9 9
 type conn struct {

+ 2
- 2
mtglib/internal/obfuscation/conn_test.go Прегледај датотеку

@@ -6,8 +6,8 @@ import (
6 6
 	"encoding/hex"
7 7
 	"testing"
8 8
 
9
-	"github.com/9seconds/mtg/v2/essentials"
10
-	"github.com/9seconds/mtg/v2/internal/testlib"
9
+	"github.com/dolonet/mtg-multi/essentials"
10
+	"github.com/dolonet/mtg-multi/internal/testlib"
11 11
 	"github.com/stretchr/testify/assert"
12 12
 	"github.com/stretchr/testify/mock"
13 13
 	"github.com/stretchr/testify/suite"

+ 1
- 1
mtglib/internal/obfuscation/obfuscator.go Прегледај датотеку

@@ -10,7 +10,7 @@ import (
10 10
 	"hash"
11 11
 	"io"
12 12
 
13
-	"github.com/9seconds/mtg/v2/essentials"
13
+	"github.com/dolonet/mtg-multi/essentials"
14 14
 )
15 15
 
16 16
 type Obfuscator struct {

+ 3
- 3
mtglib/internal/obfuscation/obfuscator_fuzz_test.go Прегледај датотеку

@@ -4,9 +4,9 @@ import (
4 4
 	"bytes"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/testlib"
8
-	"github.com/9seconds/mtg/v2/mtglib"
9
-	"github.com/9seconds/mtg/v2/mtglib/internal/obfuscation"
7
+	"github.com/dolonet/mtg-multi/internal/testlib"
8
+	"github.com/dolonet/mtg-multi/mtglib"
9
+	"github.com/dolonet/mtg-multi/mtglib/internal/obfuscation"
10 10
 	"github.com/stretchr/testify/assert"
11 11
 	"github.com/stretchr/testify/mock"
12 12
 )

+ 3
- 3
mtglib/internal/obfuscation/obfuscator_test.go Прегледај датотеку

@@ -4,9 +4,9 @@ import (
4 4
 	"bytes"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/testlib"
8
-	"github.com/9seconds/mtg/v2/mtglib"
9
-	"github.com/9seconds/mtg/v2/mtglib/internal/obfuscation"
7
+	"github.com/dolonet/mtg-multi/internal/testlib"
8
+	"github.com/dolonet/mtg-multi/mtglib"
9
+	"github.com/dolonet/mtg-multi/mtglib/internal/obfuscation"
10 10
 	"github.com/stretchr/testify/assert"
11 11
 	"github.com/stretchr/testify/mock"
12 12
 	"github.com/stretchr/testify/require"

+ 1
- 1
mtglib/internal/relay/pool_settings_constrained.go Прегледај датотеку

@@ -2,7 +2,7 @@
2 2
 
3 3
 package relay
4 4
 
5
-import "github.com/9seconds/mtg/v2/mtglib/internal/tls"
5
+import "github.com/dolonet/mtg-multi/mtglib/internal/tls"
6 6
 
7 7
 const (
8 8
 	// MIPS is quite short in resources, and usually it means that it will run

+ 1
- 1
mtglib/internal/relay/pool_settings_other.go Прегледај датотеку

@@ -2,7 +2,7 @@
2 2
 
3 3
 package relay
4 4
 
5
-import "github.com/9seconds/mtg/v2/mtglib/internal/tls"
5
+import "github.com/dolonet/mtg-multi/mtglib/internal/tls"
6 6
 
7 7
 const (
8 8
 	bufPoolSize = tls.MaxRecordPayloadSize

+ 1
- 1
mtglib/internal/relay/relay.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"errors"
6 6
 	"io"
7 7
 
8
-	"github.com/9seconds/mtg/v2/essentials"
8
+	"github.com/dolonet/mtg-multi/essentials"
9 9
 )
10 10
 
11 11
 func Relay(ctx context.Context, log Logger, telegramConn, clientConn essentials.Conn) {

+ 2
- 2
mtglib/internal/relay/relay_bench_test.go Прегледај датотеку

@@ -13,8 +13,8 @@ import (
13 13
 	"sync/atomic"
14 14
 	"testing"
15 15
 
16
-	"github.com/9seconds/mtg/v2/essentials"
17
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
16
+	"github.com/dolonet/mtg-multi/essentials"
17
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
18 18
 )
19 19
 
20 20
 // mockConn wraps a net.Conn to satisfy essentials.Conn.

+ 2
- 2
mtglib/internal/relay/relay_test.go Прегледај датотеку

@@ -5,8 +5,8 @@ import (
5 5
 	"io"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/testlib"
9
-	"github.com/9seconds/mtg/v2/mtglib/internal/relay"
8
+	"github.com/dolonet/mtg-multi/internal/testlib"
9
+	"github.com/dolonet/mtg-multi/mtglib/internal/relay"
10 10
 	"github.com/stretchr/testify/mock"
11 11
 	"github.com/stretchr/testify/suite"
12 12
 )

+ 1
- 1
mtglib/internal/relay/stack_bench_test.go Прегледај датотеку

@@ -6,7 +6,7 @@ import (
6 6
 	"sync"
7 7
 	"testing"
8 8
 
9
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
9
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
10 10
 )
11 11
 
12 12
 // BenchmarkStackVsPool measures memory consumption when N goroutines hold

+ 1
- 1
mtglib/internal/relay/stress_bench_test.go Прегледај датотеку

@@ -10,7 +10,7 @@ import (
10 10
 	"testing"
11 11
 	"time"
12 12
 
13
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
13
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
14 14
 )
15 15
 
16 16
 // ============================================================

+ 1
- 1
mtglib/internal/tls/conn.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"bufio"
5 5
 	"bytes"
6 6
 
7
-	"github.com/9seconds/mtg/v2/essentials"
7
+	"github.com/dolonet/mtg-multi/essentials"
8 8
 )
9 9
 
10 10
 const (

+ 1
- 1
mtglib/internal/tls/conn_test.go Прегледај датотеку

@@ -4,7 +4,7 @@ import (
4 4
 	"io"
5 5
 	"testing"
6 6
 
7
-	"github.com/9seconds/mtg/v2/internal/testlib"
7
+	"github.com/dolonet/mtg-multi/internal/testlib"
8 8
 	"github.com/stretchr/testify/mock"
9 9
 	"github.com/stretchr/testify/suite"
10 10
 )

+ 1
- 1
mtglib/internal/tls/fake/client_side.go Прегледај датотеку

@@ -12,7 +12,7 @@ import (
12 12
 	"slices"
13 13
 	"time"
14 14
 
15
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
15
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
16 16
 )
17 17
 
18 18
 const (

+ 3
- 3
mtglib/internal/tls/fake/client_side_fuzz_test.go Прегледај датотеку

@@ -5,9 +5,9 @@ import (
5 5
 	"testing"
6 6
 	"time"
7 7
 
8
-	"github.com/9seconds/mtg/v2/internal/testlib"
9
-	"github.com/9seconds/mtg/v2/mtglib"
10
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls/fake"
8
+	"github.com/dolonet/mtg-multi/internal/testlib"
9
+	"github.com/dolonet/mtg-multi/mtglib"
10
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls/fake"
11 11
 	"github.com/stretchr/testify/assert"
12 12
 	"github.com/stretchr/testify/mock"
13 13
 	"github.com/stretchr/testify/require"

+ 2
- 2
mtglib/internal/tls/fake/client_side_snapshot_test.go Прегледај датотеку

@@ -9,8 +9,8 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 
12
-	"github.com/9seconds/mtg/v2/mtglib"
13
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls/fake"
12
+	"github.com/dolonet/mtg-multi/mtglib"
13
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls/fake"
14 14
 	"github.com/stretchr/testify/assert"
15 15
 	"github.com/stretchr/testify/mock"
16 16
 	"github.com/stretchr/testify/require"

+ 4
- 4
mtglib/internal/tls/fake/client_side_test.go Прегледај датотеку

@@ -11,10 +11,10 @@ import (
11 11
 	"testing"
12 12
 	"time"
13 13
 
14
-	"github.com/9seconds/mtg/v2/internal/testlib"
15
-	"github.com/9seconds/mtg/v2/mtglib"
16
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
17
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls/fake"
14
+	"github.com/dolonet/mtg-multi/internal/testlib"
15
+	"github.com/dolonet/mtg-multi/mtglib"
16
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
17
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls/fake"
18 18
 	"github.com/stretchr/testify/mock"
19 19
 	"github.com/stretchr/testify/require"
20 20
 	"github.com/stretchr/testify/suite"

+ 1
- 1
mtglib/internal/tls/fake/server_side.go Прегледај датотеку

@@ -9,7 +9,7 @@ import (
9 9
 	"io"
10 10
 	rnd "math/rand/v2"
11 11
 
12
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
12
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
13 13
 	"golang.org/x/crypto/curve25519"
14 14
 )
15 15
 

+ 3
- 3
mtglib/internal/tls/fake/server_side_test.go Прегледај датотеку

@@ -7,9 +7,9 @@ import (
7 7
 	"crypto/sha256"
8 8
 	"testing"
9 9
 
10
-	"github.com/9seconds/mtg/v2/mtglib"
11
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
12
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls/fake"
10
+	"github.com/dolonet/mtg-multi/mtglib"
11
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
12
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls/fake"
13 13
 	"github.com/stretchr/testify/suite"
14 14
 )
15 15
 

+ 15
- 11
mtglib/proxy.go Прегледај датотеку

@@ -10,13 +10,13 @@ import (
10 10
 	"sync"
11 11
 	"time"
12 12
 
13
-	"github.com/9seconds/mtg/v2/essentials"
14
-	"github.com/9seconds/mtg/v2/mtglib/internal/dc"
15
-	"github.com/9seconds/mtg/v2/mtglib/internal/doppel"
16
-	"github.com/9seconds/mtg/v2/mtglib/internal/obfuscation"
17
-	"github.com/9seconds/mtg/v2/mtglib/internal/relay"
18
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
19
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls/fake"
13
+	"github.com/dolonet/mtg-multi/essentials"
14
+	"github.com/dolonet/mtg-multi/mtglib/internal/dc"
15
+	"github.com/dolonet/mtg-multi/mtglib/internal/doppel"
16
+	"github.com/dolonet/mtg-multi/mtglib/internal/obfuscation"
17
+	"github.com/dolonet/mtg-multi/mtglib/internal/relay"
18
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
19
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls/fake"
20 20
 	"github.com/panjf2000/ants/v2"
21 21
 )
22 22
 
@@ -111,11 +111,13 @@ func (p *Proxy) ServeConn(conn essentials.Conn) {
111 111
 		return
112 112
 	}
113 113
 
114
+	tracker := newIdleTracker(p.idleTimeout)
115
+
114 116
 	relay.Relay(
115 117
 		ctx,
116 118
 		ctx.logger.Named("relay"),
117
-		connIdleTimeout{Conn: ctx.telegramConn, timeout: p.idleTimeout},
118
-		newCountingConn(connIdleTimeout{Conn: ctx.clientConn, timeout: p.idleTimeout}, p.stats, ctx.secretName),
119
+		connIdleTimeout{Conn: ctx.telegramConn, tracker: tracker},
120
+		newCountingConn(connIdleTimeout{Conn: ctx.clientConn, tracker: tracker}, p.stats, ctx.secretName),
119 121
 	)
120 122
 }
121 123
 
@@ -330,11 +332,13 @@ func (p *Proxy) doDomainFronting(ctx *streamContext, conn *connRewind) {
330 332
 		stream:   p.eventStream,
331 333
 	}
332 334
 
335
+	tracker := newIdleTracker(p.idleTimeout)
336
+
333 337
 	relay.Relay(
334 338
 		ctx,
335 339
 		ctx.logger.Named("domain-fronting"),
336
-		connIdleTimeout{Conn: frontConn, timeout: p.idleTimeout},
337
-		connIdleTimeout{Conn: conn, timeout: p.idleTimeout},
340
+		connIdleTimeout{Conn: frontConn, tracker: tracker},
341
+		connIdleTimeout{Conn: conn, tracker: tracker},
338 342
 	)
339 343
 }
340 344
 

+ 8
- 8
mtglib/proxy_test.go Прегледај датотеку

@@ -10,13 +10,13 @@ import (
10 10
 	"testing"
11 11
 	"time"
12 12
 
13
-	"github.com/9seconds/mtg/v2/antireplay"
14
-	"github.com/9seconds/mtg/v2/events"
15
-	"github.com/9seconds/mtg/v2/ipblocklist"
16
-	"github.com/9seconds/mtg/v2/ipblocklist/files"
17
-	"github.com/9seconds/mtg/v2/logger"
18
-	"github.com/9seconds/mtg/v2/mtglib"
19
-	"github.com/9seconds/mtg/v2/network"
13
+	"github.com/dolonet/mtg-multi/antireplay"
14
+	"github.com/dolonet/mtg-multi/events"
15
+	"github.com/dolonet/mtg-multi/ipblocklist"
16
+	"github.com/dolonet/mtg-multi/ipblocklist/files"
17
+	"github.com/dolonet/mtg-multi/logger"
18
+	"github.com/dolonet/mtg-multi/mtglib"
19
+	"github.com/dolonet/mtg-multi/network"
20 20
 	"github.com/stretchr/testify/suite"
21 21
 	"github.com/yl2chen/cidranger"
22 22
 )
@@ -175,7 +175,7 @@ func (suite *ProxyTestSuite) TestHTTPSRequest() {
175 175
 	addr := fmt.Sprintf("https://%s/headers", suite.ProxyAddress())
176 176
 
177 177
 	resp, err := client.Get(addr) //nolint: noctx
178
-	suite.NoError(err)
178
+	suite.Require().NoError(err)
179 179
 
180 180
 	defer resp.Body.Close() //nolint: errcheck
181 181
 

+ 1
- 1
mtglib/secret_test.go Прегледај датотеку

@@ -5,7 +5,7 @@ import (
5 5
 	"encoding/json"
6 6
 	"testing"
7 7
 
8
-	"github.com/9seconds/mtg/v2/mtglib"
8
+	"github.com/dolonet/mtg-multi/mtglib"
9 9
 	"github.com/stretchr/testify/assert"
10 10
 	"github.com/stretchr/testify/suite"
11 11
 )

+ 1
- 1
mtglib/stream_context.go Прегледај датотеку

@@ -7,7 +7,7 @@ import (
7 7
 	"net"
8 8
 	"time"
9 9
 
10
-	"github.com/9seconds/mtg/v2/essentials"
10
+	"github.com/dolonet/mtg-multi/essentials"
11 11
 )
12 12
 
13 13
 type streamContext struct {

+ 0
- 0
mtglib/stream_context_internal_test.go Прегледај датотеку


Неке датотеке нису приказане због велике количине промена

Loading…
Откажи
Сачувај