Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: export packages #1325

Merged
merged 2 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
)

func TestExpandReset(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dlkey/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os"
"path"

"github.com/gotd/td/internal/keyparser"
"github.com/gotd/td/keyparser"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/gotdgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/gotd/tl"

"github.com/gotd/td/internal/gen"
"github.com/gotd/td/gen"
)

type formattedSource struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mtprint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"
"os"

"github.com/gotd/td/internal/proto/codec"
"github.com/gotd/td/proto/codec"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/mtprint/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"github.com/k0kubun/pp/v3"

"github.com/gotd/td/bin"
"github.com/gotd/td/internal/mt"
"github.com/gotd/td/internal/proto/codec"
"github.com/gotd/td/internal/tmap"
"github.com/gotd/td/mt"
"github.com/gotd/td/proto/codec"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tg"
"github.com/gotd/td/tmap"
"github.com/gotd/td/transport"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/mtprint/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/require"

"github.com/gotd/td/bin"
"github.com/gotd/td/internal/mt"
"github.com/gotd/td/internal/proto/codec"
"github.com/gotd/td/mt"
"github.com/gotd/td/proto/codec"
"github.com/gotd/td/tg"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/rsagen/_example/rsagen_empty_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/rsagen/_example/rsagen_many_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/rsagen/_example/rsagen_single_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/rsagen/_template/test.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

func {{ .TestFunc }}(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/rsagen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/go-faster/errors"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

//go:embed _template/*.tmpl
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/gotd/td/bin"
"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
)

func TestDecrypt(t *testing.T) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/gotd/td/bin"
"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
)

func TestEncrypt(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/crypto/fuzz_test.go → crypto/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"math/rand"
"testing"

"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
)

func FuzzRSA(f *testing.F) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/crypto/keys_test.go → crypto/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/gotd/td/bin"
"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
)

func genMessageAndAuthKeys() (Key, bin.Int128) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/crypto/rsa_pad_test.go → crypto/rsa_pad_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
)

func TestRSAPad(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
)

func TestSRP_NewHash(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/crypto/srp/pad.go → crypto/srp/pad.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package srp
import (
"math/big"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

func (s SRP) pad256FromBig(i *big.Int) (b [256]byte, r bool) {
Expand Down
2 changes: 1 addition & 1 deletion internal/crypto/srp/srp.go → crypto/srp/srp.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/go-faster/xor"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

// SRP is client implementation of Secure Remote Password protocol.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
go.uber.org/atomic v1.11.0
go.uber.org/zap v1.26.0
golang.org/x/sync v0.6.0
golang.org/x/term v0.16.0
golang.org/x/term v0.17.0
golang.org/x/time v0.3.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)
Expand All @@ -33,19 +33,19 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/gotd/ige v0.2.2 // indirect
github.com/gotd/neo v0.1.5 // indirect
github.com/klauspost/compress v1.17.5 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/otel v1.23.1 // indirect
go.opentelemetry.io/otel/trace v1.23.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20230116083435-1de6713980de // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
nhooyr.io/websocket v1.8.10 // indirect
rsc.io/qr v0.2.0 // indirect
)
Expand Down
8 changes: 8 additions & 0 deletions examples/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0
github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.17.5 h1:d4vBd+7CHydUqpFBgUEKkSdtSugf9YFmSkvUYPquI5E=
github.com/klauspost/compress v1.17.5/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/klauspost/compress v1.17.6/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
Expand Down Expand Up @@ -232,8 +234,10 @@ go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y=
go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI=
go.opentelemetry.io/otel v1.23.1/go.mod h1:Td0134eafDLcTS4y+zQ26GE8u3dEuRBiBCTUIRHaikA=
go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0=
go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo=
go.opentelemetry.io/otel/trace v1.23.1/go.mod h1:4IpnpJFwr1mo/6HL8XIPJaE9y0+u1KcVmuW7dwFSVrI=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
Expand All @@ -249,6 +253,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
Expand Down Expand Up @@ -280,6 +285,7 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -309,8 +315,10 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand Down
2 changes: 1 addition & 1 deletion internal/exchange/client.go → exchange/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"go.uber.org/zap"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

// ClientExchange is a client-side key exchange flow.
Expand Down
6 changes: 3 additions & 3 deletions internal/exchange/client_flow.go → exchange/client_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"go.uber.org/zap"

"github.com/gotd/td/bin"
"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/internal/mt"
"github.com/gotd/td/internal/proto"
"github.com/gotd/td/crypto"
"github.com/gotd/td/mt"
"github.com/gotd/td/proto"
)

// Run runs client-side flow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/internal/tdsync"
"github.com/gotd/td/crypto"
"github.com/gotd/td/tdsync"
"github.com/gotd/td/transport"
)

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions internal/exchange/flow.go → exchange/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"go.uber.org/zap"

"github.com/gotd/td/clock"
"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/internal/proto"
"github.com/gotd/td/crypto"
"github.com/gotd/td/proto"
"github.com/gotd/td/transport"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/exchange/flow_test.go → exchange/flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"go.uber.org/zap/zaptest"
"golang.org/x/sync/errgroup"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/internal/tdsync"
"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/crypto"
"github.com/gotd/td/tdsync"
"github.com/gotd/td/testutil"
"github.com/gotd/td/transport"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/exchange/fuzz_test.go → exchange/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"go.uber.org/zap"
"golang.org/x/sync/errgroup"

"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/testutil"
"github.com/gotd/td/transport"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/exchange/generator.go → exchange/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/go-faster/errors"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

// ServerRNG is server-side random number generator.
Expand Down
2 changes: 1 addition & 1 deletion internal/exchange/key.go → exchange/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package exchange
import (
"crypto/rsa"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

// PublicKey is a public Telegram server key.
Expand Down
4 changes: 2 additions & 2 deletions internal/exchange/proto.go → exchange/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

"github.com/gotd/td/bin"
"github.com/gotd/td/clock"
"github.com/gotd/td/internal/proto"
"github.com/gotd/td/internal/proto/codec"
"github.com/gotd/td/proto"
"github.com/gotd/td/proto/codec"
"github.com/gotd/td/transport"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/exchange/server.go → exchange/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"go.uber.org/zap"

"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/crypto"
)

// ServerExchange is a server-side key exchange flow.
Expand Down
6 changes: 3 additions & 3 deletions internal/exchange/server_flow.go → exchange/server_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"go.uber.org/zap"

"github.com/gotd/td/bin"
"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/internal/mt"
"github.com/gotd/td/internal/proto/codec"
"github.com/gotd/td/crypto"
"github.com/gotd/td/mt"
"github.com/gotd/td/proto/codec"
)

// ServerExchangeError is returned when exchange fails due to
Expand Down
2 changes: 1 addition & 1 deletion fileid/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"go.uber.org/zap/zaptest"

"github.com/gotd/td/fileid"
"github.com/gotd/td/internal/testutil"
"github.com/gotd/td/telegram"
"github.com/gotd/td/telegram/downloader"
"github.com/gotd/td/testutil"
)

func runBot(ctx context.Context, token, fileID string, logger *zap.Logger) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/gen/_template/box.tmpl → gen/_template/box.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- /*gotype: github.com/gotd/td/internal/gen.interfaceConfig*/ -}}
{{- /*gotype: github.com/gotd/td/gen.interfaceConfig*/ -}}
{{ define "box" }}{{ $f := .Interface }}
// Decode{{ $f.Func }} implements binary de-serialization for {{ $f.Name }}.
func Decode{{ $f.Func }} (buf *bin.Buffer) ({{ $f.Name }}, error) {
Expand Down
File renamed without changes.
Loading
Loading