Просмотр исходного кода

Merge remote-tracking branch 'origin/master' into stable

tags/v1.0.1
9seconds 6 лет назад
Родитель
Сommit
bb21bf814f
54 измененных файлов: 168 добавлений и 140 удалений
  1. 1
    4
      Makefile
  2. 1
    1
      antireplay/init.go
  3. 1
    1
      cli/generate.go
  4. 10
    10
      cli/proxy.go
  5. 8
    8
      faketls/client_protocol.go
  6. 4
    4
      go.mod
  7. 6
    6
      go.sum
  8. 4
    4
      hub/connection.go
  9. 5
    6
      hub/connection_list.go
  10. 1
    1
      hub/hub.go
  11. 1
    1
      hub/interface.go
  12. 12
    3
      hub/mux.go
  13. 3
    3
      hub/proxy_conn.go
  14. 29
    6
      main.go
  15. 6
    6
      mtproto/protocol.go
  16. 1
    1
      mtproto/rpc/proxy_response.go
  17. 7
    7
      obfuscated2/client_protocol.go
  18. 5
    5
      obfuscated2/telegram_protocol.go
  19. 1
    1
      protocol/interfaces.go
  20. 1
    1
      protocol/request.go
  21. 3
    3
      proxy/direct.go
  22. 3
    3
      proxy/middle.go
  23. 6
    6
      proxy/proxy.go
  24. 1
    1
      stats/interfaces.go
  25. 1
    1
      stats/multi_stats.go
  26. 1
    1
      stats/stats.go
  27. 2
    2
      stats/stats_prometheus.go
  28. 2
    2
      stats/stats_statsd.go
  29. 1
    1
      telegram/api/addresses.go
  30. 1
    1
      telegram/api/api.go
  31. 3
    3
      telegram/base.go
  32. 1
    1
      telegram/direct.go
  33. 1
    1
      telegram/interfaces.go
  34. 2
    2
      telegram/middle.go
  35. 2
    2
      tlstypes/client_hello.go
  36. 1
    1
      tlstypes/handshake.go
  37. 1
    1
      tlstypes/server_hello.go
  38. 1
    1
      utils/init_tcp.go
  39. 1
    1
      wrappers/packet/mtproto_frame.go
  40. 2
    2
      wrappers/packetack/client_abridged.go
  41. 1
    1
      wrappers/packetack/client_intermediate.go
  42. 1
    1
      wrappers/packetack/client_intermediate_secure.go
  43. 5
    5
      wrappers/packetack/proxy.go
  44. 1
    1
      wrappers/stream/base.go
  45. 2
    2
      wrappers/stream/blockcipher.go
  46. 2
    2
      wrappers/stream/conn.go
  47. 1
    1
      wrappers/stream/ctx.go
  48. 2
    2
      wrappers/stream/faketls.go
  49. 3
    3
      wrappers/stream/mtproto_cipher.go
  50. 1
    1
      wrappers/stream/obfuscated2.go
  51. 1
    1
      wrappers/stream/rewind.go
  52. 2
    2
      wrappers/stream/stats_telegram.go
  53. 2
    2
      wrappers/stream/stats_traffic.go
  54. 1
    1
      wrappers/stream/timeout.go

+ 1
- 4
Makefile Просмотреть файл

