Kaynağa Gözat

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 ay önce
ebeveyn
işleme
9c62a60a3d
No account linked to committer's email address
100 değiştirilmiş dosya ile 458 ekleme ve 185 silme
  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 Dosyayı Görüntüle

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

+ 1
- 1
antireplay/noop.go Dosyayı Görüntüle

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

+ 1
- 1
antireplay/noop_test.go Dosyayı Görüntüle

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

+ 1
- 1
antireplay/stable_bloom_filter.go Dosyayı Görüntüle

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

+ 2
- 2
antireplay/stable_bloom_filter_test.go Dosyayı Görüntüle

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

+ 1
- 1
events/event_stream.go Dosyayı Görüntüle

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

+ 2
- 2
events/event_stream_test.go Dosyayı Görüntüle

6
 	"testing"
6
 	"testing"
7
 	"time"
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
 	"github.com/stretchr/testify/mock"
11
 	"github.com/stretchr/testify/mock"
12
 	"github.com/stretchr/testify/suite"
12
 	"github.com/stretchr/testify/suite"
13
 )
13
 )

+ 1
- 1
events/init.go Dosyayı Görüntüle

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

+ 1
- 1
events/init_test.go Dosyayı Görüntüle

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

+ 1
- 1
events/multi_observer.go Dosyayı Görüntüle

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

+ 1
- 1
events/noop.go Dosyayı Görüntüle

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

+ 2
- 2
events/noop_test.go Dosyayı Görüntüle

5
 	"net"
5
 	"net"
6
 	"testing"
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
 	"github.com/stretchr/testify/suite"
10
 	"github.com/stretchr/testify/suite"
11
 )
11
 )
12
 
12
 

+ 1
- 1
go.mod Dosyayı Görüntüle

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

+ 3
- 3
internal/cli/access.go Dosyayı Görüntüle

10
 	"strconv"
10
 	"strconv"
11
 	"sync"
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
 type accessResponseSecret struct {
18
 type accessResponseSecret struct {

+ 5
- 5
internal/cli/doctor.go Dosyayı Görüntüle

13
 	"text/template"
13
 	"text/template"
14
 	"time"
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
 	"github.com/beevik/ntp"
21
 	"github.com/beevik/ntp"
22
 )
22
 )
23
 
23
 

+ 1
- 1
internal/cli/generate_secret.go Dosyayı Görüntüle

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

+ 1
- 1
internal/cli/run.go Dosyayı Görüntüle

