mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 11:44:02 +03:00
Rename module from mtg to github.com/9seconds/mtg
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/VictoriaMetrics/fastcache"
|
||||
|
||||
"mtg/config"
|
||||
"github.com/9seconds/mtg/config"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
|
||||
"mtg/config"
|
||||
"github.com/9seconds/mtg/config"
|
||||
)
|
||||
|
||||
func Generate(secretType, hostname string) {
|
||||
|
||||
+10
-10
@@ -8,16 +8,16 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
|
||||
"mtg/antireplay"
|
||||
"mtg/config"
|
||||
"mtg/faketls"
|
||||
"mtg/hub"
|
||||
"mtg/ntp"
|
||||
"mtg/obfuscated2"
|
||||
"mtg/proxy"
|
||||
"mtg/stats"
|
||||
"mtg/telegram"
|
||||
"mtg/utils"
|
||||
"github.com/9seconds/mtg/antireplay"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/faketls"
|
||||
"github.com/9seconds/mtg/hub"
|
||||
"github.com/9seconds/mtg/ntp"
|
||||
"github.com/9seconds/mtg/obfuscated2"
|
||||
"github.com/9seconds/mtg/proxy"
|
||||
"github.com/9seconds/mtg/stats"
|
||||
"github.com/9seconds/mtg/telegram"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
func Proxy() error { // nolint: funlen
|
||||
|
||||
@@ -11,14 +11,14 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"mtg/antireplay"
|
||||
"mtg/config"
|
||||
"mtg/conntypes"
|
||||
"mtg/obfuscated2"
|
||||
"mtg/protocol"
|
||||
"mtg/stats"
|
||||
"mtg/tlstypes"
|
||||
"mtg/wrappers/stream"
|
||||
"github.com/9seconds/mtg/antireplay"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/obfuscated2"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/stats"
|
||||
"github.com/9seconds/mtg/tlstypes"
|
||||
"github.com/9seconds/mtg/wrappers/stream"
|
||||
)
|
||||
|
||||
type ClientProtocol struct {
|
||||
|
||||
+4
-4
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/mtproto"
|
||||
"mtg/mtproto/rpc"
|
||||
"mtg/protocol"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/mtproto"
|
||||
"github.com/9seconds/mtg/mtproto/rpc"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
)
|
||||
|
||||
type connection struct {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"mtg/config"
|
||||
"github.com/9seconds/mtg/config"
|
||||
)
|
||||
|
||||
type connectionList struct {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"mtg/protocol"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
)
|
||||
|
||||
type hub struct {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package hub
|
||||
|
||||
import "mtg/protocol"
|
||||
import "github.com/9seconds/mtg/protocol"
|
||||
|
||||
type Interface interface {
|
||||
Register(*protocol.TelegramRequest) (*ProxyConn, error)
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package hub
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/protocol"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
)
|
||||
|
||||
type muxNewRequest struct {
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/mtproto/rpc"
|
||||
"mtg/protocol"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/mtproto/rpc"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -7,15 +7,15 @@ import (
|
||||
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
"mtg/cli"
|
||||
"mtg/config"
|
||||
"mtg/utils"
|
||||
"github.com/9seconds/mtg/cli"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
var version = "dev" // this has to be set by build ld flags
|
||||
|
||||
var (
|
||||
app = kingpin.New("mtg", "Simple MTPROTO proxy.")
|
||||
app = kingpin.New("MTG", "Simple MTPROTO proxy.")
|
||||
|
||||
generateSecretCommand = app.Command("generate-secret",
|
||||
"Generate new secret")
|
||||
@@ -66,7 +66,7 @@ var (
|
||||
runStatsNamespace = runCommand.Flag("stats-namespace",
|
||||
"Which namespace to use for Prometheus.").
|
||||
Envar("MTG_STATS_NAMESPACE").
|
||||
Default("mtg").
|
||||
Default("MTG").
|
||||
String()
|
||||
runStatsdAddress = runCommand.Flag("statsd-addr",
|
||||
"Host:port of statsd server").
|
||||
|
||||
+6
-6
@@ -3,12 +3,12 @@ package mtproto
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/mtproto/rpc"
|
||||
"mtg/protocol"
|
||||
"mtg/telegram"
|
||||
"mtg/wrappers/packet"
|
||||
"mtg/wrappers/stream"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/mtproto/rpc"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/telegram"
|
||||
"github.com/9seconds/mtg/wrappers/packet"
|
||||
"github.com/9seconds/mtg/wrappers/stream"
|
||||
)
|
||||
|
||||
func TelegramProtocol(req *protocol.TelegramRequest) (conntypes.PacketReadWriteCloser, error) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type ProxyResponseType uint8
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"mtg/antireplay"
|
||||
"mtg/config"
|
||||
"mtg/conntypes"
|
||||
"mtg/protocol"
|
||||
"mtg/stats"
|
||||
"mtg/utils"
|
||||
"mtg/wrappers/stream"
|
||||
"github.com/9seconds/mtg/antireplay"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/stats"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
"github.com/9seconds/mtg/wrappers/stream"
|
||||
)
|
||||
|
||||
const clientProtocolHandshakeTimeout = 10 * time.Second
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/protocol"
|
||||
"mtg/telegram"
|
||||
"mtg/utils"
|
||||
"mtg/wrappers/stream"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/telegram"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
"github.com/9seconds/mtg/wrappers/stream"
|
||||
)
|
||||
|
||||
func TelegramProtocol(req *protocol.TelegramRequest) (conntypes.StreamReadWriteCloser, error) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package protocol
|
||||
|
||||
import "mtg/conntypes"
|
||||
import "github.com/9seconds/mtg/conntypes"
|
||||
|
||||
type ClientProtocol interface {
|
||||
Handshake(conntypes.StreamReadWriteCloser) (conntypes.StreamReadWriteCloser, error)
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type TelegramRequest struct {
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/obfuscated2"
|
||||
"mtg/protocol"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/obfuscated2"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
)
|
||||
|
||||
const directPipeBufferSize = 1024 * 1024
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/protocol"
|
||||
"mtg/wrappers/packetack"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/wrappers/packetack"
|
||||
)
|
||||
|
||||
func middleConnection(request *protocol.TelegramRequest) {
|
||||
|
||||
+6
-6
@@ -6,12 +6,12 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/config"
|
||||
"mtg/conntypes"
|
||||
"mtg/protocol"
|
||||
"mtg/stats"
|
||||
"mtg/utils"
|
||||
"mtg/wrappers/stream"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/stats"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
"github.com/9seconds/mtg/wrappers/stream"
|
||||
)
|
||||
|
||||
type Proxy struct {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package stats
|
||||
import (
|
||||
"net"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type IngressTrafficInterface interface {
|
||||
|
||||
@@ -3,7 +3,7 @@ package stats
|
||||
import (
|
||||
"net"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type multiStats []Interface
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"mtg/config"
|
||||
"github.com/9seconds/mtg/config"
|
||||
)
|
||||
|
||||
var Stats Interface
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
"mtg/config"
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type statsPrometheus struct {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
statsd "github.com/smira/go-statsd"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/config"
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
apiUserAgent = "mtg"
|
||||
apiUserAgent = "github.com/9seconds/mtg"
|
||||
apiHTTPTimeout = 30 * time.Second
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import (
|
||||
"math/rand"
|
||||
"net"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/utils"
|
||||
"mtg/wrappers/stream"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
"github.com/9seconds/mtg/wrappers/stream"
|
||||
)
|
||||
|
||||
type baseTelegram struct {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package telegram
|
||||
|
||||
import "mtg/conntypes"
|
||||
import "github.com/9seconds/mtg/conntypes"
|
||||
|
||||
const (
|
||||
directV4DefaultIdx conntypes.DC = 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package telegram
|
||||
|
||||
import "mtg/conntypes"
|
||||
import "github.com/9seconds/mtg/conntypes"
|
||||
|
||||
type Telegram interface {
|
||||
Dial(conntypes.DC, conntypes.ConnectionProtocol) (conntypes.StreamReadWriteCloser, error)
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/telegram/api"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/telegram/api"
|
||||
)
|
||||
|
||||
const middleTelegramBackgroundUpdateEvery = time.Hour
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"mtg/config"
|
||||
"mtg/utils"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
type ClientHello struct {
|
||||
|
||||
@@ -3,7 +3,7 @@ package tlstypes
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"mtg/utils"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
type Handshake struct {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"golang.org/x/crypto/curve25519"
|
||||
|
||||
"mtg/config"
|
||||
"github.com/9seconds/mtg/config"
|
||||
)
|
||||
|
||||
type ServerHello struct {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"mtg/config"
|
||||
"github.com/9seconds/mtg/config"
|
||||
)
|
||||
|
||||
func InitTCP(conn net.Conn) error {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/utils"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
const clientIntermediateQuickAckLength = 0x80000000
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type wrapperClientIntermediateSecure struct {
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"mtg/config"
|
||||
"mtg/conntypes"
|
||||
"mtg/hub"
|
||||
"mtg/mtproto/rpc"
|
||||
"mtg/protocol"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/hub"
|
||||
"github.com/9seconds/mtg/mtproto/rpc"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
)
|
||||
|
||||
type wrapperProxy struct {
|
||||
|
||||
@@ -3,7 +3,7 @@ package stream
|
||||
import (
|
||||
"net"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
func NewClientConn(parent net.Conn, connID conntypes.ConnID) conntypes.StreamReadWriteCloser {
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/utils"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
type wrapperBlockCipher struct {
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/config"
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type connPurpose uint8
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type wrapperCtx struct {
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/tlstypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/tlstypes"
|
||||
)
|
||||
|
||||
type wrapperFakeTLS struct {
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"encoding/binary"
|
||||
"net"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/mtproto/rpc"
|
||||
"mtg/utils"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/mtproto/rpc"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
type mtprotoCipherPurpose uint8
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type wrapperObfuscated2 struct {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
type ReadWriteCloseRewinder interface {
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/stats"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/stats"
|
||||
)
|
||||
|
||||
type wrapperTelegramStats struct {
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"mtg/stats"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/stats"
|
||||
)
|
||||
|
||||
type wrapperTrafficStats struct {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"mtg/conntypes"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user