@@ -6,10 +6,7 @@ CC_BINARIES  := $(shell bash -c "echo -n $(APP_NAME)-{linux,freebsd,openbsd}-{38
6 6
 
7 7
 GOLANGCI_LINT_VERSION := v1.21.0
8 8
 
9
-VERSION_GO         := $(shell go version)
10
-VERSION_DATE       := $(shell date -Ru)
11
-VERSION_TAG        := $(shell git describe --tags --always)
12
-COMMON_BUILD_FLAGS := -ldflags="-s -w -X 'main.version=$(VERSION_TAG) ($(VERSION_GO)) [$(VERSION_DATE)]'"
9
+COMMON_BUILD_FLAGS := -ldflags="-s -w"
13 10
 
14 11
 MOD_ON  := env GO111MODULE=on
15 12
 MOD_OFF := env GO111MODULE=auto

+ 1
- 1
antireplay/init.go Просмотреть файл

@@ -5,7 +5,7 @@ import (
5 5
 
6 6
 	"github.com/VictoriaMetrics/fastcache"
7 7
 
8
-	"mtg/config"
8
+	"github.com/9seconds/mtg/config"
9 9
 )
10 10
 
11 11
 var (

+ 1
- 1
cli/generate.go Просмотреть файл

@@ -4,7 +4,7 @@ import (
4 4
 	"crypto/rand"
5 5
 	"encoding/hex"
6 6
 
7
-	"mtg/config"
7
+	"github.com/9seconds/mtg/config"
8 8
 )
9 9
 
10 10
 func Generate(secretType, hostname string) {

+ 10
- 10
cli/proxy.go Просмотреть файл

@@ -8,16 +8,16 @@ import (
8 8
 	"go.uber.org/zap"
9 9
 	"go.uber.org/zap/zapcore"
10 10
 
11
-	"mtg/antireplay"
12
-	"mtg/config"
13
-	"mtg/faketls"
14
-	"mtg/hub"
15
-	"mtg/ntp"
16
-	"mtg/obfuscated2"
17
-	"mtg/proxy"
18
-	"mtg/stats"
19
-	"mtg/telegram"
20
-	"mtg/utils"
11
+	"github.com/9seconds/mtg/antireplay"
12
+	"github.com/9seconds/mtg/config"
13
+	"github.com/9seconds/mtg/faketls"
14
+	"github.com/9seconds/mtg/hub"
15
+	"github.com/9seconds/mtg/ntp"
16
+	"github.com/9seconds/mtg/obfuscated2"
17
+	"github.com/9seconds/mtg/proxy"
18
+	"github.com/9seconds/mtg/stats"
19
+	"github.com/9seconds/mtg/telegram"
20
+	"github.com/9seconds/mtg/utils"
21 21
 )
22 22
 
23 23
 func Proxy() error { // nolint: funlen

+ 8
- 8
faketls/client_protocol.go Просмотреть файл

@@ -11,14 +11,14 @@ import (
11 11
 	"sync"
12 12
 	"time"
13 13
 
14
-	"mtg/antireplay"
15
-	"mtg/config"
16
-	"mtg/conntypes"
17
-	"mtg/obfuscated2"
18
-	"mtg/protocol"
19
-	"mtg/stats"
20
-	"mtg/tlstypes"
21
-	"mtg/wrappers/stream"
14
+	"github.com/9seconds/mtg/antireplay"
15
+	"github.com/9seconds/mtg/config"
16
+	"github.com/9seconds/mtg/conntypes"
17
+	"github.com/9seconds/mtg/obfuscated2"
18
+	"github.com/9seconds/mtg/protocol"
19
+	"github.com/9seconds/mtg/stats"
20
+	"github.com/9seconds/mtg/tlstypes"
21
+	"github.com/9seconds/mtg/wrappers/stream"
22 22
 )
23 23
 
24 24
 type ClientProtocol struct {

+ 4
- 4
go.mod Просмотреть файл

@@ -1,4 +1,4 @@
1
-module mtg
1
+module github.com/9seconds/mtg
2 2
 
3 3
 go 1.13
4 4
 
@@ -13,8 +13,8 @@ require (
13 13
 	go.uber.org/multierr v1.4.0 // indirect
14 14
 	go.uber.org/zap v1.13.0
15 15
 	golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f
16
-	golang.org/x/net v0.0.0-20191116160921-f9c825593386 // indirect
17
-	golang.org/x/sys v0.0.0-20191118013547-6254a7c3cac6
18
-	golang.org/x/tools v0.0.0-20191118051429-5a76f03bc7c3 // indirect
16
+	golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914 // indirect
17
+	golang.org/x/sys v0.0.0-20191119060738-e882bf8e40c2
18
+	golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98 // indirect
19 19
 	gopkg.in/alecthomas/kingpin.v2 v2.2.6
20 20
 )

+ 6
- 6
go.sum Просмотреть файл

@@ -139,8 +139,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
139 139
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
140 140
 golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
141 141
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
142
-golang.org/x/net v0.0.0-20191116160921-f9c825593386 h1:ktbWvQrW08Txdxno1PiDpSxPXG6ndGsfnJjRRtkM0LQ=
143
-golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
142
+golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914 h1:MlY3mEfbnWGmUi4rtHOtNnnnN4UJRGSyLPx+DXA5Sq4=
143
+golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
144 144
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
145 145
 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
146 146
 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -153,16 +153,16 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
153 153
 golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
154 154
 golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY=
155 155
 golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
156
-golang.org/x/sys v0.0.0-20191118013547-6254a7c3cac6 h1:8mlr2HX+lfl0eaQcjiHfVeM2FHxWkuYQ5a2Wcy8mE1s=
157
-golang.org/x/sys v0.0.0-20191118013547-6254a7c3cac6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
156
+golang.org/x/sys v0.0.0-20191119060738-e882bf8e40c2 h1:wAW1U21MfVN0sUipAD8952TBjGXMRHFKQugDlQ9RwwE=
157
+golang.org/x/sys v0.0.0-20191119060738-e882bf8e40c2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
158 158
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
159 159
 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
160 160
 golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
161 161
 golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
162 162
 golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs=
163 163
 golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
164
-golang.org/x/tools v0.0.0-20191118051429-5a76f03bc7c3 h1:3gzOmNy3PLCZ+3Ru/n5Gh7pPjsieiytYSDxFj6QY/oI=
165
-golang.org/x/tools v0.0.0-20191118051429-5a76f03bc7c3/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
164
+golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98 h1:tZwpOHmF1OEL9wJGSgBALnhFg/8VKjQTtctCX51GLNI=
165
+golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
166 166
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
167 167
 gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
168 168
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=

+ 4
- 4
hub/connection.go Просмотреть файл

@@ -7,10 +7,10 @@ import (
7 7
 
8 8
 	"go.uber.org/zap"
9 9
 
10
-	"mtg/conntypes"
11
-	"mtg/mtproto"
12
-	"mtg/mtproto/rpc"
13
-	"mtg/protocol"
10
+	"github.com/9seconds/mtg/conntypes"
11
+	"github.com/9seconds/mtg/mtproto"
12
+	"github.com/9seconds/mtg/mtproto/rpc"
13
+	"github.com/9seconds/mtg/protocol"
14 14
 )
15 15
 
16 16
 type connection struct {

+ 5
- 6
hub/connection_list.go Просмотреть файл

@@ -4,18 +4,14 @@ import (
4 4
 	"fmt"
5 5
 	"sort"
6 6
 
7
-	"mtg/config"
7
+	"github.com/9seconds/mtg/config"
8 8
 )
9 9
 
10 10
 type connectionList struct {
11 11
 	connections []*connection
12 12
 }
13 13
 
14
-func (c *connectionList) Get(conn *ProxyConn) (*connection, error) {
15
-	if len(c.connections) > 0 {
16
-		c.gc()
17
-	}
18
-
14
+func (c *connectionList) get(conn *ProxyConn) (*connection, error) {
19 15
 	if len(c.connections) > 0 && c.connections[0].Len() < config.C.MultiplexPerConnection {
20 16
 		if err := c.connections[0].Attach(conn); err == nil {
21 17
 			return c.connections[0], nil
@@ -41,6 +37,9 @@ func (c *connectionList) Get(conn *ProxyConn) (*connection, error) {
41 37
 
42 38
 func (c *connectionList) gc() {
43 39
 	prevLen := len(c.connections)
40
+	if prevLen == 0 {
41
+		return
42
+	}
44 43
 
45 44
 	for i := len(c.connections) - 1; i >= 0; i-- {
46 45
 		lastIndex := len(c.connections) - 1

+ 1
- 1
hub/hub.go Просмотреть файл

@@ -4,7 +4,7 @@ import (
4 4
 	"context"
5 5
 	"sync"
6 6
 
7
-	"mtg/protocol"
7
+	"github.com/9seconds/mtg/protocol"
8 8
 )
9 9
 
10 10
 type hub struct {

+ 1
- 1
hub/interface.go Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 package hub
2 2
 
3
-import "mtg/protocol"
3
+import "github.com/9seconds/mtg/protocol"
4 4
 
5 5
 type Interface interface {
6 6
 	Register(*protocol.TelegramRequest) (*ProxyConn, error)

+ 12
- 3
hub/mux.go Просмотреть файл

@@ -2,11 +2,14 @@ package hub
2 2
 
3 3
 import (
4 4
 	"context"
5
+	"time"
5 6
 
6
-	"mtg/conntypes"
7
-	"mtg/protocol"
7
+	"github.com/9seconds/mtg/conntypes"
8
+	"github.com/9seconds/mtg/protocol"
8 9
 )
9 10
 
11
+const muxGCEvery = time.Minute
12
+
10 13
 type muxNewRequest struct {
11 14
 	req  *protocol.TelegramRequest
12 15
 	resp chan<- muxNewResponse
@@ -26,6 +29,9 @@ type mux struct {
26 29
 }
27 30
 
28 31
 func (m *mux) run() {
32
+	gcTicker := time.NewTicker(muxGCEvery)
33
+	defer gcTicker.Stop()
34
+
29 35
 	for {
30 36
 		select {
31 37
 		case <-m.ctx.Done():
@@ -34,9 +40,12 @@ func (m *mux) run() {
34 40
 			}
35 41
 
36 42
 			return
43
+		case <-gcTicker.C:
44
+			m.connections.gc()
37 45
 		case req := <-m.channelNew:
46
+			m.connections.gc()
38 47
 			proxyConn := newProxyConn(req.req, m.channelClosed)
39
-			conn, err := m.connections.Get(proxyConn)
48
+			conn, err := m.connections.get(proxyConn)
40 49
 
41 50
 			if err == nil {
42 51
 				m.clients[string(req.req.ConnID[:])] = conn

+ 3
- 3
hub/proxy_conn.go Просмотреть файл

@@ -4,9 +4,9 @@ import (
4 4
 	"sync"
5 5
 	"time"
6 6
 
7
-	"mtg/conntypes"
8
-	"mtg/mtproto/rpc"
9
-	"mtg/protocol"
7
+	"github.com/9seconds/mtg/conntypes"
8
+	"github.com/9seconds/mtg/mtproto/rpc"
9
+	"github.com/9seconds/mtg/protocol"
10 10
 )
11 11
 
12 12
 const (

+ 29
- 6
main.go Просмотреть файл

@@ -3,17 +3,17 @@ package main
3 3
 import (
4 4
 	"math/rand"
5 5
 	"os"
6
+	"runtime/debug"
7
+	"strings"
6 8
 	"time"
7 9
 
8 10
 	kingpin "gopkg.in/alecthomas/kingpin.v2"
9 11
 
10
-	"mtg/cli"
11
-	"mtg/config"
12
-	"mtg/utils"
12
+	"github.com/9seconds/mtg/cli"
13
+	"github.com/9seconds/mtg/config"
14
+	"github.com/9seconds/mtg/utils"
13 15
 )
14 16
 
15
-var version = "dev" // this has to be set by build ld flags
16
-
17 17
 var (
18 18
 	app = kingpin.New("mtg", "Simple MTPROTO proxy.")
19 19
 
@@ -114,7 +114,7 @@ var (
114 114
 
115 115
 func main() {
116 116
 	rand.Seed(time.Now().UTC().UnixNano())
117
-	app.Version(version)
117
+	app.Version(getVersion())
118 118
 	app.HelpFlag.Short('h')
119 119
 
120 120
 	if err := utils.SetLimits(); err != nil {
@@ -153,3 +153,26 @@ func main() {
153 153
 		}
154 154
 	}
155 155
 }
156
+
157
+func getVersion() string {
158
+	if info, ok := debug.ReadBuildInfo(); ok {
159
+		builder := strings.Builder{}
160
+		version := info.Main.Version
161
+
162
+		if version == "(devel)" {
163
+			version = "dev"
164
+		}
165
+
166
+		builder.WriteString(version)
167
+
168
+		if info.Main.Sum != "" {
169
+			builder.WriteString(" (checksum: ")
170
+			builder.WriteString(info.Main.Sum)
171
+			builder.WriteRune(')')
172
+		}
173
+
174
+		return builder.String()
175
+	}
176
+
177
+	return "dev"
178
+}

+ 6
- 6
mtproto/protocol.go Просмотреть файл

@@ -3,12 +3,12 @@ package mtproto
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"mtg/conntypes"
7
-	"mtg/mtproto/rpc"
8
-	"mtg/protocol"
9
-	"mtg/telegram"
10
-	"mtg/wrappers/packet"
11
-	"mtg/wrappers/stream"
6
+	"github.com/9seconds/mtg/conntypes"
7
+	"github.com/9seconds/mtg/mtproto/rpc"
8
+	"github.com/9seconds/mtg/protocol"
9
+	"github.com/9seconds/mtg/telegram"
10
+	"github.com/9seconds/mtg/wrappers/packet"
11
+	"github.com/9seconds/mtg/wrappers/stream"
12 12
 )
13 13
 
14 14
 func TelegramProtocol(req *protocol.TelegramRequest) (conntypes.PacketReadWriteCloser, error) {

+ 1
- 1
mtproto/rpc/proxy_response.go Просмотреть файл

@@ -4,7 +4,7 @@ import (
4 4
 	"bytes"
5 5
 	"fmt"
6 6
 
7
-	"mtg/conntypes"
7
+	"github.com/9seconds/mtg/conntypes"
8 8
 )
9 9
 
10 10
 type ProxyResponseType uint8

+ 7
- 7
obfuscated2/client_protocol.go Просмотреть файл

@@ -9,13 +9,13 @@ import (
9 9
 	"io"
10 10
 	"time"
11 11
 
12
-	"mtg/antireplay"
13
-	"mtg/config"
14
-	"mtg/conntypes"
15
-	"mtg/protocol"
16
-	"mtg/stats"
17
-	"mtg/utils"
18
-	"mtg/wrappers/stream"
12
+	"github.com/9seconds/mtg/antireplay"
13
+	"github.com/9seconds/mtg/config"
14
+	"github.com/9seconds/mtg/conntypes"
15
+	"github.com/9seconds/mtg/protocol"
16
+	"github.com/9seconds/mtg/stats"
17
+	"github.com/9seconds/mtg/utils"
18
+	"github.com/9seconds/mtg/wrappers/stream"
19 19
 )
20 20
 
21 21
 const clientProtocolHandshakeTimeout = 10 * time.Second

+ 5
- 5
obfuscated2/telegram_protocol.go Просмотреть файл

@@ -4,11 +4,11 @@ import (
4 4
 	"crypto/rand"
5 5
 	"fmt"
6 6
 
7
-	"mtg/conntypes"
8
-	"mtg/protocol"
9
-	"mtg/telegram"
10
-	"mtg/utils"
11
-	"mtg/wrappers/stream"
7
+	"github.com/9seconds/mtg/conntypes"
8
+	"github.com/9seconds/mtg/protocol"
9
+	"github.com/9seconds/mtg/telegram"
10
+	"github.com/9seconds/mtg/utils"
11
+	"github.com/9seconds/mtg/wrappers/stream"
12 12
 )
13 13
 
14 14
 func TelegramProtocol(req *protocol.TelegramRequest) (conntypes.StreamReadWriteCloser, error) {

+ 1
- 1
protocol/interfaces.go Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 package protocol
2 2
 
3
-import "mtg/conntypes"
3
+import "github.com/9seconds/mtg/conntypes"
4 4
 
5 5
 type ClientProtocol interface {
6 6
 	Handshake(conntypes.StreamReadWriteCloser) (conntypes.StreamReadWriteCloser, error)

+ 1
- 1
protocol/request.go Просмотреть файл

@@ -5,7 +5,7 @@ import (
5 5
 
6 6
 	"go.uber.org/zap"
7 7
 
8
-	"mtg/conntypes"
8
+	"github.com/9seconds/mtg/conntypes"
9 9
 )
10 10
 
11 11
 type TelegramRequest struct {

+ 3
- 3
proxy/direct.go Просмотреть файл

@@ -6,9 +6,9 @@ import (
6 6
 
7 7
 	"go.uber.org/zap"
8 8
 
9
-	"mtg/conntypes"
10
-	"mtg/obfuscated2"
11
-	"mtg/protocol"
9
+	"github.com/9seconds/mtg/conntypes"
10
+	"github.com/9seconds/mtg/obfuscated2"
11
+	"github.com/9seconds/mtg/protocol"
12 12
 )
13 13
 
14 14
 const directPipeBufferSize = 1024 * 1024

+ 3
- 3
proxy/middle.go Просмотреть файл

@@ -5,9 +5,9 @@ import (
5 5
 
6 6
 	"go.uber.org/zap"
7 7
 
8
-	"mtg/conntypes"
9
-	"mtg/protocol"
10
-	"mtg/wrappers/packetack"
8
+	"github.com/9seconds/mtg/conntypes"
9
+	"github.com/9seconds/mtg/protocol"
10
+	"github.com/9seconds/mtg/wrappers/packetack"
11 11
 )
12 12
 
13 13
 func middleConnection(request *protocol.TelegramRequest) {

+ 6
- 6
proxy/proxy.go Просмотреть файл

@@ -6,12 +6,12 @@ import (
6 6
 
7 7
 	"go.uber.org/zap"
8 8
 
9
-	"mtg/config"
10
-	"mtg/conntypes"
11
-	"mtg/protocol"
12
-	"mtg/stats"
13
-	"mtg/utils"
14
-	"mtg/wrappers/stream"
9
+	"github.com/9seconds/mtg/config"
10
+	"github.com/9seconds/mtg/conntypes"
11
+	"github.com/9seconds/mtg/protocol"
12
+	"github.com/9seconds/mtg/stats"
13
+	"github.com/9seconds/mtg/utils"
14
+	"github.com/9seconds/mtg/wrappers/stream"
15 15
 )
16 16
 
17 17
 type Proxy struct {

+ 1
- 1
stats/interfaces.go Просмотреть файл

@@ -3,7 +3,7 @@ package stats
3 3
 import (
4 4
 	"net"
5 5
 
6
-	"mtg/conntypes"
6
+	"github.com/9seconds/mtg/conntypes"
7 7
 )
8 8
 
9 9
 type IngressTrafficInterface interface {

+ 1
- 1
stats/multi_stats.go Просмотреть файл

@@ -3,7 +3,7 @@ package stats
3 3
 import (
4 4
 	"net"
5 5
 
6
-	"mtg/conntypes"
6
+	"github.com/9seconds/mtg/conntypes"
7 7
 )
8 8
 
9 9
 type multiStats []Interface

+ 1
- 1
stats/stats.go Просмотреть файл

@@ -6,7 +6,7 @@ import (
6 6
 	"net"
7 7
 	"net/http"
8 8
 
9
-	"mtg/config"
9
+	"github.com/9seconds/mtg/config"
10 10
 )
11 11
 
12 12
 var Stats Interface

+ 2
- 2
stats/stats_prometheus.go Просмотреть файл

@@ -8,8 +8,8 @@ import (
8 8
 	"github.com/prometheus/client_golang/prometheus"
9 9
 	"github.com/prometheus/client_golang/prometheus/promhttp"
10 10
 
11
-	"mtg/config"
12
-	"mtg/conntypes"
11
+	"github.com/9seconds/mtg/config"
12
+	"github.com/9seconds/mtg/conntypes"
13 13
 )
14 14
 
15 15
 type statsPrometheus struct {

+ 2
- 2
stats/stats_statsd.go Просмотреть файл

@@ -11,8 +11,8 @@ import (
11 11
 	statsd "github.com/smira/go-statsd"
12 12
 	"go.uber.org/zap"
13 13
 
14
-	"mtg/config"
15
-	"mtg/conntypes"
14
+	"github.com/9seconds/mtg/config"
15
+	"github.com/9seconds/mtg/conntypes"
16 16
 )
17 17
 
18 18
 var (

+ 1
- 1
telegram/api/addresses.go Просмотреть файл

@@ -8,7 +8,7 @@ import (
8 8
 	"strconv"
9 9
 	"strings"
10 10
 
11
-	"mtg/conntypes"
11
+	"github.com/9seconds/mtg/conntypes"
12 12
 )
13 13
 
14 14
 const (

+ 1
- 1
telegram/api/api.go Просмотреть файл

@@ -9,7 +9,7 @@ import (
9 9
 )
10 10
 
11 11
 const (
12
-	apiUserAgent   = "mtg"
12
+	apiUserAgent   = "github.com/9seconds/mtg"
13 13
 	apiHTTPTimeout = 30 * time.Second
14 14
 )
15 15
 

+ 3
- 3
telegram/base.go Просмотреть файл

@@ -5,9 +5,9 @@ import (
5 5
 	"math/rand"
6 6
 	"net"
7 7
 
8
-	"mtg/conntypes"
9
-	"mtg/utils"
10
-	"mtg/wrappers/stream"
8
+	"github.com/9seconds/mtg/conntypes"
9
+	"github.com/9seconds/mtg/utils"
10
+	"github.com/9seconds/mtg/wrappers/stream"
11 11
 )
12 12
 
13 13
 type baseTelegram struct {

+ 1
- 1
telegram/direct.go Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 package telegram
2 2
 
3
-import "mtg/conntypes"
3
+import "github.com/9seconds/mtg/conntypes"
4 4
 
5 5
 const (
6 6
 	directV4DefaultIdx conntypes.DC = 1

+ 1
- 1
telegram/interfaces.go Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 package telegram
2 2
 
3
-import "mtg/conntypes"
3
+import "github.com/9seconds/mtg/conntypes"
4 4
 
5 5
 type Telegram interface {
6 6
 	Dial(conntypes.DC, conntypes.ConnectionProtocol) (conntypes.StreamReadWriteCloser, error)

+ 2
- 2
telegram/middle.go Просмотреть файл

@@ -7,8 +7,8 @@ import (
7 7
 
8 8
 	"go.uber.org/zap"
9 9
 
10
-	"mtg/conntypes"
11
-	"mtg/telegram/api"
10
+	"github.com/9seconds/mtg/conntypes"
11
+	"github.com/9seconds/mtg/telegram/api"
12 12
 )
13 13
 
14 14
 const middleTelegramBackgroundUpdateEvery = time.Hour

+ 2
- 2
tlstypes/client_hello.go Просмотреть файл

@@ -6,8 +6,8 @@ import (
6 6
 	"crypto/sha256"
7 7
 	"fmt"
8 8
 
9
-	"mtg/config"
10
-	"mtg/utils"
9
+	"github.com/9seconds/mtg/config"
10
+	"github.com/9seconds/mtg/utils"
11 11
 )
12 12
 
13 13
 type ClientHello struct {

+ 1
- 1
tlstypes/handshake.go Просмотреть файл

@@ -3,7 +3,7 @@ package tlstypes
3 3
 import (
4 4
 	"bytes"
5 5
 
6
-	"mtg/utils"
6
+	"github.com/9seconds/mtg/utils"
7 7
 )
8 8
 
9 9
 type Handshake struct {

+ 1
- 1
tlstypes/server_hello.go Просмотреть файл

@@ -10,7 +10,7 @@ import (
10 10
 
11 11
 	"golang.org/x/crypto/curve25519"
12 12
 
13
-	"mtg/config"
13
+	"github.com/9seconds/mtg/config"
14 14
 )
15 15
 
16 16
 type ServerHello struct {

+ 1
- 1
utils/init_tcp.go Просмотреть файл

@@ -4,7 +4,7 @@ import (
4 4
 	"fmt"
5 5
 	"net"
6 6
 
7
-	"mtg/config"
7
+	"github.com/9seconds/mtg/config"
8 8
 )
9 9
 
10 10
 func InitTCP(conn net.Conn) error {

+ 1
- 1
wrappers/packet/mtproto_frame.go Просмотреть файл

@@ -12,7 +12,7 @@ import (
12 12
 
13 13
 	"go.uber.org/zap"
14 14
 
15
-	"mtg/conntypes"
15
+	"github.com/9seconds/mtg/conntypes"
16 16
 )
17 17
 
18 18
 const (

+ 2
- 2
wrappers/packetack/client_abridged.go Просмотреть файл

@@ -8,8 +8,8 @@ import (
8 8
 
9 9
 	"go.uber.org/zap"
10 10
 
11
-	"mtg/conntypes"
12
-	"mtg/utils"
11
+	"github.com/9seconds/mtg/conntypes"
12
+	"github.com/9seconds/mtg/utils"
13 13
 )
14 14
 
15 15
 const (

+ 1
- 1
wrappers/packetack/client_intermediate.go Просмотреть файл

@@ -9,7 +9,7 @@ import (
9 9
 
10 10
 	"go.uber.org/zap"
11 11
 
12
-	"mtg/conntypes"
12
+	"github.com/9seconds/mtg/conntypes"
13 13
 )
14 14
 
15 15
 const clientIntermediateQuickAckLength = 0x80000000

+ 1
- 1
wrappers/packetack/client_intermediate_secure.go Просмотреть файл

@@ -8,7 +8,7 @@ import (
8 8
 
9 9
 	"go.uber.org/zap"
10 10
 
11
-	"mtg/conntypes"
11
+	"github.com/9seconds/mtg/conntypes"
12 12
 )
13 13
 
14 14
 type wrapperClientIntermediateSecure struct {

+ 5
- 5
wrappers/packetack/proxy.go Просмотреть файл

@@ -6,11 +6,11 @@ import (
6 6
 	"fmt"
7 7
 	"net"
8 8
 
9
-	"mtg/config"
10
-	"mtg/conntypes"
11
-	"mtg/hub"
12
-	"mtg/mtproto/rpc"
13
-	"mtg/protocol"
9
+	"github.com/9seconds/mtg/config"
10
+	"github.com/9seconds/mtg/conntypes"
11
+	"github.com/9seconds/mtg/hub"
12
+	"github.com/9seconds/mtg/mtproto/rpc"
13
+	"github.com/9seconds/mtg/protocol"
14 14
 )
15 15
 
16 16
 type wrapperProxy struct {

+ 1
- 1
wrappers/stream/base.go Просмотреть файл

@@ -3,7 +3,7 @@ package stream
3 3
 import (
4 4
 	"net"
5 5
 
6
-	"mtg/conntypes"
6
+	"github.com/9seconds/mtg/conntypes"
7 7
 )
8 8
 
9 9
 func NewClientConn(parent net.Conn, connID conntypes.ConnID) conntypes.StreamReadWriteCloser {

+ 2
- 2
wrappers/stream/blockcipher.go Просмотреть файл

@@ -9,8 +9,8 @@ import (
9 9
 
10 10
 	"go.uber.org/zap"
11 11
 
12
-	"mtg/conntypes"
13
-	"mtg/utils"
12
+	"github.com/9seconds/mtg/conntypes"
13
+	"github.com/9seconds/mtg/utils"
14 14
 )
15 15
 
16 16
 type wrapperBlockCipher struct {

+ 2
- 2
wrappers/stream/conn.go Просмотреть файл

@@ -7,8 +7,8 @@ import (
7 7
 
8 8
 	"go.uber.org/zap"
9 9
 
10
-	"mtg/config"
11
-	"mtg/conntypes"
10
+	"github.com/9seconds/mtg/config"
11
+	"github.com/9seconds/mtg/conntypes"
12 12
 )
13 13
 
14 14
 type connPurpose uint8

+ 1
- 1
wrappers/stream/ctx.go Просмотреть файл

@@ -8,7 +8,7 @@ import (
8 8
 
9 9
 	"go.uber.org/zap"
10 10
 
11
-	"mtg/conntypes"
11
+	"github.com/9seconds/mtg/conntypes"
12 12
 )
13 13
 
14 14
 type wrapperCtx struct {

+ 2
- 2
wrappers/stream/faketls.go Просмотреть файл

@@ -8,8 +8,8 @@ import (
8 8
 
9 9
 	"go.uber.org/zap"
10 10
 
11
-	"mtg/conntypes"
12
-	"mtg/tlstypes"
11
+	"github.com/9seconds/mtg/conntypes"
12
+	"github.com/9seconds/mtg/tlstypes"
13 13
 )
14 14
 
15 15
 type wrapperFakeTLS struct {

+ 3
- 3
wrappers/stream/mtproto_cipher.go Просмотреть файл

@@ -9,9 +9,9 @@ import (
9 9
 	"encoding/binary"
10 10
 	"net"
11 11
 
12
-	"mtg/conntypes"
13
-	"mtg/mtproto/rpc"
14
-	"mtg/utils"
12
+	"github.com/9seconds/mtg/conntypes"
13
+	"github.com/9seconds/mtg/mtproto/rpc"
14
+	"github.com/9seconds/mtg/utils"
15 15
 )
16 16
 
17 17
 type mtprotoCipherPurpose uint8

+ 1
- 1
wrappers/stream/obfuscated2.go Просмотреть файл

@@ -8,7 +8,7 @@ import (
8 8
 
9 9
 	"go.uber.org/zap"
10 10
 
11
-	"mtg/conntypes"
11
+	"github.com/9seconds/mtg/conntypes"
12 12
 )
13 13
 
14 14
 type wrapperObfuscated2 struct {

+ 1
- 1
wrappers/stream/rewind.go Просмотреть файл

@@ -9,7 +9,7 @@ import (
9 9
 
10 10
 	"go.uber.org/zap"
11 11
 
12
-	"mtg/conntypes"
12
+	"github.com/9seconds/mtg/conntypes"
13 13
 )
14 14
 
15 15
 type ReadWriteCloseRewinder interface {

+ 2
- 2
wrappers/stream/stats_telegram.go Просмотреть файл

@@ -7,8 +7,8 @@ import (
7 7
 
8 8
 	"go.uber.org/zap"
9 9
 
10
-	"mtg/conntypes"
11
-	"mtg/stats"
10
+	"github.com/9seconds/mtg/conntypes"
11
+	"github.com/9seconds/mtg/stats"
12 12
 )
13 13
 
14 14
 type wrapperTelegramStats struct {

+ 2
- 2
wrappers/stream/stats_traffic.go Просмотреть файл

@@ -6,8 +6,8 @@ import (
6 6
 
7 7
 	"go.uber.org/zap"
8 8
 
9
-	"mtg/conntypes"
10
-	"mtg/stats"
9
+	"github.com/9seconds/mtg/conntypes"
10
+	"github.com/9seconds/mtg/stats"
11 11
 )
12 12
 
13 13
 type wrapperTrafficStats struct {

+ 1
- 1
wrappers/stream/timeout.go Просмотреть файл

@@ -6,7 +6,7 @@ import (
6 6
 
7 7
 	"go.uber.org/zap"
8 8
 
9
-	"mtg/conntypes"
9
+	"github.com/9seconds/mtg/conntypes"
10 10
 )
11 11
 
12 12
 const (

Загрузка…
Отмена
Сохранить