3
 import (
3
 import (
4
 	"fmt"
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
 type Run struct {
9
 type Run struct {

+ 11
- 11
internal/cli/run_proxy.go Dosyayı Görüntüle

7
 	"os"
7
 	"os"
8
 	"time"
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
 	"github.com/pires/go-proxyproto"
21
 	"github.com/pires/go-proxyproto"
22
 	"github.com/rs/zerolog"
22
 	"github.com/rs/zerolog"
23
 	"github.com/yl2chen/cidranger"
23
 	"github.com/yl2chen/cidranger"

+ 1
- 1
internal/cli/simple_run.go Dosyayı Görüntüle

6
 	"strconv"
6
 	"strconv"
7
 	"time"
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
 type SimpleRun struct {
12
 type SimpleRun struct {

+ 2
- 2
internal/cli/utils.go Dosyayı Görüntüle

7
 	"net/http"
7
 	"net/http"
8
 	"strings"
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
 func getIP(ntw mtglib.Network, protocol string) net.IP {
14
 func getIP(ntw mtglib.Network, protocol string) net.IP {

+ 5
- 5
internal/config/config.go Dosyayı Görüntüle

7
 	"net"
7
 	"net"
8
 	"net/url"
8
 	"net/url"
9
 
9
 
10
-	"github.com/9seconds/mtg/v2/mtglib"
10
+	"github.com/dolonet/mtg-multi/mtglib"
11
 )
11
 )
12
 
12
 
13
 type Optional struct {
13
 type Optional struct {
53
 		Blocklist    ListConfig `json:"blocklist"`
53
 		Blocklist    ListConfig `json:"blocklist"`
54
 		Allowlist    ListConfig `json:"allowlist"`
54
 		Allowlist    ListConfig `json:"allowlist"`
55
 		Doppelganger struct {
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
 		} `json:"doppelganger"`
60
 		} `json:"doppelganger"`
61
 	} `json:"defense"`
61
 	} `json:"defense"`
62
 	Network struct {
62
 	Network struct {

+ 1
- 1
internal/config/config_test.go Dosyayı Görüntüle

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

+ 4
- 4
internal/config/parse.go Dosyayı Görüntüle

48
 			UpdateEach          string   `toml:"update-each" json:"updateEach,omitempty"`
48
 			UpdateEach          string   `toml:"update-each" json:"updateEach,omitempty"`
49
 		} `toml:"allowlist" json:"allowlist,omitempty"`
49
 		} `toml:"allowlist" json:"allowlist,omitempty"`
50
 		Doppelganger struct {
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
 		} `toml:"doppelganger" json:"doppelganger,omitempty"`
55
 		} `toml:"doppelganger" json:"doppelganger,omitempty"`
56
 	} `toml:"defense" json:"defense,omitempty"`
56
 	} `toml:"defense" json:"defense,omitempty"`
57
 	Network struct {
57
 	Network struct {

+ 1
- 1
internal/config/type_blocklist_uri_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_bool_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_bytes_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_concurrency_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_dc_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_dns_uri_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_duration_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_error_rate_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_hostport_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_http_path_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_https_url_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_ip_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_metric_prefix_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_port_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_prefer_ip_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_proxy_url_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/config/type_statsd_tag_format_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/testlib/mtglib_network_mock.go Dosyayı Görüntüle

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

+ 1
- 1
internal/utils/make_qr_code_url_test.go Dosyayı Görüntüle

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

+ 1
- 1
internal/utils/net_listener.go Dosyayı Görüntüle

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

+ 1
- 1
internal/utils/read_config.go Dosyayı Görüntüle

4
 	"fmt"
4
 	"fmt"
5
 	"os"
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
 func ReadConfig(path string) (*config.Config, error) {
10
 func ReadConfig(path string) (*config.Config, error) {

+ 1
- 1
internal/utils/read_config_test.go Dosyayı Görüntüle

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

+ 1
- 1
ipblocklist/files/http_test.go Dosyayı Görüntüle

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

+ 1
- 1
ipblocklist/files/local_test.go Dosyayı Görüntüle

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

+ 1
- 1
ipblocklist/files/mem_test.go Dosyayı Görüntüle

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

+ 2
- 2
ipblocklist/firehol.go Dosyayı Görüntüle

10
 	"sync"
10
 	"sync"
11
 	"time"
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
 	"github.com/panjf2000/ants/v2"
15
 	"github.com/panjf2000/ants/v2"
16
 	"github.com/yl2chen/cidranger"
16
 	"github.com/yl2chen/cidranger"
17
 )
17
 )

+ 4
- 4
ipblocklist/firehol_test.go Dosyayı Görüntüle

10
 	"testing"
10
 	"testing"
11
 	"time"
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
 	"github.com/jarcoal/httpmock"
17
 	"github.com/jarcoal/httpmock"
18
 	"github.com/stretchr/testify/mock"
18
 	"github.com/stretchr/testify/mock"
19
 	"github.com/stretchr/testify/suite"
19
 	"github.com/stretchr/testify/suite"

+ 1
- 1
ipblocklist/noop.go Dosyayı Görüntüle

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

+ 1
- 1
ipblocklist/noop_test.go Dosyayı Görüntüle

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

+ 1
- 1
logger/noop.go Dosyayı Görüntüle

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

+ 2
- 2
logger/noop_test.go Dosyayı Görüntüle

4
 	"io"
4
 	"io"
5
 	"testing"
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
 	"github.com/stretchr/testify/suite"
9
 	"github.com/stretchr/testify/suite"
10
 )
10
 )
11
 
11
 

+ 1
- 1
logger/zerolog.go Dosyayı Görüntüle

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

+ 2
- 2
logger/zerolog_test.go Dosyayı Görüntüle

8
 	"testing"
8
 	"testing"
9
 	"time"
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
 	"github.com/rs/zerolog"
13
 	"github.com/rs/zerolog"
14
 	"github.com/stretchr/testify/assert"
14
 	"github.com/stretchr/testify/assert"
15
 	"github.com/stretchr/testify/suite"
15
 	"github.com/stretchr/testify/suite"

+ 1
- 1
main.go Dosyayı Görüntüle

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

+ 51
- 6
mtglib/conns.go Dosyayı Görüntüle

3
 import (
3
 import (
4
 	"bytes"
4
 	"bytes"
5
 	"context"
5
 	"context"
6
+	"errors"
6
 	"fmt"
7
 	"fmt"
7
 	"io"
8
 	"io"
8
 	"net"
9
 	"net"
10
+	"sync/atomic"
9
 	"time"
11
 	"time"
10
 
12
 
11
-	"github.com/9seconds/mtg/v2/essentials"
13
+	"github.com/dolonet/mtg-multi/essentials"
12
 	"github.com/pires/go-proxyproto"
14
 	"github.com/pires/go-proxyproto"
13
 )
15
 )
14
 
16
 
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
 type connIdleTimeout struct {
126
 type connIdleTimeout struct {
101
 	essentials.Conn
127
 	essentials.Conn
102
 
128
 
103
-	timeout time.Duration
129
+	tracker *idleTracker
104
 }
130
 }
105
 
131
 
106
 func (c connIdleTimeout) Read(b []byte) (int, error) {
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
 func (c connIdleTimeout) Write(b []byte) (int, error) {
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 Dosyayı Görüntüle

10
 	"testing"
10
 	"testing"
11
 	"time"
11
 	"time"
12
 
12
 
13
-	"github.com/9seconds/mtg/v2/internal/testlib"
13
+	"github.com/dolonet/mtg-multi/internal/testlib"
14
 	"github.com/pires/go-proxyproto"
14
 	"github.com/pires/go-proxyproto"
15
 	"github.com/stretchr/testify/mock"
15
 	"github.com/stretchr/testify/mock"
16
 	"github.com/stretchr/testify/suite"
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
 type ConnRewindBaseConn struct {
25
 type ConnRewindBaseConn struct {
20
 	testlib.EssentialsConnMock
26
 	testlib.EssentialsConnMock
21
 
27
 
291
 	suite.targetConnMock.AssertExpectations(suite.T())
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
 func TestConnTraffic(t *testing.T) {
435
 func TestConnTraffic(t *testing.T) {
295
 	t.Parallel()
436
 	t.Parallel()
296
 	suite.Run(t, &ConnTrafficTestSuite{})
437
 	suite.Run(t, &ConnTrafficTestSuite{})
305
 	t.Parallel()
446
 	t.Parallel()
306
 	suite.Run(t, &ConnProxyProtocolTestSuite{})
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 Dosyayı Görüntüle

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

+ 1
- 1
mtglib/events_test.go Dosyayı Görüntüle

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

+ 1
- 1
mtglib/init.go Dosyayı Görüntüle

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

+ 1
- 1
mtglib/internal/dc/addr.go Dosyayı Görüntüle

3
 import (
3
 import (
4
 	"fmt"
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
 type Addr struct {
9
 type Addr struct {

+ 1
- 1
mtglib/internal/dc/init.go Dosyayı Görüntüle

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

+ 6
- 2
mtglib/internal/dc/view.go Dosyayı Görüntüle

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

+ 2
- 2
mtglib/internal/doppel/conn.go Dosyayı Görüntüle

6
 	"sync"
6
 	"sync"
7
 	"time"
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
 var doppelBufPool = sync.Pool{
13
 var doppelBufPool = sync.Pool{

+ 2
- 2
mtglib/internal/doppel/conn_test.go Dosyayı Görüntüle

10
 	"testing"
10
 	"testing"
11
 	"time"
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
 	"github.com/stretchr/testify/mock"
15
 	"github.com/stretchr/testify/mock"
16
 	"github.com/stretchr/testify/suite"
16
 	"github.com/stretchr/testify/suite"
17
 )
17
 )

+ 1
- 1
mtglib/internal/doppel/ganger.go Dosyayı Görüntüle

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

+ 1
- 1
mtglib/internal/doppel/ganger_test.go Dosyayı Görüntüle

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

+ 2
- 2
mtglib/internal/doppel/init.go Dosyayı Görüntüle

6
 	"net/http"
6
 	"net/http"
7
 	"time"
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
 const (
13
 const (

+ 1
- 1
mtglib/internal/doppel/init_test.go Dosyayı Görüntüle

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

+ 14
- 8
mtglib/internal/doppel/scout.go Dosyayı Görüntüle

8
 	"strings"
8
 	"strings"
9
 	"time"
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
 // ScoutResult holds measurements from a single scout HTTP request.
15
 // ScoutResult holds measurements from a single scout HTTP request.
61
 		client.CloseIdleConnections()
61
 		client.CloseIdleConnections()
62
 	}
62
 	}
63
 
63
 
64
-	if err != nil || len(results.data) == 0 {
64
+	if err != nil {
65
 		return ScoutResult{}, err
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
 	var result ScoutResult
74
 	var result ScoutResult
69
 
75
 
70
 	// Compute inter-record durations (existing logic).
76
 	// Compute inter-record durations (existing logic).
71
 	lastTimestamp := time.Time{}
77
 	lastTimestamp := time.Time{}
72
 
78
 
73
-	for i, v := range results.data {
79
+	for i, v := range data {
74
 		if v.recordType != tls.TypeApplicationData {
80
 		if v.recordType != tls.TypeApplicationData {
75
 			continue
81
 			continue
76
 		}
82
 		}
77
 
83
 
78
 		if lastTimestamp.IsZero() {
84
 		if lastTimestamp.IsZero() {
79
 			if i > 0 {
85
 			if i > 0 {
80
-				lastTimestamp = results.data[i-1].timestamp
86
+				lastTimestamp = data[i-1].timestamp
81
 			} else {
87
 			} else {
82
 				lastTimestamp = v.timestamp
88
 				lastTimestamp = v.timestamp
83
 			}
89
 			}
90
 	// Compute cert size: sum of ApplicationData payload between CCS and
96
 	// Compute cert size: sum of ApplicationData payload between CCS and
91
 	// the first client Write (which marks the end of server handshake).
97
 	// the first client Write (which marks the end of server handshake).
92
 	seenCCS := false
98
 	seenCCS := false
93
-	boundary := results.writeIndex
99
+	boundary := writeIndex
94
 	if boundary < 0 {
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
 		if i >= boundary {
105
 		if i >= boundary {
100
 			break
106
 			break
101
 		}
107
 		}

+ 2
- 2
mtglib/internal/doppel/scout_conn.go Dosyayı Görüntüle

5
 	"encoding/binary"
5
 	"encoding/binary"
6
 	"io"
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
 type ScoutConn struct {
12
 type ScoutConn struct {

+ 20
- 1
mtglib/internal/doppel/scout_conn_collected.go Dosyayı Görüntüle

1
 package doppel
1
 package doppel
2
 
2
 
3
-import "time"
3
+import (
4
+	"slices"
5
+	"sync"
6
+	"time"
7
+)
4
 
8
 
5
 const (
9
 const (
6
 	ScoutConnCollectedPreallocSize = 100
10
 	ScoutConnCollectedPreallocSize = 100
13
 }
17
 }
14
 
18
 
15
 type ScoutConnCollected struct {
19
 type ScoutConnCollected struct {
20
+	mu         sync.Mutex
16
 	data       []ScoutConnResult
21
 	data       []ScoutConnResult
17
 	writeIndex int // index at which client first wrote post-handshake data; -1 if not set
22
 	writeIndex int // index at which client first wrote post-handshake data; -1 if not set
18
 }
23
 }
19
 
24
 
20
 func (s *ScoutConnCollected) Add(record byte, payloadLen int) {
25
 func (s *ScoutConnCollected) Add(record byte, payloadLen int) {
26
+	s.mu.Lock()
21
 	s.data = append(s.data, ScoutConnResult{
27
 	s.data = append(s.data, ScoutConnResult{
22
 		timestamp:  time.Now(),
28
 		timestamp:  time.Now(),
23
 		recordType: record,
29
 		recordType: record,
24
 		payloadLen: payloadLen,
30
 		payloadLen: payloadLen,
25
 	})
31
 	})
32
+	s.mu.Unlock()
26
 }
33
 }
27
 
34
 
28
 // MarkWrite records the current data length as the handshake boundary.
35
 // MarkWrite records the current data length as the handshake boundary.
29
 func (s *ScoutConnCollected) MarkWrite() {
36
 func (s *ScoutConnCollected) MarkWrite() {
37
+	s.mu.Lock()
30
 	if s.writeIndex < 0 {
38
 	if s.writeIndex < 0 {
31
 		s.writeIndex = len(s.data)
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
 func NewScoutConnCollected() *ScoutConnCollected {
54
 func NewScoutConnCollected() *ScoutConnCollected {

+ 49
- 5
mtglib/internal/doppel/scout_conn_collected_test.go Dosyayı Görüntüle

1
 package doppel
1
 package doppel
2
 
2
 
3
 import (
3
 import (
4
+	"sync"
4
 	"testing"
5
 	"testing"
5
 	"time"
6
 	"time"
6
 
7
 
7
-	"github.com/9seconds/mtg/v2/mtglib/internal/tls"
8
+	"github.com/dolonet/mtg-multi/mtglib/internal/tls"
8
 	"github.com/stretchr/testify/suite"
9
 	"github.com/stretchr/testify/suite"
9
 )
10
 )
10
 
11
 
16
 	collected := NewScoutConnCollected()
17
 	collected := NewScoutConnCollected()
17
 	collected.Add(tls.TypeApplicationData, 100)
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
 func (suite *ScoutConnCollectedTestSuite) TestAddTimestampsAreMonotonic() {
26
 func (suite *ScoutConnCollectedTestSuite) TestAddTimestampsAreMonotonic() {
31
 	time.Sleep(time.Microsecond)
34
 	time.Sleep(time.Microsecond)
32
 	collected.Add(tls.TypeApplicationData, 100)
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
 func TestScoutConnCollected(t *testing.T) {
83
 func TestScoutConnCollected(t *testing.T) {
40
 	t.Parallel()
84
 	t.Parallel()
41
 	suite.Run(t, &ScoutConnCollectedTestSuite{})
85
 	suite.Run(t, &ScoutConnCollectedTestSuite{})

+ 1
- 1
mtglib/internal/obfuscation/conn.go Dosyayı Görüntüle

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

+ 2
- 2
mtglib/internal/obfuscation/conn_test.go Dosyayı Görüntüle

6
 	"encoding/hex"
6
 	"encoding/hex"
7
 	"testing"
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
 	"github.com/stretchr/testify/assert"
11
 	"github.com/stretchr/testify/assert"
12
 	"github.com/stretchr/testify/mock"
12
 	"github.com/stretchr/testify/mock"
13
 	"github.com/stretchr/testify/suite"
13
 	"github.com/stretchr/testify/suite"

+ 1
- 1
mtglib/internal/obfuscation/obfuscator.go Dosyayı Görüntüle

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

+ 3
- 3
mtglib/internal/obfuscation/obfuscator_fuzz_test.go Dosyayı Görüntüle

4
 	"bytes"
4
 	"bytes"
5
 	"testing"
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
 	"github.com/stretchr/testify/assert"
10
 	"github.com/stretchr/testify/assert"
11
 	"github.com/stretchr/testify/mock"
11
 	"github.com/stretchr/testify/mock"
12
 )
12
 )

+ 3
- 3
mtglib/internal/obfuscation/obfuscator_test.go Dosyayı Görüntüle

4
 	"bytes"
4
 	"bytes"
5
 	"testing"
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
 	"github.com/stretchr/testify/assert"
10
 	"github.com/stretchr/testify/assert"
11
 	"github.com/stretchr/testify/mock"
11
 	"github.com/stretchr/testify/mock"
12
 	"github.com/stretchr/testify/require"
12
 	"github.com/stretchr/testify/require"

+ 1
- 1
mtglib/internal/relay/pool_settings_constrained.go Dosyayı Görüntüle

2
 
2
 
3
 package relay
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
 const (
7
 const (
8
 	// MIPS is quite short in resources, and usually it means that it will run
8
 	// MIPS is quite short in resources, and usually it means that it will run

+ 1
- 1
mtglib/internal/relay/pool_settings_other.go Dosyayı Görüntüle

2
 
2
 
3
 package relay
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
 const (
7
 const (
8
 	bufPoolSize = tls.MaxRecordPayloadSize
8
 	bufPoolSize = tls.MaxRecordPayloadSize

+ 1
- 1
mtglib/internal/relay/relay.go Dosyayı Görüntüle

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

+ 2
- 2
mtglib/internal/relay/relay_bench_test.go Dosyayı Görüntüle

13
 	"sync/atomic"
13
 	"sync/atomic"
14
 	"testing"
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
 // mockConn wraps a net.Conn to satisfy essentials.Conn.
20
 // mockConn wraps a net.Conn to satisfy essentials.Conn.

+ 2
- 2
mtglib/internal/relay/relay_test.go Dosyayı Görüntüle

5
 	"io"
5
 	"io"
6
 	"testing"
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
 	"github.com/stretchr/testify/mock"
10
 	"github.com/stretchr/testify/mock"
11
 	"github.com/stretchr/testify/suite"
11
 	"github.com/stretchr/testify/suite"
12
 )
12
 )

+ 1
- 1
mtglib/internal/relay/stack_bench_test.go Dosyayı Görüntüle

6
 	"sync"
6
 	"sync"
7
 	"testing"
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
 // BenchmarkStackVsPool measures memory consumption when N goroutines hold
12
 // BenchmarkStackVsPool measures memory consumption when N goroutines hold

+ 1
- 1
mtglib/internal/relay/stress_bench_test.go Dosyayı Görüntüle

10
 	"testing"
10
 	"testing"
11
 	"time"
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 Dosyayı Görüntüle

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

+ 1
- 1
mtglib/internal/tls/conn_test.go Dosyayı Görüntüle

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

+ 1
- 1
mtglib/internal/tls/fake/client_side.go Dosyayı Görüntüle

12
 	"slices"
12
 	"slices"
13
 	"time"
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
 const (
18
 const (

+ 3
- 3
mtglib/internal/tls/fake/client_side_fuzz_test.go Dosyayı Görüntüle

5
 	"testing"
5
 	"testing"
6
 	"time"
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
 	"github.com/stretchr/testify/assert"
11
 	"github.com/stretchr/testify/assert"
12
 	"github.com/stretchr/testify/mock"
12
 	"github.com/stretchr/testify/mock"
13
 	"github.com/stretchr/testify/require"
13
 	"github.com/stretchr/testify/require"

+ 2
- 2
mtglib/internal/tls/fake/client_side_snapshot_test.go Dosyayı Görüntüle

9
 	"strings"
9
 	"strings"
10
 	"testing"
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
 	"github.com/stretchr/testify/assert"
14
 	"github.com/stretchr/testify/assert"
15
 	"github.com/stretchr/testify/mock"
15
 	"github.com/stretchr/testify/mock"
16
 	"github.com/stretchr/testify/require"
16
 	"github.com/stretchr/testify/require"

+ 4
- 4
mtglib/internal/tls/fake/client_side_test.go Dosyayı Görüntüle

11
 	"testing"
11
 	"testing"
12
 	"time"
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
 	"github.com/stretchr/testify/mock"
18
 	"github.com/stretchr/testify/mock"
19
 	"github.com/stretchr/testify/require"
19
 	"github.com/stretchr/testify/require"
20
 	"github.com/stretchr/testify/suite"
20
 	"github.com/stretchr/testify/suite"

+ 1
- 1
mtglib/internal/tls/fake/server_side.go Dosyayı Görüntüle

9
 	"io"
9
 	"io"
10
 	rnd "math/rand/v2"
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
 	"golang.org/x/crypto/curve25519"
13
 	"golang.org/x/crypto/curve25519"
14
 )
14
 )
15
 
15
 

+ 3
- 3
mtglib/internal/tls/fake/server_side_test.go Dosyayı Görüntüle

7
 	"crypto/sha256"
7
 	"crypto/sha256"
8
 	"testing"
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
 	"github.com/stretchr/testify/suite"
13
 	"github.com/stretchr/testify/suite"
14
 )
14
 )
15
 
15
 

+ 15
- 11
mtglib/proxy.go Dosyayı Görüntüle

10
 	"sync"
10
 	"sync"
11
 	"time"
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
 	"github.com/panjf2000/ants/v2"
20
 	"github.com/panjf2000/ants/v2"
21
 )
21
 )
22
 
22
 
111
 		return
111
 		return
112
 	}
112
 	}
113
 
113
 
114
+	tracker := newIdleTracker(p.idleTimeout)
115
+
114
 	relay.Relay(
116
 	relay.Relay(
115
 		ctx,
117
 		ctx,
116
 		ctx.logger.Named("relay"),
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
 		stream:   p.eventStream,
332
 		stream:   p.eventStream,
331
 	}
333
 	}
332
 
334
 
335
+	tracker := newIdleTracker(p.idleTimeout)
336
+
333
 	relay.Relay(
337
 	relay.Relay(
334
 		ctx,
338
 		ctx,
335
 		ctx.logger.Named("domain-fronting"),
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 Dosyayı Görüntüle

10
 	"testing"
10
 	"testing"
11
 	"time"
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
 	"github.com/stretchr/testify/suite"
20
 	"github.com/stretchr/testify/suite"
21
 	"github.com/yl2chen/cidranger"
21
 	"github.com/yl2chen/cidranger"
22
 )
22
 )
175
 	addr := fmt.Sprintf("https://%s/headers", suite.ProxyAddress())
175
 	addr := fmt.Sprintf("https://%s/headers", suite.ProxyAddress())
176
 
176
 
177
 	resp, err := client.Get(addr) //nolint: noctx
177
 	resp, err := client.Get(addr) //nolint: noctx
178
-	suite.NoError(err)
178
+	suite.Require().NoError(err)
179
 
179
 
180
 	defer resp.Body.Close() //nolint: errcheck
180
 	defer resp.Body.Close() //nolint: errcheck
181
 
181
 

+ 1
- 1
mtglib/secret_test.go Dosyayı Görüntüle

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

+ 1
- 1
mtglib/stream_context.go Dosyayı Görüntüle

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

+ 0
- 0
mtglib/stream_context_internal_test.go Dosyayı Görüntüle


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor

Loading…
İptal
Kaydet